2 * Copyright (C) 2007-2012 Mathieu Baudier
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
.jcr
.ui
.explorer
.editors
;
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 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
61 public boolean exists() {
65 public ImageDescriptor
getImageDescriptor() {
69 public String
getName() {
73 public String
getRepositoryAlias() {
74 return repositoryAlias
;
77 public String
getWorkspaceName() {
81 public IPersistableElement
getPersistable() {
85 public String
getToolTipText() {
89 public String
getPath() {
93 public boolean equals(Object obj
) {
98 if (getClass() != obj
.getClass())
101 StringNodeEditorInput other
= (StringNodeEditorInput
) obj
;
103 if (!path
.equals(other
.getPath()))
106 String own
= other
.getWorkspaceName();
107 if ((workspaceName
== null && own
!= null)
108 || (workspaceName
!= null && (own
== null || !workspaceName
112 String ora
= other
.getRepositoryAlias();
113 if ((repositoryAlias
== null && ora
!= null)
114 || (repositoryAlias
!= null && (ora
== null || !repositoryAlias