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
.cms
.ui
.workbench
.internal
.jcr
.parts
;
18 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
19 import org
.eclipse
.ui
.IEditorInput
;
20 import org
.eclipse
.ui
.IPersistableElement
;
23 * An editor input based on three strings define a node :
25 * <li>complete path to the node</li>
26 * <li>the workspace name</li>
27 * <li>the repository alias</li>
29 * In a single workspace and/or repository environment, name and alias can be
32 * Note : unused for the time being.
35 public class StringNodeEditorInput
implements IEditorInput
{
36 private final String path
;
37 private final String repositoryAlias
;
38 private final String workspaceName
;
41 * In order to implement a generic explorer that supports remote and multi
42 * workspaces repositories, node path can be detailed by these strings.
44 * @param repositoryAlias
46 * @param workspaceName
50 public StringNodeEditorInput(String repositoryAlias
, String workspaceName
,
53 this.repositoryAlias
= repositoryAlias
;
54 this.workspaceName
= workspaceName
;
57 @SuppressWarnings("unchecked")
58 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
62 public boolean exists() {
66 public ImageDescriptor
getImageDescriptor() {
70 public String
getName() {
74 public String
getRepositoryAlias() {
75 return repositoryAlias
;
78 public String
getWorkspaceName() {
82 public IPersistableElement
getPersistable() {
86 public String
getToolTipText() {
90 public String
getPath() {
94 public boolean equals(Object obj
) {
99 if (getClass() != obj
.getClass())
102 StringNodeEditorInput other
= (StringNodeEditorInput
) obj
;
104 if (!path
.equals(other
.getPath()))
107 String own
= other
.getWorkspaceName();
108 if ((workspaceName
== null && own
!= null)
109 || (workspaceName
!= null && (own
== null || !workspaceName
113 String ora
= other
.getRepositoryAlias();
114 if ((repositoryAlias
== null && ora
!= null)
115 || (repositoryAlias
!= null && (ora
== null || !repositoryAlias