KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > javacore > JavaCoreModule


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.javacore;
21 import java.util.HashSet JavaDoc;
22 import java.util.Set JavaDoc;
23 import org.netbeans.api.mdr.MDRManager;
24 import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
25 import org.netbeans.modules.mdr.MDRManagerImpl;
26 import org.openide.modules.ModuleInstall;
27 import org.openide.windows.WindowManager;
28
29 /** Manages a module's lifecycle.
30  * Remember that an installer is optional and often not needed at all.
31  *
32  * @author Martin Matula
33  */

34 public class JavaCoreModule extends ModuleInstall {
35     
36     private static volatile boolean startupInProgress = true;
37     
38     /**
39      * Getter for property startupInProgress.
40      * @return Value of property startupInProgress.
41      */

42     static boolean isStartupInProgress() {
43         return startupInProgress;
44     }
45     
46     public void restored() {
47         final MDRManager manager = MDRManager.getDefault();
48         if (manager instanceof MDRManagerImpl) {
49             ((MDRManagerImpl) manager).setProgressListener(new ShutDownProgressListener());
50         }
51         // notify JMManager when startup is finished (ui is ready)
52
WindowManager.getDefault().invokeWhenUIReady(new Runnable JavaDoc() {
53             public void run () {
54                 if (startupInProgress) {
55                     startupInProgress = false;
56                     ((JMManager) JMManager.getManager()).startupFinished();
57                 }
58             }
59         });
60         org.netbeans.modules.javacore.internalapi.JavaMetamodel.getManager();
61     }
62     
63     public boolean closing() {
64         ((JMManager) JavaMetamodel.getManager()).removeListener();
65         return true;
66     }
67     
68 }
69
Popular Tags