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
.eclipse
.ui
.workbench
.jcr
;
18 import javax
.jcr
.Node
;
20 import org
.argeo
.ArgeoException
;
21 import org
.argeo
.eclipse
.ui
.workbench
.WorkbenchUiPlugin
;
22 import org
.argeo
.eclipse
.ui
.workbench
.jcr
.internal
.parts
.ChildNodesPage
;
23 import org
.argeo
.eclipse
.ui
.workbench
.jcr
.internal
.parts
.GenericNodeEditorInput
;
24 import org
.argeo
.eclipse
.ui
.workbench
.jcr
.internal
.parts
.GenericPropertyPage
;
25 import org
.argeo
.eclipse
.ui
.workbench
.jcr
.internal
.parts
.NodeRightsManagementPage
;
26 import org
.argeo
.eclipse
.ui
.workbench
.jcr
.internal
.parts
.NodeVersionHistoryPage
;
27 import org
.argeo
.jcr
.JcrUtils
;
28 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
29 import org
.eclipse
.ui
.IEditorInput
;
30 import org
.eclipse
.ui
.IEditorSite
;
31 import org
.eclipse
.ui
.PartInitException
;
32 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
35 * Container for the node editor page. At creation time, it takes a JCR Node
36 * that cannot be changed afterwards.
38 public class DefaultNodeEditor
extends FormEditor
{
39 private static final long serialVersionUID
= -5397680152514917137L;
41 // private final static Log log =
42 // LogFactory.getLog(GenericNodeEditor.class);
43 public final static String ID
= WorkbenchUiPlugin
.ID
+ ".defaultNodeEditor";
45 private Node currentNode
;
47 private GenericPropertyPage genericPropertyPage
;
48 private ChildNodesPage childNodesPage
;
49 private NodeRightsManagementPage nodeRightsManagementPage
;
50 private NodeVersionHistoryPage nodeVersionHistoryPage
;
52 public void init(IEditorSite site
, IEditorInput input
)
53 throws PartInitException
{
54 super.init(site
, input
);
55 GenericNodeEditorInput nei
= (GenericNodeEditorInput
) getEditorInput();
56 currentNode
= nei
.getCurrentNode();
57 this.setPartName(JcrUtils
.lastPathElement(nei
.getPath()));
61 protected void addPages() {
63 // genericNodePage = new GenericNodePage(this,
64 // JcrExplorerPlugin.getMessage("genericNodePageTitle"),
66 // addPage(genericNodePage);
68 genericPropertyPage
= new GenericPropertyPage(this,
69 WorkbenchUiPlugin
.getMessage("genericNodePageTitle"),
71 addPage(genericPropertyPage
);
73 childNodesPage
= new ChildNodesPage(this,
74 WorkbenchUiPlugin
.getMessage("childNodesPageTitle"),
76 addPage(childNodesPage
);
78 nodeRightsManagementPage
= new NodeRightsManagementPage(this,
80 .getMessage("nodeRightsManagementPageTitle"),
82 addPage(nodeRightsManagementPage
);
84 nodeVersionHistoryPage
= new NodeVersionHistoryPage(
86 WorkbenchUiPlugin
.getMessage("nodeVersionHistoryPageTitle"),
88 addPage(nodeVersionHistoryPage
);
89 } catch (PartInitException e
) {
90 throw new ArgeoException("Not able to add an empty page ", e
);
95 public void doSaveAs() {
96 // unused compulsory method
100 public void doSave(IProgressMonitor monitor
) {
102 // Automatically commit all pages of the editor
104 firePropertyChange(PROP_DIRTY
);
105 } catch (Exception e
) {
106 throw new ArgeoException("Error while saving node", e
);
112 public boolean isSaveAsAllowed() {
116 Node
getCurrentNode() {