minor changes in market plugin
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 18 May 2016 10:59:54 +0000 (13:59 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 18 May 2016 10:59:54 +0000 (13:59 +0300)
src/java/netxms-eclipse/Market/icons/event.gif [new file with mode: 0644]
src/java/netxms-eclipse/Market/icons/repository.gif [new file with mode: 0644]
src/java/netxms-eclipse/Market/icons/repository_mgr.gif [new file with mode: 0644]
src/java/netxms-eclipse/Market/icons/template.png [new file with mode: 0644]
src/java/netxms-eclipse/Market/plugin.xml
src/java/netxms-eclipse/Market/src/org/netxms/ui/eclipse/market/Activator.java
src/java/netxms-eclipse/Market/src/org/netxms/ui/eclipse/market/views/helpers/RepositoryLabelProvider.java

diff --git a/src/java/netxms-eclipse/Market/icons/event.gif b/src/java/netxms-eclipse/Market/icons/event.gif
new file mode 100644 (file)
index 0000000..004f4ac
Binary files /dev/null and b/src/java/netxms-eclipse/Market/icons/event.gif differ
diff --git a/src/java/netxms-eclipse/Market/icons/repository.gif b/src/java/netxms-eclipse/Market/icons/repository.gif
new file mode 100644 (file)
index 0000000..012832b
Binary files /dev/null and b/src/java/netxms-eclipse/Market/icons/repository.gif differ
diff --git a/src/java/netxms-eclipse/Market/icons/repository_mgr.gif b/src/java/netxms-eclipse/Market/icons/repository_mgr.gif
new file mode 100644 (file)
index 0000000..1f1a164
Binary files /dev/null and b/src/java/netxms-eclipse/Market/icons/repository_mgr.gif differ
diff --git a/src/java/netxms-eclipse/Market/icons/template.png b/src/java/netxms-eclipse/Market/icons/template.png
new file mode 100644 (file)
index 0000000..abcd936
Binary files /dev/null and b/src/java/netxms-eclipse/Market/icons/template.png differ
index 69dce01..b5a5e27 100644 (file)
@@ -5,6 +5,7 @@
          point="org.eclipse.ui.views">
       <view
             class="org.netxms.ui.eclipse.market.views.RepositoryManager"
+            icon="icons/repository_mgr.gif"
             id="org.netxms.ui.eclipse.market.views.RepositoryManager"
             name="Repository Manager"
             restorable="true">
@@ -47,6 +48,7 @@
          <action
                class="org.netxms.ui.eclipse.market.actions.OpenRepositoryManager"
                definitionId="org.netxms.ui.eclipse.market.commands.openRepositoryManager"
+               icon="icons/repository_mgr.gif"
                id="org.netxms.ui.eclipse.market.actions.OpenRepositoryManager"
                label="Market"
                menubarPath="config/additions"
index c5daa42..dc10fdd 100644 (file)
@@ -17,6 +17,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */package org.netxms.ui.eclipse.market;
 
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
@@ -69,4 +70,16 @@ public class Activator extends AbstractUIPlugin
    {
       return plugin;
    }
+
+   /**
+    * Returns an image descriptor for the image file at the given
+    * plug-in relative path
+    *
+    * @param path the path
+    * @return the image descriptor
+    */
+   public static ImageDescriptor getImageDescriptor(String path)
+   {
+      return imageDescriptorFromPlugin(PLUGIN_ID, path);
+   }
 }
index 9bccfe1..4ea8ade 100644 (file)
@@ -22,19 +22,39 @@ import java.util.UUID;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
+import org.netxms.ui.eclipse.market.Activator;
+import org.netxms.ui.eclipse.market.objects.EventReference;
 import org.netxms.ui.eclipse.market.objects.MarketObject;
+import org.netxms.ui.eclipse.market.objects.RepositoryRuntimeInfo;
+import org.netxms.ui.eclipse.market.objects.TemplateReference;
 
 /**
  * Label provider for repository manager
  */
 public class RepositoryLabelProvider extends LabelProvider implements ITableLabelProvider
 {
+   private Image imageEvent = Activator.getImageDescriptor("icons/event.gif").createImage();
+   private Image imageRepository = Activator.getImageDescriptor("icons/repository.gif").createImage();
+   private Image imageTemplate = Activator.getImageDescriptor("icons/template.png").createImage();
+   
    /* (non-Javadoc)
     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
     */
    @Override
    public Image getColumnImage(Object element, int columnIndex)
    {
+      if (columnIndex != 0)
+         return null;
+      
+      if (element instanceof EventReference)
+         return imageEvent;
+      
+      if (element instanceof TemplateReference)
+         return imageTemplate;
+      
+      if (element instanceof RepositoryRuntimeInfo)
+         return imageRepository;
+      
       return null;
    }
 
@@ -55,4 +75,14 @@ public class RepositoryLabelProvider extends LabelProvider implements ITableLabe
       }
       return null;
    }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.BaseLabelProvider#dispose()
+    */
+   @Override
+   public void dispose()
+   {
+      imageRepository.dispose();
+      super.dispose();
+   }
 }