1 package org
.argeo
.jcr
.ui
.explorer
.editors
;
4 import javax
.jcr
.RepositoryException
;
6 import org
.argeo
.ArgeoException
;
7 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
8 import org
.eclipse
.ui
.IEditorInput
;
9 import org
.eclipse
.ui
.IPersistableElement
;
12 * An editor input based the JCR node object.
15 public class GenericNodeEditorInput
implements IEditorInput
{
16 private final Node currentNode
;
18 // cache key properties at creation time to avoid Exception at recoring time
19 // when the session has been closed
24 public GenericNodeEditorInput(Node currentNode
) {
25 this.currentNode
= currentNode
;
27 name
= currentNode
.getName();
28 uid
= currentNode
.getIdentifier();
29 path
= currentNode
.getPath();
30 } catch (RepositoryException re
) {
31 throw new ArgeoException(
32 "unexpected error while getting node key values at creation time",
37 public Node
getCurrentNode() {
41 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
45 public boolean exists() {
49 public ImageDescriptor
getImageDescriptor() {
53 public String
getName() {
57 public String
getUid() {
61 public String
getToolTipText() {
65 public String
getPath() {
69 public IPersistableElement
getPersistable() {
74 * equals method based on UID that is unique within a workspace and path of
75 * the node, thus 2 shared node that have same UID as defined in the spec
76 * but 2 different pathes will open two distinct editors.
78 * TODO enhance this method to support multirepository and multiworkspace
81 public boolean equals(Object obj
) {
86 if (getClass() != obj
.getClass())
89 GenericNodeEditorInput other
= (GenericNodeEditorInput
) obj
;
90 if (!getUid().equals(other
.getUid()))
92 if (!getPath().equals(other
.getPath()))