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
;
30 * Exposes a bundle and enable its management
33 public class GenericBundleEditor
extends FormEditor
{
35 // private final static Log log =
36 // LogFactory.getLog(GenericNodeEditor.class);
37 public final static String ID
= DistPlugin
.ID
+ ".genericBundleEditor";
40 private Node bundleNode
;
42 // This Editor widgets
43 private BundleRawPage bundleRawPage
;
44 private BundleDetailsPage bundleDetailsPage
;
46 public void init(IEditorSite site
, IEditorInput input
)
47 throws PartInitException
{
48 super.init(site
, input
);
49 GenericBundleEditorInput gaei
= (GenericBundleEditorInput
) getEditorInput();
50 bundleNode
= gaei
.getArtifactNode();
51 this.setPartName(gaei
.getArtifactId());
55 protected void addPages() {
57 bundleDetailsPage
= new BundleDetailsPage(this, "Main", bundleNode
);
58 addPage(bundleDetailsPage
);
59 bundleRawPage
= new BundleRawPage(this, "Raw info", bundleNode
);
60 addPage(bundleRawPage
);
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() {