From: Mathieu Baudier Date: Sun, 9 Jan 2011 16:47:23 +0000 (+0000) Subject: Fix OSGi namespace X-Git-Tag: argeo-slc-2.1.7~1051 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;ds=inline;h=2e6f49806478620c9bd79abf04df525d6b27f604;p=gpl%2Fargeo-slc.git Fix OSGi namespace git-svn-id: https://svn.argeo.org/slc/trunk@3999 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.rcp/slc-client-rcp.product b/eclipse/plugins/runtime/org.argeo.slc.client.rcp/slc-client-rcp.product index 2441fa14c..ef7a3a3c2 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.rcp/slc-client-rcp.product +++ b/eclipse/plugins/runtime/org.argeo.slc.client.rcp/slc-client-rcp.product @@ -3,6 +3,7 @@ + @@ -13,6 +14,7 @@ + @@ -20,15 +22,16 @@ + + - @@ -68,7 +71,6 @@ - @@ -121,6 +123,7 @@ + @@ -129,8 +132,10 @@ + + @@ -139,12 +144,10 @@ - + - - @@ -158,11 +161,12 @@ - + + @@ -171,8 +175,8 @@ - - + + @@ -184,7 +188,7 @@ - + @@ -221,6 +225,7 @@ + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ApplicationWorkbenchAdvisor.java b/eclipse/plugins/runtime/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ApplicationWorkbenchAdvisor.java index 8cf2253bf..ae2a6b7d1 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ApplicationWorkbenchAdvisor.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.rcp/src/main/java/org/argeo/slc/client/rcp/ApplicationWorkbenchAdvisor.java @@ -14,6 +14,7 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor; public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { private static final String PERSPECTIVE_ID = "org.argeo.slc.client.ui.perspectives.slcExecution"; +// private static final String PERSPECTIVE_ID = "org.argeo.slc.client.ui.dist.distributionPerspective"; public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( IWorkbenchWindowConfigurer configurer) { diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/META-INF/MANIFEST.MF b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/META-INF/MANIFEST.MF index 736d2ce36..7652771b1 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/META-INF/MANIFEST.MF +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/META-INF/MANIFEST.MF @@ -4,4 +4,8 @@ Bundle-Name: Dist Bundle-SymbolicName: org.argeo.slc.client.ui.dist;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.1" +Require-Bundle: org.eclipse.ui;bundle-version="3.6.1", + org.eclipse.core.runtime;bundle-version="3.6.0" +Bundle-Activator: org.argeo.slc.client.ui.dist.DistPlugin +Import-Package: org.argeo.eclipse.ui +Bundle-ActivationPolicy: lazy diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/plugin.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/plugin.xml index 9933ac1d9..ba72b7992 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/plugin.xml +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/plugin.xml @@ -10,4 +10,13 @@ icon="icons/distribution_perspective.gif"> + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistPlugin.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistPlugin.java new file mode 100644 index 000000000..c651aba21 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistPlugin.java @@ -0,0 +1,18 @@ +package org.argeo.slc.client.ui.dist; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +public class DistPlugin extends AbstractUIPlugin { + private static BundleContext bundleContext; + + @Override + public void start(BundleContext context) throws Exception { + bundleContext = context; + } + + public static BundleContext getBundleContext() { + return bundleContext; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistributionPerspective.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistributionPerspective.java index 55856e84d..c31830a2d 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistributionPerspective.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/DistributionPerspective.java @@ -1,13 +1,20 @@ package org.argeo.slc.client.ui.dist; +import org.eclipse.ui.IFolderLayout; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPerspectiveFactory; -public class DistributionPerspective implements IPerspectiveFactory{ +public class DistributionPerspective implements IPerspectiveFactory { public void createInitialLayout(IPageLayout layout) { - // TODO Auto-generated method stub - + String editorArea = layout.getEditorArea(); + layout.setEditorAreaVisible(false); + layout.setFixed(false); + + IFolderLayout main = layout.createFolder("main", IPageLayout.RIGHT, + 0.3f, editorArea); + main.addView("org.argeo.slc.client.ui.dist.modulesView"); + } } diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/ModulesView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/ModulesView.java new file mode 100644 index 000000000..6d1190414 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/ModulesView.java @@ -0,0 +1,105 @@ +package org.argeo.slc.client.ui.dist.views; + +import java.util.Set; +import java.util.TreeSet; + +import org.argeo.eclipse.ui.TreeParent; +import org.argeo.slc.client.ui.dist.DistPlugin; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.part.ViewPart; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + +public class ModulesView extends ViewPart { + private TreeViewer viewer; + + @Override + public void createPartControl(Composite parent) { + viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + viewer.setContentProvider(new ModulesContentProvider()); + viewer.setLabelProvider(new ModulesLabelProvider()); + viewer.setInput(DistPlugin.getBundleContext()); + } + + @Override + public void setFocus() { + viewer.getTree().setFocus(); + } + + private class ModulesContentProvider implements ITreeContentProvider { + + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof BundleContext) { + BundleContext bundleContext = (BundleContext) parentElement; + Bundle[] bundles = bundleContext.getBundles(); + Set moduleNodes = new TreeSet(); + for (Bundle bundle : bundles) { + if (bundle.getState() == Bundle.ACTIVE) + moduleNodes.add(new ModuleNode(bundle)); + } + return moduleNodes.toArray(); + } else { + return null; + } + } + + public Object getParent(Object element) { + // TODO Auto-generated method stub + return null; + } + + public boolean hasChildren(Object element) { + return false; + } + + public void dispose() { + // TODO Auto-generated method stub + + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + // TODO Auto-generated method stub + + } + + } + + private class ModulesLabelProvider extends LabelProvider implements + ITableLabelProvider { + + public Image getColumnImage(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } + + public String getColumnText(Object element, int columnIndex) { + return getText(element); + } + + } + + private class ModuleNode extends TreeParent { + private final Bundle bundle; + + public ModuleNode(Bundle bundle) { + super(bundle.getSymbolicName()); + this.bundle = bundle; + } + + public Bundle getBundle() { + return bundle; + } + + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml index bf04793a0..917cf66ac 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml @@ -1,6 +1,7 @@