Permalink
Browse files

Convenience method for reading image files from plugin's icons

directory. ForestTreeLabelProvider was referring to non-existing plugin
ID.
  • Loading branch information...
1 parent 5dc22bd commit 25c758e52127a28f18d74827964a863d722b1878 @cderoove committed Jan 29, 2013
@@ -11,6 +11,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import exapus.gui.util.Util;
import exapus.model.forest.Element;
import exapus.model.forest.Member;
import exapus.model.forest.OutboundRef;
@@ -19,14 +20,14 @@
public class ForestTreeLabelProvider implements ITableLabelProvider {
- private static final Image PKTREE_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/packagefolder_obj.gif").createImage();
- private static final Image PKLAYER_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/package_obj.gif").createImage();
- private static final Image CLASS_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/class_obj.gif").createImage();
- private static final Image ENUM_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/enum_obj.gif").createImage();
- private static final Image INTERFACE_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/int_obj.gif").createImage();
- private static final Image METHOD_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/methpub_obj.gif").createImage();
- private static final Image FIELD_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/field_public_obj.gif").createImage();
- private static final Image ANNOTATION_IMG = AbstractUIPlugin.imageDescriptorFromPlugin("ExapusRAP", "/icons/annotation_obj.gif").createImage();
+ private static final Image PKTREE_IMG = Util.getImageDescriptorFromPlugin("packagefolder_obj.gif").createImage();
+ private static final Image PKLAYER_IMG = Util.getImageDescriptorFromPlugin("package_obj.gif").createImage();
+ private static final Image CLASS_IMG = Util.getImageDescriptorFromPlugin("class_obj.gif").createImage();
+ private static final Image ENUM_IMG = Util.getImageDescriptorFromPlugin("enum_obj.gif").createImage();
+ private static final Image INTERFACE_IMG = Util.getImageDescriptorFromPlugin("int_obj.gif").createImage();
+ private static final Image METHOD_IMG = Util.getImageDescriptorFromPlugin("methpub_obj.gif").createImage();
+ private static final Image FIELD_IMG = Util.getImageDescriptorFromPlugin("field_public_obj.gif").createImage();
+ private static final Image ANNOTATION_IMG = Util.getImageDescriptorFromPlugin("annotation_obj.gif").createImage();
@Override
public void dispose() {
@@ -1,9 +1,14 @@
package exapus.gui.util;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
public class Util {
+
+ //should correspond to the one in plugin.xml (usally put in plugin Activator, but there is none now)
+ public static String PLUGIN_ID = "Exapus";
public static void asyncUIThreadIfWidgetNotDisposed(Widget w, Runnable r) {
if(w == null)
@@ -14,6 +19,12 @@ public static void asyncUIThreadIfWidgetNotDisposed(Widget w, Runnable r) {
display.asyncExec(r);
}
+ public static ImageDescriptor getImageDescriptorFromPlugin(String name) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "/icons/" + name);
+ }
+
+
+
}

0 comments on commit 25c758e

Please sign in to comment.