01: package org.drools.eclipse.core.ui;
02:
03: import org.drools.eclipse.DroolsPluginImages;
04: import org.drools.eclipse.core.DroolsElement;
05: import org.eclipse.jface.viewers.LabelProvider;
06: import org.eclipse.swt.graphics.Image;
07:
08: public class DroolsLabelProvider extends LabelProvider {
09:
10: private static final String[] ICONS = new String[] {
11: DroolsPluginImages.PACKAGE, // ruleset
12: DroolsPluginImages.PACKAGE, // package
13: DroolsPluginImages.DROOLS, // rule
14: DroolsPluginImages.DROOLS, // query
15: DroolsPluginImages.METHOD, // function
16: DroolsPluginImages.CLASS, // template
17: DroolsPluginImages.DSL, // expander
18: DroolsPluginImages.GLOBAL, // global
19: DroolsPluginImages.IMPORT, // import
20: DroolsPluginImages.DROOLS, // rule attribute
21: };
22:
23: public Image getImage(Object element) {
24: if (element instanceof DroolsElement) {
25: String icon = ICONS[((DroolsElement) element).getType()];
26: return DroolsPluginImages.getImageRegistry().get(icon);
27: }
28: return null;
29: }
30:
31: }
|