]> git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/editors/DistWkspEditorInput.java
Prepare next development cacle
[gpl/argeo-slc.git] / legacy / org.argeo.slc.client.ui.dist / src / org / argeo / slc / client / ui / dist / editors / DistWkspEditorInput.java
1 package org.argeo.slc.client.ui.dist.editors;
2
3 import org.argeo.slc.SlcException;
4 import org.argeo.slc.SlcNames;
5 import org.eclipse.jface.resource.ImageDescriptor;
6 import org.eclipse.ui.IEditorInput;
7 import org.eclipse.ui.IPersistableElement;
8
9 /** An editor input pointing to a distribution workspace */
10 public class DistWkspEditorInput implements IEditorInput, SlcNames {
11
12 // Injected
13 // private RepositoryFactory repositoryFactory;
14 // private Keyring keyring;
15 // private Node repoNode;
16 private String repoNodePath;
17 private String uri;
18
19 // Local variables
20 private String workspaceName;
21
22 // public WorkspaceEditorInput(RepositoryFactory repositoryFactory,
23 // Keyring keyring, Repository localRepository, Node repoNode,
24 // String uri) {
25 // // this.repositoryFactory = repositoryFactory;
26 // // this.keyring = keyring;
27 // this.localRepository = localRepository;
28 // // this.repoNode= repoNode;
29 // this.uri = uri;
30 //
31 // }
32
33 /** uri and workspace name cannot be null */
34 public DistWkspEditorInput(String repoNodePath, String uri,
35 String workspaceName) {
36 if (workspaceName == null)
37 throw new SlcException("Workspace name cannot be null");
38 if (uri == null)
39 throw new SlcException("URI for repository cannot be null");
40 this.repoNodePath = repoNodePath;
41 this.workspaceName = workspaceName;
42 this.uri = uri;
43 }
44
45 public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
46 return null;
47 }
48
49 public boolean exists() {
50 return true;
51 }
52
53 public ImageDescriptor getImageDescriptor() {
54 return null;
55 }
56
57 // Dummy compulsory methods
58 public String getToolTipText() {
59 return "Editor for workspace " + workspaceName
60 + " in repository of URI " + uri;
61 }
62
63 public String getName() {
64 return workspaceName + "@" + uri;
65 }
66
67 public IPersistableElement getPersistable() {
68 return null;
69 }
70
71 public boolean equals(Object obj) {
72 if (this == obj)
73 return true;
74 if (obj == null)
75 return false;
76 if (!(obj instanceof DistWkspEditorInput))
77 return false;
78
79 DistWkspEditorInput other = (DistWkspEditorInput) obj;
80
81 if (!workspaceName.equals(other.getWorkspaceName()))
82 return false;
83 if (!uri.equals(other.getUri()))
84 return false;
85
86 if (repoNodePath == null)
87 return other.getRepoNodePath() == null;
88 else
89 return repoNodePath.equals(other.getRepoNodePath());
90 }
91
92 public String getUri() {
93 return uri;
94 }
95
96 public String getWorkspaceName() {
97 return workspaceName;
98 }
99
100 public String getRepoNodePath() {
101 return repoNodePath;
102 }
103 }