1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.client.ui.dist.editors;
17
18 import org.argeo.slc.SlcException;
19 import org.argeo.slc.SlcNames;
20 import org.eclipse.jface.resource.ImageDescriptor;
21 import org.eclipse.ui.IEditorInput;
22 import org.eclipse.ui.IPersistableElement;
23
24
25 public class DistWkspEditorInput implements IEditorInput, SlcNames {
26
27
28
29
30
31 private String repoNodePath;
32 private String uri;
33
34
35 private String workspaceName;
36
37
38
39
40
41
42
43
44
45
46
47
48
49 public DistWkspEditorInput(String repoNodePath, String uri,
50 String workspaceName) {
51 if (workspaceName == null)
52 throw new SlcException("Workspace name cannot be null");
53 if (uri == null)
54 throw new SlcException("URI for repository cannot be null");
55 this.repoNodePath = repoNodePath;
56 this.workspaceName = workspaceName;
57 this.uri = uri;
58 }
59
60 public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
61 return null;
62 }
63
64 public boolean exists() {
65 return true;
66 }
67
68 public ImageDescriptor getImageDescriptor() {
69 return null;
70 }
71
72
73 public String getToolTipText() {
74 return "Editor for workspace " + workspaceName
75 + " in repository of URI " + uri;
76 }
77
78 public String getName() {
79 return workspaceName + "@" + uri;
80 }
81
82 public IPersistableElement getPersistable() {
83 return null;
84 }
85
86 public boolean equals(Object obj) {
87 if (this == obj)
88 return true;
89 if (obj == null)
90 return false;
91 if (!(obj instanceof DistWkspEditorInput))
92 return false;
93
94 DistWkspEditorInput other = (DistWkspEditorInput) obj;
95
96 if (!workspaceName.equals(other.getWorkspaceName()))
97 return false;
98 if (!uri.equals(other.getUri()))
99 return false;
100
101 if (repoNodePath == null)
102 return other.getRepoNodePath() == null;
103 else
104 return repoNodePath.equals(other.getRepoNodePath());
105 }
106
107 public String getUri() {
108 return uri;
109 }
110
111 public String getWorkspaceName() {
112 return workspaceName;
113 }
114
115 public String getRepoNodePath() {
116 return repoNodePath;
117 }
118 }