]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/editors/ModuleEditorInput.java
1 package org
.argeo
.slc
.client
.ui
.dist
.editors
;
3 import org
.argeo
.jcr
.JcrUtils
;
4 import org
.argeo
.slc
.SlcException
;
5 import org
.argeo
.slc
.SlcNames
;
6 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
7 import org
.eclipse
.ui
.IEditorInput
;
8 import org
.eclipse
.ui
.IPersistableElement
;
10 /** Editor input for a JCR node object in a multi-repository environment */
11 public class ModuleEditorInput
implements IEditorInput
, SlcNames
{
13 // Define relevant workspace on a given repository
14 private String repoNodePath
;
16 private String workspaceName
;
17 private String modulePath
;
19 public ModuleEditorInput(String repoNodePath
, String uri
,
20 String workspaceName
, String artifactPath
) {
21 if (workspaceName
== null)
22 throw new SlcException("Workspace name cannot be null");
23 if (uri
== null && repoNodePath
== null)
24 throw new SlcException("Define at least one of the 2 "
25 + "parameters URI or Repo Node Path");
26 if (artifactPath
== null)
27 throw new SlcException("Module path cannot be null");
28 this.repoNodePath
= repoNodePath
;
30 this.workspaceName
= workspaceName
;
31 this.modulePath
= artifactPath
;
34 public String
getModulePath() {
38 public String
getWorkspaceName() {
42 public String
getRepoNodePath() {
46 public String
getUri() {
50 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
54 public boolean exists() {
58 public ImageDescriptor
getImageDescriptor() {
62 // Dummy compulsory methods
63 public String
getToolTipText() {
64 return getModulePath();
67 public String
getName() {
68 return JcrUtils
.lastPathElement(modulePath
);
71 public IPersistableElement
getPersistable() {
76 * equals method based on coordinates
78 public boolean equals(Object obj
) {
83 if (getClass() != obj
.getClass())
86 ModuleEditorInput other
= (ModuleEditorInput
) obj
;
88 if (!modulePath
.equals(other
.getModulePath()))
90 if (!workspaceName
.equals(other
.getWorkspaceName()))
93 if (uri
== null && other
.getUri() != null
94 || !uri
.equals(other
.getUri()))
97 if (repoNodePath
== null && other
.getRepoNodePath() != null
98 || !repoNodePath
.equals(other
.getRepoNodePath()))