Move to Commons Base
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Jul 2012 12:34:30 +0000 (12:34 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Jul 2012 12:34:30 +0000 (12:34 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@5483 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

36 files changed:
base/plugins/org.argeo.osgi.ui.explorer/.classpath [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/.project [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/build.properties [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/icons/active.gif [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/plugin.xml [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/pom.xml [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerImages.java [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPerspective.java [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPlugin.java [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java [new file with mode: 0644]
base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/ModulesView.java [new file with mode: 0644]
base/plugins/pom.xml [new file with mode: 0644]
osgi/plugins/org.argeo.osgi.ui.explorer/.classpath [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/.project [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/.settings/org.eclipse.jdt.core.prefs [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/build.properties [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/icons/active.gif [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/plugin.xml [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/pom.xml [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerImages.java [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPerspective.java [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPlugin.java [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java [deleted file]
osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/ModulesView.java [deleted file]
osgi/plugins/pom.xml [deleted file]

diff --git a/base/plugins/org.argeo.osgi.ui.explorer/.classpath b/base/plugins/org.argeo.osgi.ui.explorer/.classpath
new file mode 100644 (file)
index 0000000..c5931a0
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>>>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src/main/java"/>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/.project b/base/plugins/org.argeo.osgi.ui.explorer/.project
new file mode 100644 (file)
index 0000000..1a4f4d3
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.osgi.ui.explorer</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/.settings/org.eclipse.jdt.core.prefs b/base/plugins/org.argeo.osgi.ui.explorer/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..9916a22
--- /dev/null
@@ -0,0 +1,8 @@
+#Sun Sep 04 16:04:00 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/build.properties b/base/plugins/org.argeo.osgi.ui.explorer/build.properties
new file mode 100644 (file)
index 0000000..4f799f2
--- /dev/null
@@ -0,0 +1,6 @@
+source.. = src/main/java/
+output.. = target/classes/
+bin.includes = META-INF/,\
+               .,\
+               icons/,\
+               plugin.xml
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/icons/active.gif b/base/plugins/org.argeo.osgi.ui.explorer/icons/active.gif
new file mode 100644 (file)
index 0000000..7d24707
Binary files /dev/null and b/base/plugins/org.argeo.osgi.ui.explorer/icons/active.gif differ
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif b/base/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif
new file mode 100644 (file)
index 0000000..e9a6bd9
Binary files /dev/null and b/base/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif differ
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif b/base/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif
new file mode 100644 (file)
index 0000000..2988716
Binary files /dev/null and b/base/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif differ
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif b/base/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif
new file mode 100644 (file)
index 0000000..e9a6bd9
Binary files /dev/null and b/base/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif differ
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif b/base/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif
new file mode 100644 (file)
index 0000000..f4a1ea1
Binary files /dev/null and b/base/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif differ
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif b/base/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif
new file mode 100644 (file)
index 0000000..563743d
Binary files /dev/null and b/base/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif differ
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/plugin.xml b/base/plugins/org.argeo.osgi.ui.explorer/plugin.xml
new file mode 100644 (file)
index 0000000..848025b
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            name="OSGi Explorer"
+            class="org.argeo.osgi.ui.explorer.OsgiExplorerPerspective"
+            id="org.argeo.osgi.ui.explorer.perspective"
+            icon="icons/osgi_explorer.gif">
+      </perspective>
+   </extension>
+    <extension point="org.eclipse.ui.perspectiveExtensions"> 
+        <perspectiveExtension 
+            targetID="org.argeo.osgi.ui.explorer.perspective"> 
+            <view id="org.argeo.osgi.ui.explorer.bundlesView" minimized="false"
+             ratio="0.5" relationship="left" relative="org.eclipse.ui.editorss"/> 
+            <view id="org.argeo.osgi.ui.explorer.modulesView" minimized="false"
+             relationship="stack" relative="org.argeo.osgi.ui.explorer.bundlesView"/> 
+        </perspectiveExtension> 
+    </extension> 
+   <extension
+         point="org.eclipse.ui.views">
+      <view
+            class="org.argeo.osgi.ui.explorer.views.ModulesView"
+            icon="icons/bundles.gif"
+            id="org.argeo.osgi.ui.explorer.modulesView"
+            name="Modules">
+      </view>
+      <view
+            class="org.argeo.osgi.ui.explorer.views.BundlesView"
+            icon="icons/bundles.gif"
+            id="org.argeo.osgi.ui.explorer.bundlesView"
+            name="Bundles">
+      </view>
+   </extension>
+  <extension
+           point="org.eclipse.ui.activities">
+        <activityPatternBinding
+              activityId="org.argeo.security.ui.adminActivity"
+              isEqualityPattern="true"
+              pattern="org.argeo.osgi.ui.explorer/org.argeo.osgi.ui.explorer.perspective">
+        </activityPatternBinding>
+     </extension>
+</plugin>
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/pom.xml b/base/plugins/org.argeo.osgi.ui.explorer/pom.xml
new file mode 100644 (file)
index 0000000..c418709
--- /dev/null
@@ -0,0 +1,55 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons.osgi</groupId>
+               <version>1.1.4-SNAPSHOT</version>
+               <artifactId>plugins</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.osgi.ui.explorer</artifactId>
+       <name>Commons OSGi Explorer</name>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <configuration>
+                                       <instructions>
+                                               <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
+                                               <Bundle-Activator>org.argeo.osgi.ui.explorer.OsgiExplorerPlugin</Bundle-Activator>
+                                               <Require-Bundle>org.eclipse.ui;resolution:=optional,
+                                                       org.eclipse.rap.ui;resolution:=optional,
+                                                       org.eclipse.core.runtime</Require-Bundle>
+                                               <Export-Package>org.argeo.osgi.ui.explorer.*</Export-Package>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+       <dependencies>
+               <dependency>
+                       <groupId>org.argeo.tp</groupId>
+                       <artifactId>org.eclipse.osgi</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.argeo.commons.eclipse</groupId>
+                       <artifactId>org.argeo.eclipse.ui</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+               </dependency>
+
+               <!-- RCP only dependency, needed at compile time -->
+               <dependency>
+                       <groupId>org.argeo.commons.eclipse</groupId>
+                       <artifactId>org.argeo.eclipse.dep.rcp</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.commons.eclipse</groupId>
+                       <artifactId>org.argeo.eclipse.ui.rcp</artifactId>
+                       <version>1.1.4-SNAPSHOT</version>
+                       <scope>provided</scope>
+               </dependency>
+       </dependencies>
+</project>
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerImages.java b/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerImages.java
new file mode 100644 (file)
index 0000000..8e3fae6
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.osgi.ui.explorer;
+
+import org.eclipse.swt.graphics.Image;
+
+/** Shared icons. */
+public class OsgiExplorerImages {
+       public final static Image INSTALLED = OsgiExplorerPlugin
+                       .getImageDescriptor("icons/installed.gif").createImage();
+       public final static Image RESOLVED = OsgiExplorerPlugin.getImageDescriptor(
+                       "icons/resolved.gif").createImage();
+       public final static Image STARTING = OsgiExplorerPlugin.getImageDescriptor(
+                       "icons/starting.gif").createImage();
+       public final static Image ACTIVE = OsgiExplorerPlugin.getImageDescriptor(
+                       "icons/active.gif").createImage();
+}
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPerspective.java b/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPerspective.java
new file mode 100644 (file)
index 0000000..3b759b1
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.osgi.ui.explorer;
+
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/** OSGi explorer perspective (to be enriched declaratively) */
+public class OsgiExplorerPerspective implements IPerspectiveFactory {
+
+       public void createInitialLayout(IPageLayout layout) {
+               layout.setEditorAreaVisible(true);
+               layout.setFixed(false);
+
+       }
+
+}
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPlugin.java b/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPlugin.java
new file mode 100644 (file)
index 0000000..72bcd0c
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.osgi.ui.explorer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class OsgiExplorerPlugin extends AbstractUIPlugin {
+
+       // The plug-in ID
+       public static final String PLUGIN_ID = "org.argeo.osgi.ui.explorer"; //$NON-NLS-1$
+
+       // The shared instance
+       private static OsgiExplorerPlugin plugin;
+
+       /**
+        * The constructor
+        */
+       public OsgiExplorerPlugin() {
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+        * )
+        */
+       public void start(BundleContext context) throws Exception {
+               super.start(context);
+               plugin = this;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+        * )
+        */
+       public void stop(BundleContext context) throws Exception {
+               plugin = null;
+               super.stop(context);
+       }
+
+       /**
+        * Returns the shared instance
+        * 
+        * @return the shared instance
+        */
+       public static OsgiExplorerPlugin getDefault() {
+               return plugin;
+       }
+
+       public static ImageDescriptor getImageDescriptor(String path) {
+               return imageDescriptorFromPlugin(PLUGIN_ID, path);
+       }
+
+}
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java b/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java
new file mode 100644 (file)
index 0000000..3adb450
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.osgi.ui.explorer.views;
+
+import java.util.Comparator;
+
+import org.argeo.eclipse.ui.ColumnViewerComparator;
+import org.argeo.eclipse.ui.specific.EclipseUiSpecificUtils;
+import org.argeo.osgi.ui.explorer.OsgiExplorerImages;
+import org.argeo.osgi.ui.explorer.OsgiExplorerPlugin;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+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;
+import org.osgi.framework.Constants;
+
+/**
+ * Overview of the bundles as a table. Equivalent to Equinox 'ss' console
+ * command.
+ */
+public class BundlesView extends ViewPart {
+       private TableViewer viewer;
+
+       @Override
+       public void createPartControl(Composite parent) {
+               viewer = new TableViewer(parent);
+               viewer.setContentProvider(new BundleContentProvider());
+               viewer.getTable().setHeaderVisible(true);
+
+               EclipseUiSpecificUtils.enableToolTipSupport(viewer);
+
+               // ID
+               TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+               column.getColumn().setWidth(30);
+               column.getColumn().setText("ID");
+               column.getColumn().setAlignment(SWT.RIGHT);
+               column.setLabelProvider(new ColumnLabelProvider() {
+                       public String getText(Object element) {
+                               return Long.toString(((Bundle) element).getBundleId());
+                       }
+               });
+               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
+                       public int compare(Bundle o1, Bundle o2) {
+                               return (int) (o1.getBundleId() - o2.getBundleId());
+                       }
+               });
+
+               // State
+               column = new TableViewerColumn(viewer, SWT.NONE);
+               column.getColumn().setWidth(18);
+               column.getColumn().setText("State");
+               column.setLabelProvider(new StateLabelProvider());
+               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
+                       public int compare(Bundle o1, Bundle o2) {
+                               return o1.getState() - o2.getState();
+                       }
+               });
+
+               // Symbolic name
+               column = new TableViewerColumn(viewer, SWT.NONE);
+               column.getColumn().setWidth(300);
+               column.getColumn().setText("Symbolic Name");
+               column.setLabelProvider(new ColumnLabelProvider() {
+                       public String getText(Object element) {
+                               return ((Bundle) element).getSymbolicName();
+                       }
+               });
+               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
+                       public int compare(Bundle o1, Bundle o2) {
+                               return o1.getSymbolicName().compareTo(o2.getSymbolicName());
+                       }
+               });
+
+               // Version
+               column = new TableViewerColumn(viewer, SWT.NONE);
+               column.getColumn().setWidth(150);
+               column.getColumn().setText("Version");
+               column.setLabelProvider(new ColumnLabelProvider() {
+                       public String getText(Object element) {
+                               return ((Bundle) element).getVersion().toString();
+                       }
+               });
+               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
+                       public int compare(Bundle o1, Bundle o2) {
+                               return o1.getVersion().compareTo(o2.getVersion());
+                       }
+               });
+
+               viewer.setInput(OsgiExplorerPlugin.getDefault().getBundle()
+                               .getBundleContext());
+
+       }
+
+       @Override
+       public void setFocus() {
+               if (viewer != null)
+                       viewer.getControl().setFocus();
+       }
+
+       /** Content provider managing the array of bundles */
+       private static class BundleContentProvider implements
+                       IStructuredContentProvider {
+               public Object[] getElements(Object inputElement) {
+                       if (inputElement instanceof BundleContext) {
+                               BundleContext bc = (BundleContext) inputElement;
+                               return bc.getBundles();
+                       }
+                       return null;
+               }
+
+               public void dispose() {
+               }
+
+               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+               }
+
+       }
+
+       /** Label provider for the state column */
+       private static class StateLabelProvider extends ColumnLabelProvider {
+               @Override
+               public Image getImage(Object element) {
+                       Integer state = ((Bundle) element).getState();
+                       switch (state) {
+                       case Bundle.UNINSTALLED:
+                               return OsgiExplorerImages.INSTALLED;
+                       case Bundle.INSTALLED:
+                               return OsgiExplorerImages.INSTALLED;
+                       case Bundle.RESOLVED:
+                               return OsgiExplorerImages.RESOLVED;
+                       case Bundle.STARTING:
+                               return OsgiExplorerImages.STARTING;
+                       case Bundle.STOPPING:
+                               return OsgiExplorerImages.STARTING;
+                       case Bundle.ACTIVE:
+                               return OsgiExplorerImages.ACTIVE;
+                       default:
+                               return null;
+                       }
+               }
+
+               @Override
+               public String getText(Object element) {
+                       return null;
+               }
+
+               @Override
+               public String getToolTipText(Object element) {
+                       Bundle bundle = (Bundle) element;
+                       Integer state = bundle.getState();
+                       switch (state) {
+                       case Bundle.UNINSTALLED:
+                               return "UNINSTALLED";
+                       case Bundle.INSTALLED:
+                               return "INSTALLED";
+                       case Bundle.RESOLVED:
+                               return "RESOLVED";
+                       case Bundle.STARTING:
+                               String activationPolicy = bundle.getHeaders()
+                                               .get(Constants.BUNDLE_ACTIVATIONPOLICY).toString();
+                               if (activationPolicy != null
+                                               && activationPolicy.equals(Constants.ACTIVATION_LAZY))
+                                       return "<<LAZY>>";
+                               return "STARTING";
+                       case Bundle.STOPPING:
+                               return "STOPPING";
+                       case Bundle.ACTIVE:
+                               return "ACTIVE";
+                       default:
+                               return null;
+                       }
+               }
+
+       }
+}
diff --git a/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/ModulesView.java b/base/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/ModulesView.java
new file mode 100644 (file)
index 0000000..ba7d816
--- /dev/null
@@ -0,0 +1,379 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.argeo.osgi.ui.explorer.views;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.eclipse.ui.TreeParent;
+import org.argeo.osgi.ui.explorer.OsgiExplorerPlugin;
+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;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/** <b>Experimental</b> The OSGi runtime from a module perspective. */
+public class ModulesView extends ViewPart {
+       private final static Log log = LogFactory.getLog(ModulesView.class);
+
+       private TreeViewer viewer;
+
+       private PackageAdmin packageAdmin;
+
+       private Comparator<ExportedPackage> exportedPackageComparator = new Comparator<ExportedPackage>() {
+
+               public int compare(ExportedPackage o1, ExportedPackage o2) {
+                       if (!o1.getName().equals(o2.getName()))
+                               return o1.getName().compareTo(o2.getName());
+                       else
+                               return o1.getVersion().compareTo(o2.getVersion());
+               }
+       };
+
+       @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(OsgiExplorerPlugin.getDefault().getBundle()
+                               .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();
+
+                               TreeParent bundlesNode = new TreeParent("Bundles");
+                               for (Bundle bundle : bundles) {
+                                       if (bundle.getState() == Bundle.ACTIVE)
+                                               bundlesNode.addChild(new BundleNode(bundle));
+                               }
+
+                               // scan packages
+                               ServiceReference paSr = bundleContext
+                                               .getServiceReference(PackageAdmin.class.getName());
+                               // TODO: make a cleaner referencing
+                               packageAdmin = (PackageAdmin) bundleContext.getService(paSr);
+
+                               Bundle bundle1 = null;
+                               Bundle bundle2 = null;
+
+                               Map<Bundle, Set<ExportedPackage>> importedPackages = new HashMap<Bundle, Set<ExportedPackage>>();
+                               Map<String, Set<ExportedPackage>> packages = new TreeMap<String, Set<ExportedPackage>>();
+                               for (Bundle bundle : bundles) {
+                                       if (bundle.getSymbolicName()
+                                                       .equals("org.argeo.security.ui"))
+                                               bundle1 = bundle;
+                                       if (bundle.getSymbolicName().equals(
+                                                       "org.argeo.security.equinox"))
+                                               bundle2 = bundle;
+
+                                       ExportedPackage[] pkgs = packageAdmin
+                                                       .getExportedPackages(bundle);
+                                       if (pkgs != null)
+                                               for (ExportedPackage pkg : pkgs) {
+                                                       if (!packages.containsKey(pkg.getName()))
+                                                               packages.put(pkg.getName(),
+                                                                               new TreeSet<ExportedPackage>(
+                                                                                               exportedPackageComparator));
+                                                       Set<ExportedPackage> expPackages = (Set<ExportedPackage>) packages
+                                                                       .get(pkg.getName());
+                                                       expPackages.add(pkg);
+
+                                                       // imported
+                                                       for (Bundle b : pkg.getImportingBundles()) {
+                                                               if (bundle.getBundleId() != b.getBundleId()) {
+                                                                       if (!importedPackages.containsKey(b))
+                                                                               importedPackages
+                                                                                               .put(b,
+                                                                                                               new TreeSet<ExportedPackage>(
+                                                                                                                               exportedPackageComparator));
+                                                                       Set<ExportedPackage> impPackages = (Set<ExportedPackage>) importedPackages
+                                                                                       .get(b);
+                                                                       impPackages.add(pkg);
+                                                               }
+                                                       }
+                                               }
+                               }
+
+                               TreeParent mPackageNode = new TreeParent("Multiple Packages");
+                               // TreeParent aPackageNode = new TreeParent("All Packages");
+                               for (String packageName : packages.keySet()) {
+                                       Set<ExportedPackage> pkgs = packages.get(packageName);
+                                       if (pkgs.size() > 1) {
+                                               MultiplePackagesNode mpn = new MultiplePackagesNode(
+                                                               packageName, pkgs);
+                                               mPackageNode.addChild(mpn);
+                                               // aPackageNode.addChild(mpn);
+                                       } else {
+                                               // aPackageNode.addChild(new ExportedPackageNode(pkgs
+                                               // .iterator().next()));
+                                       }
+                               }
+
+                               return new Object[] { bundlesNode, mPackageNode };// ,
+                                                                                                                                       // aPackageNode
+                                                                                                                                       // };
+                       } else if (parentElement instanceof TreeParent) {
+                               return ((TreeParent) parentElement).getChildren();
+                       } else {
+                               return null;
+                       }
+               }
+
+               public Object getParent(Object element) {
+                       // TODO Auto-generated method stub
+                       return null;
+               }
+
+               public boolean hasChildren(Object element) {
+                       if (element instanceof TreeParent) {
+                               return ((TreeParent) element).hasChildren();
+                       }
+                       return false;
+               }
+
+               public void dispose() {
+                       // TODO Auto-generated method stub
+
+               }
+
+               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+                       // TODO Auto-generated method stub
+
+               }
+
+       }
+
+       protected Map<String, ExportedPackage> dependencySpace(Bundle bundle,
+                       Map<Bundle, Set<ExportedPackage>> importedPackages,
+                       Map<String, Set<String>> traces) {
+               log.debug("Dependency space for " + bundle.getSymbolicName());
+               Map<String, ExportedPackage> space = new TreeMap<String, ExportedPackage>();
+               fillDependencySpace(space, bundle, importedPackages,
+                               bundle.getSymbolicName(), traces);
+               return space;
+       }
+
+       /** Recursive */
+       protected void fillDependencySpace(Map<String, ExportedPackage> space,
+                       Bundle bundle, Map<Bundle, Set<ExportedPackage>> importedPackages,
+                       String currTrace, Map<String, Set<String>> traces) {
+               if (importedPackages.containsKey(bundle)) {
+                       Set<ExportedPackage> imports = importedPackages.get(bundle);
+                       // log.debug("## Fill dependency space for " + bundle + " : ");
+                       for (ExportedPackage pkg : imports) {
+                               if (!traces.containsKey(pkg.getName()))
+                                       traces.put(pkg.getName(), new TreeSet<String>());
+                               traces.get(pkg.getName()).add(currTrace);
+                               if (!space.containsKey(pkg.getName())) {
+                                       space.put(pkg.getName(), pkg);
+                                       Bundle exportingBundle = pkg.getExportingBundle();
+                                       // if (bundle.getBundleId() !=
+                                       // exportingBundle.getBundleId())
+                                       fillDependencySpace(space, exportingBundle,
+                                                       importedPackages, currTrace + " > "
+                                                                       + exportingBundle.getSymbolicName(), traces);
+                               }
+                       }
+               }
+       }
+
+       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);
+               }
+
+       }
+
+       class BundleNode extends TreeParent {
+               private final Bundle bundle;
+
+               public BundleNode(Bundle bundle) {
+                       super(bundle.getSymbolicName());
+                       this.bundle = bundle;
+
+                       // Registered services
+                       ServiceReference[] registeredServices = bundle
+                                       .getRegisteredServices();
+                       if (registeredServices != null) {
+                               TreeParent registeredServicesNode = new TreeParent(
+                                               "Registered Services");
+                               addChild(registeredServicesNode);
+                               for (ServiceReference sr : registeredServices) {
+                                       if (sr != null)
+                                               registeredServicesNode
+                                                               .addChild(new ServiceReferenceNode(sr));
+                               }
+                       }
+
+                       // Used services
+                       ServiceReference[] usedServices = bundle.getRegisteredServices();
+                       if (usedServices != null) {
+                               TreeParent usedServicesNode = new TreeParent("Used Services");
+                               addChild(usedServicesNode);
+                               for (ServiceReference sr : usedServices) {
+                                       if (sr != null)
+                                               usedServicesNode.addChild(new ServiceReferenceNode(sr));
+                               }
+                       }
+               }
+
+               public Bundle getBundle() {
+                       return bundle;
+               }
+
+       }
+
+       class ServiceReferenceNode extends TreeParent {
+               private final ServiceReference serviceReference;
+
+               public ServiceReferenceNode(ServiceReference serviceReference) {
+                       super(serviceReference.toString());
+                       this.serviceReference = serviceReference;
+
+                       Bundle[] usedBundles = serviceReference.getUsingBundles();
+                       if (usedBundles != null) {
+                               TreeParent usingBundles = new TreeParent("Using Bundles");
+                               addChild(usingBundles);
+                               for (Bundle b : usedBundles) {
+                                       if (b != null)
+                                               usingBundles.addChild(new TreeParent(b
+                                                               .getSymbolicName()));
+                               }
+                       }
+
+                       TreeParent properties = new TreeParent("Properties");
+                       addChild(properties);
+                       for (String key : serviceReference.getPropertyKeys()) {
+                               properties.addChild(new TreeParent(key + "="
+                                               + serviceReference.getProperty(key)));
+                       }
+
+               }
+
+               public ServiceReference getServiceReference() {
+                       return serviceReference;
+               }
+
+       }
+
+       class MultiplePackagesNode extends TreeParent {
+               private String packageName;
+               private Set<ExportedPackage> exportedPackages;
+
+               public MultiplePackagesNode(String packageName,
+                               Set<ExportedPackage> exportedPackages) {
+                       super(packageName);
+                       this.packageName = packageName;
+                       this.exportedPackages = exportedPackages;
+                       for (ExportedPackage pkg : exportedPackages) {
+                               addChild(new ExportedPackageNode(pkg));
+                       }
+               }
+
+       }
+
+       class ConflictingPackageNode extends TreeParent {
+               private ExportedPackage exportedPackage;
+
+               public ConflictingPackageNode(ExportedPackage exportedPackage) {
+                       super(exportedPackage.getName() + " - "
+                                       + exportedPackage.getVersion() + " ("
+                                       + exportedPackage.getExportingBundle() + ")");
+                       this.exportedPackage = exportedPackage;
+
+                       TreeParent bundlesNode = new TreeParent("Dependent Bundles");
+                       this.addChild(bundlesNode);
+                       Map<String, Bundle> bundles = new TreeMap<String, Bundle>();
+                       for (Bundle b : exportedPackage.getImportingBundles()) {
+                               bundles.put(b.getSymbolicName(), b);
+                       }
+                       for (String key : bundles.keySet()) {
+                               addDependentBundles(bundlesNode, bundles.get(key));
+                       }
+               }
+       }
+
+       protected void addDependentBundles(TreeParent parent, Bundle bundle) {
+               TreeParent bundleNode = new TreeParent(bundle.toString());
+               parent.addChild(bundleNode);
+               Map<String, Bundle> bundles = new TreeMap<String, Bundle>();
+               ExportedPackage[] pkgs = packageAdmin.getExportedPackages(bundle);
+               if (pkgs != null)
+                       for (ExportedPackage pkg : pkgs) {
+                               for (Bundle b : pkg.getImportingBundles()) {
+                                       if (!bundles.containsKey(b.getSymbolicName())
+                                                       && b.getBundleId() != bundle.getBundleId()) {
+                                               bundles.put(b.getSymbolicName(), b);
+                                       }
+                               }
+                       }
+
+               for (String key : bundles.keySet()) {
+                       addDependentBundles(bundleNode, bundles.get(key));
+               }
+       }
+
+       class ExportedPackageNode extends TreeParent {
+               private ExportedPackage exportedPackage;
+
+               public ExportedPackageNode(ExportedPackage exportedPackage) {
+                       super(exportedPackage.getName() + " - "
+                                       + exportedPackage.getVersion() + " ("
+                                       + exportedPackage.getExportingBundle() + ")");
+                       this.exportedPackage = exportedPackage;
+                       for (Bundle bundle : exportedPackage.getImportingBundles()) {
+                               addChild(new BundleNode(bundle));
+                       }
+               }
+       }
+}
diff --git a/base/plugins/pom.xml b/base/plugins/pom.xml
new file mode 100644 (file)
index 0000000..01d9d0a
--- /dev/null
@@ -0,0 +1,57 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <version>1.1.4-SNAPSHOT</version>
+               <artifactId>osgi</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <groupId>org.argeo.commons.osgi</groupId>
+       <artifactId>plugins</artifactId>
+       <name>Commons OSGi Eclipse Plugins</name>
+       <packaging>pom</packaging>
+       <modules>
+               <module>org.argeo.osgi.ui.explorer</module>
+       </modules>
+       <build>
+               <resources>
+                       <resource>
+                               <directory>src/main/resources</directory>
+                       </resource>
+                       <resource>
+                               <directory>.</directory>
+                               <includes>
+                                       <include>plugin.xml</include>
+                                       <include>META-INF/**</include>
+                                       <include>icons/**</include>
+                               </includes>
+                       </resource>
+               </resources>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-source-plugin</artifactId>
+                               <configuration>
+                                       <!-- Prevents source jars to contain misleading data -->
+                                       <excludes>
+                                               <exclude>plugin.xml</exclude>
+                                               <exclude>META-INF/MANIFEST.MF</exclude>
+                                       </excludes>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <configuration>
+                                       <instructions>
+                                               <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/.classpath b/osgi/plugins/org.argeo.osgi.ui.explorer/.classpath
deleted file mode 100644 (file)
index c5931a0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>>>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="src" path="src/main/java"/>
-       <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/.project b/osgi/plugins/org.argeo.osgi.ui.explorer/.project
deleted file mode 100644 (file)
index 1a4f4d3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.argeo.osgi.ui.explorer</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.ManifestBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.SchemaBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.pde.PluginNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/.settings/org.eclipse.jdt.core.prefs b/osgi/plugins/org.argeo.osgi.ui.explorer/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 9916a22..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#Sun Sep 04 16:04:00 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/build.properties b/osgi/plugins/org.argeo.osgi.ui.explorer/build.properties
deleted file mode 100644 (file)
index 4f799f2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-source.. = src/main/java/
-output.. = target/classes/
-bin.includes = META-INF/,\
-               .,\
-               icons/,\
-               plugin.xml
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/active.gif b/osgi/plugins/org.argeo.osgi.ui.explorer/icons/active.gif
deleted file mode 100644 (file)
index 7d24707..0000000
Binary files a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/active.gif and /dev/null differ
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif b/osgi/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif
deleted file mode 100644 (file)
index e9a6bd9..0000000
Binary files a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/bundles.gif and /dev/null differ
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif b/osgi/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif
deleted file mode 100644 (file)
index 2988716..0000000
Binary files a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/installed.gif and /dev/null differ
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif b/osgi/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif
deleted file mode 100644 (file)
index e9a6bd9..0000000
Binary files a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/osgi_explorer.gif and /dev/null differ
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif b/osgi/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif
deleted file mode 100644 (file)
index f4a1ea1..0000000
Binary files a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/resolved.gif and /dev/null differ
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif b/osgi/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif
deleted file mode 100644 (file)
index 563743d..0000000
Binary files a/osgi/plugins/org.argeo.osgi.ui.explorer/icons/starting.gif and /dev/null differ
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/plugin.xml b/osgi/plugins/org.argeo.osgi.ui.explorer/plugin.xml
deleted file mode 100644 (file)
index 848025b..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-   <extension
-         point="org.eclipse.ui.perspectives">
-      <perspective
-            name="OSGi Explorer"
-            class="org.argeo.osgi.ui.explorer.OsgiExplorerPerspective"
-            id="org.argeo.osgi.ui.explorer.perspective"
-            icon="icons/osgi_explorer.gif">
-      </perspective>
-   </extension>
-    <extension point="org.eclipse.ui.perspectiveExtensions"> 
-        <perspectiveExtension 
-            targetID="org.argeo.osgi.ui.explorer.perspective"> 
-            <view id="org.argeo.osgi.ui.explorer.bundlesView" minimized="false"
-             ratio="0.5" relationship="left" relative="org.eclipse.ui.editorss"/> 
-            <view id="org.argeo.osgi.ui.explorer.modulesView" minimized="false"
-             relationship="stack" relative="org.argeo.osgi.ui.explorer.bundlesView"/> 
-        </perspectiveExtension> 
-    </extension> 
-   <extension
-         point="org.eclipse.ui.views">
-      <view
-            class="org.argeo.osgi.ui.explorer.views.ModulesView"
-            icon="icons/bundles.gif"
-            id="org.argeo.osgi.ui.explorer.modulesView"
-            name="Modules">
-      </view>
-      <view
-            class="org.argeo.osgi.ui.explorer.views.BundlesView"
-            icon="icons/bundles.gif"
-            id="org.argeo.osgi.ui.explorer.bundlesView"
-            name="Bundles">
-      </view>
-   </extension>
-  <extension
-           point="org.eclipse.ui.activities">
-        <activityPatternBinding
-              activityId="org.argeo.security.ui.adminActivity"
-              isEqualityPattern="true"
-              pattern="org.argeo.osgi.ui.explorer/org.argeo.osgi.ui.explorer.perspective">
-        </activityPatternBinding>
-     </extension>
-</plugin>
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/pom.xml b/osgi/plugins/org.argeo.osgi.ui.explorer/pom.xml
deleted file mode 100644 (file)
index c418709..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons.osgi</groupId>
-               <version>1.1.4-SNAPSHOT</version>
-               <artifactId>plugins</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.osgi.ui.explorer</artifactId>
-       <name>Commons OSGi Explorer</name>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
-                                               <Bundle-Activator>org.argeo.osgi.ui.explorer.OsgiExplorerPlugin</Bundle-Activator>
-                                               <Require-Bundle>org.eclipse.ui;resolution:=optional,
-                                                       org.eclipse.rap.ui;resolution:=optional,
-                                                       org.eclipse.core.runtime</Require-Bundle>
-                                               <Export-Package>org.argeo.osgi.ui.explorer.*</Export-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.eclipse.osgi</artifactId>
-               </dependency>
-
-               <dependency>
-                       <groupId>org.argeo.commons.eclipse</groupId>
-                       <artifactId>org.argeo.eclipse.ui</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-               </dependency>
-
-               <!-- RCP only dependency, needed at compile time -->
-               <dependency>
-                       <groupId>org.argeo.commons.eclipse</groupId>
-                       <artifactId>org.argeo.eclipse.dep.rcp</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-                       <scope>provided</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.eclipse</groupId>
-                       <artifactId>org.argeo.eclipse.ui.rcp</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-                       <scope>provided</scope>
-               </dependency>
-       </dependencies>
-</project>
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerImages.java b/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerImages.java
deleted file mode 100644 (file)
index 8e3fae6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.osgi.ui.explorer;
-
-import org.eclipse.swt.graphics.Image;
-
-/** Shared icons. */
-public class OsgiExplorerImages {
-       public final static Image INSTALLED = OsgiExplorerPlugin
-                       .getImageDescriptor("icons/installed.gif").createImage();
-       public final static Image RESOLVED = OsgiExplorerPlugin.getImageDescriptor(
-                       "icons/resolved.gif").createImage();
-       public final static Image STARTING = OsgiExplorerPlugin.getImageDescriptor(
-                       "icons/starting.gif").createImage();
-       public final static Image ACTIVE = OsgiExplorerPlugin.getImageDescriptor(
-                       "icons/active.gif").createImage();
-}
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPerspective.java b/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPerspective.java
deleted file mode 100644 (file)
index 3b759b1..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.osgi.ui.explorer;
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-/** OSGi explorer perspective (to be enriched declaratively) */
-public class OsgiExplorerPerspective implements IPerspectiveFactory {
-
-       public void createInitialLayout(IPageLayout layout) {
-               layout.setEditorAreaVisible(true);
-               layout.setFixed(false);
-
-       }
-
-}
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPlugin.java b/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/OsgiExplorerPlugin.java
deleted file mode 100644 (file)
index 72bcd0c..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.osgi.ui.explorer;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class OsgiExplorerPlugin extends AbstractUIPlugin {
-
-       // The plug-in ID
-       public static final String PLUGIN_ID = "org.argeo.osgi.ui.explorer"; //$NON-NLS-1$
-
-       // The shared instance
-       private static OsgiExplorerPlugin plugin;
-
-       /**
-        * The constructor
-        */
-       public OsgiExplorerPlugin() {
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
-        * )
-        */
-       public void start(BundleContext context) throws Exception {
-               super.start(context);
-               plugin = this;
-       }
-
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
-        * )
-        */
-       public void stop(BundleContext context) throws Exception {
-               plugin = null;
-               super.stop(context);
-       }
-
-       /**
-        * Returns the shared instance
-        * 
-        * @return the shared instance
-        */
-       public static OsgiExplorerPlugin getDefault() {
-               return plugin;
-       }
-
-       public static ImageDescriptor getImageDescriptor(String path) {
-               return imageDescriptorFromPlugin(PLUGIN_ID, path);
-       }
-
-}
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java b/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/BundlesView.java
deleted file mode 100644 (file)
index 3adb450..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.osgi.ui.explorer.views;
-
-import java.util.Comparator;
-
-import org.argeo.eclipse.ui.ColumnViewerComparator;
-import org.argeo.eclipse.ui.specific.EclipseUiSpecificUtils;
-import org.argeo.osgi.ui.explorer.OsgiExplorerImages;
-import org.argeo.osgi.ui.explorer.OsgiExplorerPlugin;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-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;
-import org.osgi.framework.Constants;
-
-/**
- * Overview of the bundles as a table. Equivalent to Equinox 'ss' console
- * command.
- */
-public class BundlesView extends ViewPart {
-       private TableViewer viewer;
-
-       @Override
-       public void createPartControl(Composite parent) {
-               viewer = new TableViewer(parent);
-               viewer.setContentProvider(new BundleContentProvider());
-               viewer.getTable().setHeaderVisible(true);
-
-               EclipseUiSpecificUtils.enableToolTipSupport(viewer);
-
-               // ID
-               TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
-               column.getColumn().setWidth(30);
-               column.getColumn().setText("ID");
-               column.getColumn().setAlignment(SWT.RIGHT);
-               column.setLabelProvider(new ColumnLabelProvider() {
-                       public String getText(Object element) {
-                               return Long.toString(((Bundle) element).getBundleId());
-                       }
-               });
-               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
-                       public int compare(Bundle o1, Bundle o2) {
-                               return (int) (o1.getBundleId() - o2.getBundleId());
-                       }
-               });
-
-               // State
-               column = new TableViewerColumn(viewer, SWT.NONE);
-               column.getColumn().setWidth(18);
-               column.getColumn().setText("State");
-               column.setLabelProvider(new StateLabelProvider());
-               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
-                       public int compare(Bundle o1, Bundle o2) {
-                               return o1.getState() - o2.getState();
-                       }
-               });
-
-               // Symbolic name
-               column = new TableViewerColumn(viewer, SWT.NONE);
-               column.getColumn().setWidth(300);
-               column.getColumn().setText("Symbolic Name");
-               column.setLabelProvider(new ColumnLabelProvider() {
-                       public String getText(Object element) {
-                               return ((Bundle) element).getSymbolicName();
-                       }
-               });
-               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
-                       public int compare(Bundle o1, Bundle o2) {
-                               return o1.getSymbolicName().compareTo(o2.getSymbolicName());
-                       }
-               });
-
-               // Version
-               column = new TableViewerColumn(viewer, SWT.NONE);
-               column.getColumn().setWidth(150);
-               column.getColumn().setText("Version");
-               column.setLabelProvider(new ColumnLabelProvider() {
-                       public String getText(Object element) {
-                               return ((Bundle) element).getVersion().toString();
-                       }
-               });
-               new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
-                       public int compare(Bundle o1, Bundle o2) {
-                               return o1.getVersion().compareTo(o2.getVersion());
-                       }
-               });
-
-               viewer.setInput(OsgiExplorerPlugin.getDefault().getBundle()
-                               .getBundleContext());
-
-       }
-
-       @Override
-       public void setFocus() {
-               if (viewer != null)
-                       viewer.getControl().setFocus();
-       }
-
-       /** Content provider managing the array of bundles */
-       private static class BundleContentProvider implements
-                       IStructuredContentProvider {
-               public Object[] getElements(Object inputElement) {
-                       if (inputElement instanceof BundleContext) {
-                               BundleContext bc = (BundleContext) inputElement;
-                               return bc.getBundles();
-                       }
-                       return null;
-               }
-
-               public void dispose() {
-               }
-
-               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-               }
-
-       }
-
-       /** Label provider for the state column */
-       private static class StateLabelProvider extends ColumnLabelProvider {
-               @Override
-               public Image getImage(Object element) {
-                       Integer state = ((Bundle) element).getState();
-                       switch (state) {
-                       case Bundle.UNINSTALLED:
-                               return OsgiExplorerImages.INSTALLED;
-                       case Bundle.INSTALLED:
-                               return OsgiExplorerImages.INSTALLED;
-                       case Bundle.RESOLVED:
-                               return OsgiExplorerImages.RESOLVED;
-                       case Bundle.STARTING:
-                               return OsgiExplorerImages.STARTING;
-                       case Bundle.STOPPING:
-                               return OsgiExplorerImages.STARTING;
-                       case Bundle.ACTIVE:
-                               return OsgiExplorerImages.ACTIVE;
-                       default:
-                               return null;
-                       }
-               }
-
-               @Override
-               public String getText(Object element) {
-                       return null;
-               }
-
-               @Override
-               public String getToolTipText(Object element) {
-                       Bundle bundle = (Bundle) element;
-                       Integer state = bundle.getState();
-                       switch (state) {
-                       case Bundle.UNINSTALLED:
-                               return "UNINSTALLED";
-                       case Bundle.INSTALLED:
-                               return "INSTALLED";
-                       case Bundle.RESOLVED:
-                               return "RESOLVED";
-                       case Bundle.STARTING:
-                               String activationPolicy = bundle.getHeaders()
-                                               .get(Constants.BUNDLE_ACTIVATIONPOLICY).toString();
-                               if (activationPolicy != null
-                                               && activationPolicy.equals(Constants.ACTIVATION_LAZY))
-                                       return "<<LAZY>>";
-                               return "STARTING";
-                       case Bundle.STOPPING:
-                               return "STOPPING";
-                       case Bundle.ACTIVE:
-                               return "ACTIVE";
-                       default:
-                               return null;
-                       }
-               }
-
-       }
-}
diff --git a/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/ModulesView.java b/osgi/plugins/org.argeo.osgi.ui.explorer/src/main/java/org/argeo/osgi/ui/explorer/views/ModulesView.java
deleted file mode 100644 (file)
index ba7d816..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.osgi.ui.explorer.views;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.eclipse.ui.TreeParent;
-import org.argeo.osgi.ui.explorer.OsgiExplorerPlugin;
-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;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/** <b>Experimental</b> The OSGi runtime from a module perspective. */
-public class ModulesView extends ViewPart {
-       private final static Log log = LogFactory.getLog(ModulesView.class);
-
-       private TreeViewer viewer;
-
-       private PackageAdmin packageAdmin;
-
-       private Comparator<ExportedPackage> exportedPackageComparator = new Comparator<ExportedPackage>() {
-
-               public int compare(ExportedPackage o1, ExportedPackage o2) {
-                       if (!o1.getName().equals(o2.getName()))
-                               return o1.getName().compareTo(o2.getName());
-                       else
-                               return o1.getVersion().compareTo(o2.getVersion());
-               }
-       };
-
-       @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(OsgiExplorerPlugin.getDefault().getBundle()
-                               .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();
-
-                               TreeParent bundlesNode = new TreeParent("Bundles");
-                               for (Bundle bundle : bundles) {
-                                       if (bundle.getState() == Bundle.ACTIVE)
-                                               bundlesNode.addChild(new BundleNode(bundle));
-                               }
-
-                               // scan packages
-                               ServiceReference paSr = bundleContext
-                                               .getServiceReference(PackageAdmin.class.getName());
-                               // TODO: make a cleaner referencing
-                               packageAdmin = (PackageAdmin) bundleContext.getService(paSr);
-
-                               Bundle bundle1 = null;
-                               Bundle bundle2 = null;
-
-                               Map<Bundle, Set<ExportedPackage>> importedPackages = new HashMap<Bundle, Set<ExportedPackage>>();
-                               Map<String, Set<ExportedPackage>> packages = new TreeMap<String, Set<ExportedPackage>>();
-                               for (Bundle bundle : bundles) {
-                                       if (bundle.getSymbolicName()
-                                                       .equals("org.argeo.security.ui"))
-                                               bundle1 = bundle;
-                                       if (bundle.getSymbolicName().equals(
-                                                       "org.argeo.security.equinox"))
-                                               bundle2 = bundle;
-
-                                       ExportedPackage[] pkgs = packageAdmin
-                                                       .getExportedPackages(bundle);
-                                       if (pkgs != null)
-                                               for (ExportedPackage pkg : pkgs) {
-                                                       if (!packages.containsKey(pkg.getName()))
-                                                               packages.put(pkg.getName(),
-                                                                               new TreeSet<ExportedPackage>(
-                                                                                               exportedPackageComparator));
-                                                       Set<ExportedPackage> expPackages = (Set<ExportedPackage>) packages
-                                                                       .get(pkg.getName());
-                                                       expPackages.add(pkg);
-
-                                                       // imported
-                                                       for (Bundle b : pkg.getImportingBundles()) {
-                                                               if (bundle.getBundleId() != b.getBundleId()) {
-                                                                       if (!importedPackages.containsKey(b))
-                                                                               importedPackages
-                                                                                               .put(b,
-                                                                                                               new TreeSet<ExportedPackage>(
-                                                                                                                               exportedPackageComparator));
-                                                                       Set<ExportedPackage> impPackages = (Set<ExportedPackage>) importedPackages
-                                                                                       .get(b);
-                                                                       impPackages.add(pkg);
-                                                               }
-                                                       }
-                                               }
-                               }
-
-                               TreeParent mPackageNode = new TreeParent("Multiple Packages");
-                               // TreeParent aPackageNode = new TreeParent("All Packages");
-                               for (String packageName : packages.keySet()) {
-                                       Set<ExportedPackage> pkgs = packages.get(packageName);
-                                       if (pkgs.size() > 1) {
-                                               MultiplePackagesNode mpn = new MultiplePackagesNode(
-                                                               packageName, pkgs);
-                                               mPackageNode.addChild(mpn);
-                                               // aPackageNode.addChild(mpn);
-                                       } else {
-                                               // aPackageNode.addChild(new ExportedPackageNode(pkgs
-                                               // .iterator().next()));
-                                       }
-                               }
-
-                               return new Object[] { bundlesNode, mPackageNode };// ,
-                                                                                                                                       // aPackageNode
-                                                                                                                                       // };
-                       } else if (parentElement instanceof TreeParent) {
-                               return ((TreeParent) parentElement).getChildren();
-                       } else {
-                               return null;
-                       }
-               }
-
-               public Object getParent(Object element) {
-                       // TODO Auto-generated method stub
-                       return null;
-               }
-
-               public boolean hasChildren(Object element) {
-                       if (element instanceof TreeParent) {
-                               return ((TreeParent) element).hasChildren();
-                       }
-                       return false;
-               }
-
-               public void dispose() {
-                       // TODO Auto-generated method stub
-
-               }
-
-               public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-                       // TODO Auto-generated method stub
-
-               }
-
-       }
-
-       protected Map<String, ExportedPackage> dependencySpace(Bundle bundle,
-                       Map<Bundle, Set<ExportedPackage>> importedPackages,
-                       Map<String, Set<String>> traces) {
-               log.debug("Dependency space for " + bundle.getSymbolicName());
-               Map<String, ExportedPackage> space = new TreeMap<String, ExportedPackage>();
-               fillDependencySpace(space, bundle, importedPackages,
-                               bundle.getSymbolicName(), traces);
-               return space;
-       }
-
-       /** Recursive */
-       protected void fillDependencySpace(Map<String, ExportedPackage> space,
-                       Bundle bundle, Map<Bundle, Set<ExportedPackage>> importedPackages,
-                       String currTrace, Map<String, Set<String>> traces) {
-               if (importedPackages.containsKey(bundle)) {
-                       Set<ExportedPackage> imports = importedPackages.get(bundle);
-                       // log.debug("## Fill dependency space for " + bundle + " : ");
-                       for (ExportedPackage pkg : imports) {
-                               if (!traces.containsKey(pkg.getName()))
-                                       traces.put(pkg.getName(), new TreeSet<String>());
-                               traces.get(pkg.getName()).add(currTrace);
-                               if (!space.containsKey(pkg.getName())) {
-                                       space.put(pkg.getName(), pkg);
-                                       Bundle exportingBundle = pkg.getExportingBundle();
-                                       // if (bundle.getBundleId() !=
-                                       // exportingBundle.getBundleId())
-                                       fillDependencySpace(space, exportingBundle,
-                                                       importedPackages, currTrace + " > "
-                                                                       + exportingBundle.getSymbolicName(), traces);
-                               }
-                       }
-               }
-       }
-
-       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);
-               }
-
-       }
-
-       class BundleNode extends TreeParent {
-               private final Bundle bundle;
-
-               public BundleNode(Bundle bundle) {
-                       super(bundle.getSymbolicName());
-                       this.bundle = bundle;
-
-                       // Registered services
-                       ServiceReference[] registeredServices = bundle
-                                       .getRegisteredServices();
-                       if (registeredServices != null) {
-                               TreeParent registeredServicesNode = new TreeParent(
-                                               "Registered Services");
-                               addChild(registeredServicesNode);
-                               for (ServiceReference sr : registeredServices) {
-                                       if (sr != null)
-                                               registeredServicesNode
-                                                               .addChild(new ServiceReferenceNode(sr));
-                               }
-                       }
-
-                       // Used services
-                       ServiceReference[] usedServices = bundle.getRegisteredServices();
-                       if (usedServices != null) {
-                               TreeParent usedServicesNode = new TreeParent("Used Services");
-                               addChild(usedServicesNode);
-                               for (ServiceReference sr : usedServices) {
-                                       if (sr != null)
-                                               usedServicesNode.addChild(new ServiceReferenceNode(sr));
-                               }
-                       }
-               }
-
-               public Bundle getBundle() {
-                       return bundle;
-               }
-
-       }
-
-       class ServiceReferenceNode extends TreeParent {
-               private final ServiceReference serviceReference;
-
-               public ServiceReferenceNode(ServiceReference serviceReference) {
-                       super(serviceReference.toString());
-                       this.serviceReference = serviceReference;
-
-                       Bundle[] usedBundles = serviceReference.getUsingBundles();
-                       if (usedBundles != null) {
-                               TreeParent usingBundles = new TreeParent("Using Bundles");
-                               addChild(usingBundles);
-                               for (Bundle b : usedBundles) {
-                                       if (b != null)
-                                               usingBundles.addChild(new TreeParent(b
-                                                               .getSymbolicName()));
-                               }
-                       }
-
-                       TreeParent properties = new TreeParent("Properties");
-                       addChild(properties);
-                       for (String key : serviceReference.getPropertyKeys()) {
-                               properties.addChild(new TreeParent(key + "="
-                                               + serviceReference.getProperty(key)));
-                       }
-
-               }
-
-               public ServiceReference getServiceReference() {
-                       return serviceReference;
-               }
-
-       }
-
-       class MultiplePackagesNode extends TreeParent {
-               private String packageName;
-               private Set<ExportedPackage> exportedPackages;
-
-               public MultiplePackagesNode(String packageName,
-                               Set<ExportedPackage> exportedPackages) {
-                       super(packageName);
-                       this.packageName = packageName;
-                       this.exportedPackages = exportedPackages;
-                       for (ExportedPackage pkg : exportedPackages) {
-                               addChild(new ExportedPackageNode(pkg));
-                       }
-               }
-
-       }
-
-       class ConflictingPackageNode extends TreeParent {
-               private ExportedPackage exportedPackage;
-
-               public ConflictingPackageNode(ExportedPackage exportedPackage) {
-                       super(exportedPackage.getName() + " - "
-                                       + exportedPackage.getVersion() + " ("
-                                       + exportedPackage.getExportingBundle() + ")");
-                       this.exportedPackage = exportedPackage;
-
-                       TreeParent bundlesNode = new TreeParent("Dependent Bundles");
-                       this.addChild(bundlesNode);
-                       Map<String, Bundle> bundles = new TreeMap<String, Bundle>();
-                       for (Bundle b : exportedPackage.getImportingBundles()) {
-                               bundles.put(b.getSymbolicName(), b);
-                       }
-                       for (String key : bundles.keySet()) {
-                               addDependentBundles(bundlesNode, bundles.get(key));
-                       }
-               }
-       }
-
-       protected void addDependentBundles(TreeParent parent, Bundle bundle) {
-               TreeParent bundleNode = new TreeParent(bundle.toString());
-               parent.addChild(bundleNode);
-               Map<String, Bundle> bundles = new TreeMap<String, Bundle>();
-               ExportedPackage[] pkgs = packageAdmin.getExportedPackages(bundle);
-               if (pkgs != null)
-                       for (ExportedPackage pkg : pkgs) {
-                               for (Bundle b : pkg.getImportingBundles()) {
-                                       if (!bundles.containsKey(b.getSymbolicName())
-                                                       && b.getBundleId() != bundle.getBundleId()) {
-                                               bundles.put(b.getSymbolicName(), b);
-                                       }
-                               }
-                       }
-
-               for (String key : bundles.keySet()) {
-                       addDependentBundles(bundleNode, bundles.get(key));
-               }
-       }
-
-       class ExportedPackageNode extends TreeParent {
-               private ExportedPackage exportedPackage;
-
-               public ExportedPackageNode(ExportedPackage exportedPackage) {
-                       super(exportedPackage.getName() + " - "
-                                       + exportedPackage.getVersion() + " ("
-                                       + exportedPackage.getExportingBundle() + ")");
-                       this.exportedPackage = exportedPackage;
-                       for (Bundle bundle : exportedPackage.getImportingBundles()) {
-                               addChild(new BundleNode(bundle));
-                       }
-               }
-       }
-}
diff --git a/osgi/plugins/pom.xml b/osgi/plugins/pom.xml
deleted file mode 100644 (file)
index 01d9d0a..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons</groupId>
-               <version>1.1.4-SNAPSHOT</version>
-               <artifactId>osgi</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <groupId>org.argeo.commons.osgi</groupId>
-       <artifactId>plugins</artifactId>
-       <name>Commons OSGi Eclipse Plugins</name>
-       <packaging>pom</packaging>
-       <modules>
-               <module>org.argeo.osgi.ui.explorer</module>
-       </modules>
-       <build>
-               <resources>
-                       <resource>
-                               <directory>src/main/resources</directory>
-                       </resource>
-                       <resource>
-                               <directory>.</directory>
-                               <includes>
-                                       <include>plugin.xml</include>
-                                       <include>META-INF/**</include>
-                                       <include>icons/**</include>
-                               </includes>
-                       </resource>
-               </resources>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-jar-plugin</artifactId>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-source-plugin</artifactId>
-                               <configuration>
-                                       <!-- Prevents source jars to contain misleading data -->
-                                       <excludes>
-                                               <exclude>plugin.xml</exclude>
-                                               <exclude>META-INF/MANIFEST.MF</exclude>
-                                       </excludes>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                               <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-</project>