1 package org
.argeo
.jcr
.ui
.explorer
.editors
;
5 import org
.apache
.commons
.logging
.Log
;
6 import org
.apache
.commons
.logging
.LogFactory
;
7 import org
.argeo
.ArgeoException
;
8 import org
.argeo
.jcr
.JcrUtils
;
9 import org
.argeo
.jcr
.ui
.explorer
.JcrExplorerPlugin
;
10 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
11 import org
.eclipse
.ui
.IEditorInput
;
12 import org
.eclipse
.ui
.IEditorSite
;
13 import org
.eclipse
.ui
.PartInitException
;
14 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
17 * Parent Abstract GR multitab editor. Insure the presence of a GrBackend
19 public class GenericNodeEditor
extends FormEditor
{
21 private final static Log log
= LogFactory
.getLog(GenericNodeEditor
.class);
22 public final static String ID
= "org.argeo.jcr.ui.explorer.genericNodeEditor";
24 private Node currentNode
;
26 private GenericNodePage networkDetailsPage
;
28 public void init(IEditorSite site
, IEditorInput input
)
29 throws PartInitException
{
30 super.init(site
, input
);
31 GenericNodeEditorInput nei
= (GenericNodeEditorInput
) getEditorInput();
32 this.setPartName(JcrUtils
.lastPathElement(nei
.getPath()));
36 protected void addPages() {
37 EmptyNodePage enp
= new EmptyNodePage(this, "Empty node page");
40 } catch (PartInitException e
) {
41 throw new ArgeoException("Not able to add an empty page ", e
);
45 private void addPagesAfterNodeSet() {
47 networkDetailsPage
= new GenericNodePage(this,
48 JcrExplorerPlugin
.getMessage("genericNodePageTitle"),
50 addPage(networkDetailsPage
);
51 this.setActivePage(networkDetailsPage
.getIndex());
52 } catch (PartInitException e
) {
53 throw new ArgeoException("Not able to add page ", e
);
58 public void doSaveAs() {
59 // unused compulsory method
63 public void doSave(IProgressMonitor monitor
) {
65 // Automatically commit all pages of the editor
67 firePropertyChange(PROP_DIRTY
);
68 } catch (Exception e
) {
69 throw new ArgeoException("Error while saving node", e
);
75 public boolean isSaveAsAllowed() {
79 Node
getCurrentNode() {
83 public void setCurrentNode(Node currentNode
) {
84 boolean nodeWasNull
= this.currentNode
== null;
85 this.currentNode
= currentNode
;
88 addPagesAfterNodeSet();