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
.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
;
29 * Expose a bundle and enable its management
31 public class GenericBundleEditor
extends FormEditor
{
32 // private final static Log log =
33 // LogFactory.getLog(GenericNodeEditor.class);
35 public final static String ID
= DistPlugin
.ID
+ ".genericBundleEditor";
38 private Node bundleNode
;
40 // This Editor widgets
41 private BundleRawPage bundleRawPage
;
42 private BundleDetailsPage bundleDetailsPage
;
44 public void init(IEditorSite site
, IEditorInput input
)
45 throws PartInitException
{
46 super.init(site
, input
);
47 GenericBundleEditorInput gaei
= (GenericBundleEditorInput
) getEditorInput();
48 bundleNode
= gaei
.getArtifactNode();
49 this.setPartName(gaei
.getArtifactId());
53 protected void addPages() {
55 bundleDetailsPage
= new BundleDetailsPage(this, "Main", bundleNode
);
56 addPage(bundleDetailsPage
);
57 bundleRawPage
= new BundleRawPage(this, "Raw info", bundleNode
);
58 addPage(bundleRawPage
);
59 } catch (PartInitException e
) {
60 throw new ArgeoException("Not able to add an empty page ", e
);
65 public void doSave(IProgressMonitor monitor
) {
67 // Automatically commit all pages of the editor
69 firePropertyChange(PROP_DIRTY
);
70 } catch (Exception e
) {
71 throw new ArgeoException("Error while saving node", e
);
76 // unused compulsory methods
78 public boolean isSaveAsAllowed() {
83 public void doSaveAs() {