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 javax
.jcr
.Node
;
20 import org
.argeo
.ArgeoException
;
21 import org
.argeo
.jcr
.JcrUtils
;
22 import org
.argeo
.jcr
.ui
.explorer
.JcrExplorerPlugin
;
23 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
24 import org
.eclipse
.ui
.IEditorInput
;
25 import org
.eclipse
.ui
.IEditorSite
;
26 import org
.eclipse
.ui
.PartInitException
;
27 import org
.eclipse
.ui
.forms
.editor
.FormEditor
;
30 * Container for the node editor page. At creation time, it takes a JCR Node
31 * that cannot be changed afterwards.
33 public class GenericNodeEditor
extends FormEditor
{
35 // private final static Log log =
36 // LogFactory.getLog(GenericNodeEditor.class);
37 public final static String ID
= JcrExplorerPlugin
.ID
+ ".genericNodeEditor";
39 private Node currentNode
;
41 private GenericPropertyPage genericPropertyPage
;
42 private ChildNodesPage childNodesPage
;
43 private NodeRightsManagementPage nodeRightsManagementPage
;
44 private NodeVersionHistoryPage nodeVersionHistoryPage
;
46 public void init(IEditorSite site
, IEditorInput input
)
47 throws PartInitException
{
48 super.init(site
, input
);
49 GenericNodeEditorInput nei
= (GenericNodeEditorInput
) getEditorInput();
50 currentNode
= nei
.getCurrentNode();
51 this.setPartName(JcrUtils
.lastPathElement(nei
.getPath()));
55 protected void addPages() {
57 // genericNodePage = new GenericNodePage(this,
58 // JcrExplorerPlugin.getMessage("genericNodePageTitle"),
60 // addPage(genericNodePage);
62 genericPropertyPage
= new GenericPropertyPage(this,
63 JcrExplorerPlugin
.getMessage("genericNodePageTitle"),
65 addPage(genericPropertyPage
);
67 childNodesPage
= new ChildNodesPage(this,
68 JcrExplorerPlugin
.getMessage("childNodesPageTitle"),
70 addPage(childNodesPage
);
72 nodeRightsManagementPage
= new NodeRightsManagementPage(this,
74 .getMessage("nodeRightsManagementPageTitle"),
76 addPage(nodeRightsManagementPage
);
78 nodeVersionHistoryPage
= new NodeVersionHistoryPage(
80 JcrExplorerPlugin
.getMessage("nodeVersionHistoryPageTitle"),
82 addPage(nodeVersionHistoryPage
);
83 } catch (PartInitException e
) {
84 throw new ArgeoException("Not able to add an empty page ", e
);
89 public void doSaveAs() {
90 // unused compulsory method
94 public void doSave(IProgressMonitor monitor
) {
96 // Automatically commit all pages of the editor
98 firePropertyChange(PROP_DIRTY
);
99 } catch (Exception e
) {
100 throw new ArgeoException("Error while saving node", e
);
106 public boolean isSaveAsAllowed() {
110 Node
getCurrentNode() {