1 19 20 package org.netbeans.modules.javadoc.search; 21 22 import java.util.EnumSet ; 23 import javax.lang.model.element.ElementKind; 24 import javax.lang.model.element.Modifier; 25 import javax.swing.Icon ; 26 import javax.swing.ImageIcon ; 27 import org.netbeans.api.java.source.UiUtils; 28 29 import org.openide.util.Utilities; 30 31 35 final class DocSearchIcons extends Object { 36 37 public static final int ICON_NOTRESOLVED = 0; 38 public static final int ICON_PACKAGE = ICON_NOTRESOLVED + 1 ; 39 public static final int ICON_CLASS = ICON_PACKAGE + 1 ; 40 public static final int ICON_INTERFACE = ICON_CLASS + 1; 41 public static final int ICON_ENUM = ICON_INTERFACE + 1; 42 public static final int ICON_ANNTYPE = ICON_ENUM + 1; 43 public static final int ICON_EXCEPTION = ICON_ANNTYPE + 1; 44 public static final int ICON_ERROR = ICON_EXCEPTION + 1; 45 public static final int ICON_CONSTRUCTOR = ICON_ERROR + 1; 46 public static final int ICON_METHOD = ICON_CONSTRUCTOR + 1; 47 public static final int ICON_METHOD_ST = ICON_METHOD + 1; 48 public static final int ICON_VARIABLE = ICON_METHOD_ST + 1; 49 public static final int ICON_VARIABLE_ST = ICON_VARIABLE + 1; 50 public static final int ICON_NOT_FOUND = ICON_VARIABLE_ST + 1; 51 public static final int ICON_WAIT = ICON_NOT_FOUND + 1; 52 53 private static final Icon [] icons = new Icon [ ICON_WAIT + 1 ]; 54 55 static { 56 try { 57 final EnumSet <Modifier> mods = EnumSet.of(Modifier.PUBLIC); 58 final EnumSet <Modifier> modsSt = EnumSet.of(Modifier.PUBLIC, Modifier.STATIC); 59 icons[ ICON_NOTRESOLVED ] = new ImageIcon (Utilities.loadImage("org/netbeans/modules/javadoc/resources/pending.gif")); icons[ ICON_PACKAGE ] = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/javadoc/comments/resources/package.gif")); icons[ ICON_CLASS ] = UiUtils.getElementIcon(ElementKind.CLASS, mods); 62 icons[ ICON_INTERFACE ] = UiUtils.getElementIcon(ElementKind.INTERFACE, mods); 63 icons[ ICON_ENUM ] = UiUtils.getElementIcon(ElementKind.ENUM, mods); 64 icons[ ICON_ANNTYPE ] = UiUtils.getElementIcon(ElementKind.ANNOTATION_TYPE, mods); 65 icons[ ICON_EXCEPTION ] = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/exception.gif")); icons[ ICON_ERROR ] = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/error.gif")); icons[ ICON_CONSTRUCTOR ] = UiUtils.getElementIcon(ElementKind.CONSTRUCTOR, mods); 68 icons[ ICON_METHOD ] = UiUtils.getElementIcon(ElementKind.METHOD, mods); 69 icons[ ICON_METHOD_ST ] = UiUtils.getElementIcon(ElementKind.METHOD, modsSt); 70 icons[ ICON_VARIABLE ] = UiUtils.getElementIcon(ElementKind.FIELD, mods); 71 icons[ ICON_VARIABLE_ST ] = UiUtils.getElementIcon(ElementKind.FIELD, modsSt); 72 icons[ ICON_NOT_FOUND ] = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/notFound.gif")); icons[ ICON_WAIT ] = new ImageIcon (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/wait.png")); } 75 catch (Throwable w) { 76 w.printStackTrace (); 77 } 78 } 79 80 static Icon getIcon( int index ) { 81 return icons[ index ]; 82 } 83 84 } 85 | Popular Tags |