KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lookformyself > Loder


1 package lookformyself;
2
3 import java.util.Iterator JavaDoc;
4 import org.openide.filesystems.FileObject;
5 import org.openide.modules.ModuleInfo;
6 import org.openide.util.Lookup;
7
8 public class Loder extends org.openide.util.actions.CallableSystemAction {
9     
10     public static boolean foundEarly;
11     
12     public Loder() {
13         initialize();
14     }
15     
16     protected void initialize() {
17         // Now the real stuff:
18
foundEarly = foundNow();
19     }
20     
21     public static boolean foundNow() {
22         Iterator JavaDoc it = Lookup.getDefault().lookup(new Lookup.Template(ModuleInfo.class)).allInstances().iterator();
23         while (it.hasNext()) {
24             ModuleInfo m = (ModuleInfo)it.next();
25             if (m.getCodeNameBase().equals("lookformyself")) {
26                 return true;
27             }
28         }
29         return false;
30     }
31     
32     public void performAction () {
33         throw new IllegalStateException JavaDoc("Never called");
34     }
35     
36     public org.openide.util.HelpCtx getHelpCtx() {
37         return org.openide.util.HelpCtx.DEFAULT_HELP;
38     }
39     
40     public String JavaDoc getName() {
41         return "LoderAction";
42     }
43     
44 }
45
Popular Tags