]>
git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/ModuleEditorInput.java
bc15959dcf3c323c589f2d0b5a739e596c95e09f
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.dist
.editors
;
18 import org
.argeo
.jcr
.JcrUtils
;
19 import org
.argeo
.slc
.SlcException
;
20 import org
.argeo
.slc
.jcr
.SlcNames
;
21 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
22 import org
.eclipse
.ui
.IEditorInput
;
23 import org
.eclipse
.ui
.IPersistableElement
;
26 * An editor input for a JCR node object in a multi-repository environment.
28 public class ModuleEditorInput
implements IEditorInput
, SlcNames
{
30 // Define relevant workspace on a given repository
31 private String repoNodePath
;
33 private String workspaceName
;
34 private String modulePath
;
36 public ModuleEditorInput(String repoNodePath
, String uri
,
37 String workspaceName
, String artifactPath
) {
38 if (workspaceName
== null)
39 throw new SlcException("Workspace name cannot be null");
41 throw new SlcException("URI for repository cannot be null");
42 if (artifactPath
== null)
43 throw new SlcException("Module path cannot be null");
44 this.repoNodePath
= repoNodePath
;
46 this.workspaceName
= workspaceName
;
47 this.modulePath
= artifactPath
;
50 public String
getModulePath() {
54 public String
getWorkspaceName() {
58 public String
getRepoNodePath() {
62 public String
getUri() {
66 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
70 public boolean exists() {
74 public ImageDescriptor
getImageDescriptor() {
78 // Dummy compulsory methods
79 public String
getToolTipText() {
80 return getModulePath();
83 public String
getName() {
84 return JcrUtils
.lastPathElement(modulePath
);
87 public IPersistableElement
getPersistable() {
92 * equals method based on coordinates
94 public boolean equals(Object obj
) {
99 if (getClass() != obj
.getClass())
102 ModuleEditorInput other
= (ModuleEditorInput
) obj
;
104 if (!modulePath
.equals(other
.getModulePath()))
106 if (!workspaceName
.equals(other
.getWorkspaceName()))
108 if (!uri
.equals(other
.getUri()))
111 if (repoNodePath
== null)
112 return other
.getRepoNodePath() == null;
114 return repoNodePath
.equals(other
.getRepoNodePath());