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
.slc
.client
.ui
.dist
.editors
;
18 import javax
.jcr
.Node
;
20 import org
.argeo
.ArgeoException
;
21 import org
.argeo
.slc
.client
.ui
.dist
.DistPlugin
;
22 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
23 import org
.eclipse
.ui
.IEditorInput
;
24 import org
.eclipse
.ui
.IEditorSite
;
25 import org
.eclipse
.ui
.PartInitException
;
26 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.
34 public class GenericArtifactEditor
extends FormEditor
{
36 // private final static Log log =
37 // LogFactory.getLog(GenericNodeEditor.class);
38 public final static String ID
= DistPlugin
.ID
+ ".genericArtifactEditor";
41 private Node artifactNode
;
43 // This Editor widgets
44 private ArtifactDetailsPage artifactDetailsPage
;
46 public void init(IEditorSite site
, IEditorInput input
)
47 throws PartInitException
{
48 super.init(site
, input
);
49 GenericArtifactEditorInput gaei
= (GenericArtifactEditorInput
) getEditorInput();
50 artifactNode
= gaei
.getArtifactNode();
51 this.setPartName(gaei
.getArtifactId());
55 protected void addPages() {
58 artifactDetailsPage
= new ArtifactDetailsPage(this, "Main",
60 addPage(artifactDetailsPage
);
61 } catch (PartInitException e
) {
62 throw new ArgeoException("Not able to add an empty page ", e
);
67 public void doSaveAs() {
68 // unused compulsory method
72 public void doSave(IProgressMonitor monitor
) {
74 // Automatically commit all pages of the editor
76 firePropertyChange(PROP_DIRTY
);
77 } catch (Exception e
) {
78 throw new ArgeoException("Error while saving node", e
);
84 public boolean isSaveAsAllowed() {
88 Node
getArtifactNode() {