]> git.argeo.org Git - gpl/argeo-slc.git/blob - editors/ModularDistVersionEditor.java
Prepare next development cycle
[gpl/argeo-slc.git] / editors / ModularDistVersionEditor.java
1 package org.argeo.slc.client.ui.dist.editors;
2
3 import javax.jcr.RepositoryException;
4
5 import org.argeo.slc.SlcException;
6 import org.argeo.slc.client.ui.dist.DistPlugin;
7 import org.eclipse.ui.IEditorInput;
8 import org.eclipse.ui.IEditorSite;
9 import org.eclipse.ui.PartInitException;
10
11 /**
12 * Manage a modular distribution version contained in a specific workspace of a
13 * repository
14 */
15 public class ModularDistVersionEditor extends ArtifactVersionEditor {
16 private static final long serialVersionUID = -2223542780164288554L;
17
18 // private final static Log log =
19 // LogFactory.getLog(ModularDistVersionEditor.class);
20 public final static String ID = DistPlugin.PLUGIN_ID + ".modularDistVersionEditor";
21
22 @Override
23 public void init(IEditorSite site, IEditorInput input)
24 throws PartInitException {
25 super.init(site, input);
26 }
27
28 @Override
29 protected void addPages() {
30 setPartName(getFormattedName());
31 try {
32 addPage(new ModularDistVersionOverviewPage(this, "Modules ",
33 getArtifact()));
34 addPage(new RunInOsgiPage(this, "Run as OSGi ", getArtifact()));
35 addPage(new ModularDistVersionDetailPage(this, "Details",
36 getArtifact()));
37 } catch (PartInitException e) {
38 throw new SlcException("Cannot add distribution editor pages", e);
39 }
40 }
41
42 protected String getFormattedName() {
43 try {
44 String partName = null;
45 if (getArtifact().hasProperty(SLC_NAME))
46 partName = getArtifact().getProperty(SLC_NAME).getString();
47 else
48 partName = getArtifact().getName();
49
50 if (partName.length() > 10) {
51 partName = "..." + partName.substring(partName.length() - 10);
52 }
53 return partName;
54 } catch (RepositoryException re) {
55 throw new SlcException("unable to get slc:name property for node "
56 + getArtifact(), re);
57 }
58 }
59
60 }