1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2008</p>
22 * <p>Company: Ontotext Lab. / SIRMA </p>
23 */
24
25
26 package org.wsmostudio.bpmo.ui.editor;
27
28 import org.wsmostudio.bpmo.model.WorkflowEntityNode;
29
30 public class ClipboardManager {
31
32 private static ClipboardManager _clipboard;
33
34 private WorkflowEntityNode content = null;
35
36 private ClipboardManager() {
37 }
38
39 public static ClipboardManager getDefault() {
40 if (_clipboard == null) {
41 _clipboard = new ClipboardManager();
42 }
43 return _clipboard;
44 }
45
46 public WorkflowEntityNode getContent() {
47 if (this.content == null) {
48 return null;
49 }
50 return copyContent(this.content);
51 }
52
53 public void setContent(WorkflowEntityNode newContent) {
54 this.content = copyContent(newContent);
55 }
56
57 public boolean hasContent() {
58 return this.content != null;
59 }
60
61 @SuppressWarnings("unchecked")
62 public boolean checkContentType(Class type) {
63 return this.content != null
64 && type.isInstance(this.content);
65 }
66
67 public static WorkflowEntityNode copyContent(WorkflowEntityNode old) {
68 return old.cloneNode();
69
70 }
71
72 }