KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > javadoc > search > DocSearchIcons


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.javadoc.search;
21
22 import java.util.EnumSet JavaDoc;
23 import javax.lang.model.element.ElementKind;
24 import javax.lang.model.element.Modifier;
25 import javax.swing.Icon JavaDoc;
26 import javax.swing.ImageIcon JavaDoc;
27 import org.netbeans.api.java.source.UiUtils;
28
29 import org.openide.util.Utilities;
30
31 /** <DESCRIPTION>
32
33  @author Petr Hrebejk
34 */

35 final class DocSearchIcons extends Object JavaDoc {
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 JavaDoc[] icons = new Icon JavaDoc[ ICON_WAIT + 1 ];
54
55     static {
56         try {
57             final EnumSet JavaDoc<Modifier> mods = EnumSet.of(Modifier.PUBLIC);
58             final EnumSet JavaDoc<Modifier> modsSt = EnumSet.of(Modifier.PUBLIC, Modifier.STATIC);
59             icons[ ICON_NOTRESOLVED ] = new ImageIcon JavaDoc (Utilities.loadImage("org/netbeans/modules/javadoc/resources/pending.gif")); // NOI18N
60
icons[ ICON_PACKAGE ] = new ImageIcon JavaDoc (Utilities.loadImage ("org/netbeans/modules/javadoc/comments/resources/package.gif")); // NOI18N
61
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 JavaDoc (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/exception.gif")); // NOI18N
66
icons[ ICON_ERROR ] = new ImageIcon JavaDoc (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/error.gif")); // NOI18N
67
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 JavaDoc (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/notFound.gif")); // NOI18N
73
icons[ ICON_WAIT ] = new ImageIcon JavaDoc (Utilities.loadImage ("org/netbeans/modules/javadoc/resources/wait.png")); // NOI18N
74
}
75         catch (Throwable JavaDoc w) {
76             w.printStackTrace ();
77         }
78     }
79
80     static Icon JavaDoc getIcon( int index ) {
81         return icons[ index ];
82     }
83
84 }
85
Popular Tags