]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.eclipse.ui.workbench/src/org/argeo/eclipse/ui/workbench/osgi/BundlesView.java
Improve OSGi Explorer
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui.workbench / src / org / argeo / eclipse / ui / workbench / osgi / BundlesView.java
index 0734ef56d0ddb9883c10c5ccdc955d4058cbd057..5ebd737912b993b6b48f7a4c9c072dcab953b594 100644 (file)
@@ -29,7 +29,6 @@ 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;
@@ -39,9 +38,6 @@ import org.osgi.framework.BundleContext;
  * Overview of the bundles as a table. Equivalent to Equinox 'ss' console
  * command.
  */
-
-// public class BundlesView {}
-
 public class BundlesView extends ViewPart {
        private TableViewer viewer;
 
@@ -84,7 +80,7 @@ public class BundlesView extends ViewPart {
 
                // Symbolic name
                column = new TableViewerColumn(viewer, SWT.NONE);
-               column.getColumn().setWidth(300);
+               column.getColumn().setWidth(250);
                column.getColumn().setText("Symbolic Name");
                column.setLabelProvider(new ColumnLabelProvider() {
                        private static final long serialVersionUID = -4280840684440451080L;
@@ -107,18 +103,13 @@ public class BundlesView extends ViewPart {
                        private static final long serialVersionUID = 6871926308708629989L;
 
                        public String getText(Object element) {
-
-                               // return "";
-                               // FIXME triggers compilation failure
                                Bundle bundle = (org.osgi.framework.Bundle) element;
                                return bundle.getVersion().toString();
                        }
                });
                new ColumnViewerComparator<Bundle>(column, new Comparator<Bundle>() {
                        public int compare(Bundle o1, Bundle o2) {
-                               return 0;
-                               // FIXME getVersion() triggers compilation failure
-                               // return o1.getVersion().compareTo(o2.getVersion());
+                               return o1.getVersion().compareTo(o2.getVersion());
                        }
                });
 
@@ -153,65 +144,4 @@ public class BundlesView extends ViewPart {
                }
 
        }
-
-       /** Label provider for the state column */
-       private static class StateLabelProvider extends ColumnLabelProvider {
-               private static final long serialVersionUID = -7885583135316000733L;
-
-               @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("Bundle-ActivationPolicy").toString();
-                               // FIXME constant triggers the compilation failure
-                               // .get(Constants.BUNDLE_ACTIVATIONPOLICY).toString();
-                               if (activationPolicy != null && activationPolicy.equals("lazy"))
-                                       // FIXME constant triggers the compilation failure
-                                       // && activationPolicy.equals(Constants.ACTIVATION_LAZY))
-                                       return "<<LAZY>>";
-                               return "STARTING";
-                       case Bundle.STOPPING:
-                               return "STOPPING";
-                       case Bundle.ACTIVE:
-                               return "ACTIVE";
-                       default:
-                               return null;
-                       }
-               }
-       }
 }
\ No newline at end of file