1 package org
.argeo
.cms
.ui
.workbench
.internal
.jcr
.parts
;
4 import javax
.jcr
.RepositoryException
;
6 import org
.argeo
.eclipse
.ui
.EclipseUiException
;
7 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
8 import org
.eclipse
.ui
.IEditorInput
;
9 import org
.eclipse
.ui
.IPersistableElement
;
11 /** Editor input for {@link Node} editors */
12 public class GenericNodeEditorInput
implements IEditorInput
{
13 private final Node currentNode
;
15 // Caches key properties at creation time to avoid Exception at recovering
16 // time when the session has been closed
21 public GenericNodeEditorInput(Node currentNode
) {
22 this.currentNode
= currentNode
;
24 name
= currentNode
.getName();
25 uid
= currentNode
.getIdentifier();
26 path
= currentNode
.getPath();
27 } catch (RepositoryException re
) {
28 throw new EclipseUiException("Cannot cache the key properties for " + currentNode
, re
);
32 public Node
getCurrentNode() {
36 @SuppressWarnings("unchecked")
37 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
41 public boolean exists() {
45 public ImageDescriptor
getImageDescriptor() {
49 public String
getName() {
53 public String
getUid() {
57 public String
getToolTipText() {
61 public String
getPath() {
65 public IPersistableElement
getPersistable() {
70 * Equals method based on UID that is unique within a workspace and path of
71 * the node, thus 2 shared node that have same UID as defined in the spec
72 * but 2 different paths will open two distinct editors.
74 * TODO enhance this method to support multi repository and multi workspace
77 public boolean equals(Object obj
) {
82 if (getClass() != obj
.getClass())
85 GenericNodeEditorInput other
= (GenericNodeEditorInput
) obj
;
86 if (!getUid().equals(other
.getUid()))
88 if (!getPath().equals(other
.getPath()))