diff -r 54345f481aa5 autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java --- a/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -57,13 +57,15 @@ import org.openide.modules.ModuleInstall; import org.openide.util.NbPreferences; import org.openide.util.RequestProcessor; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.WindowManager; /** * Manages a module's lifecycle. Remember that an installer is optional and * often not needed at all. */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/UIReady", service=Runnable.class) +public class Installer implements Runnable { public static final String KEY_IMPORT_FROM = "import-from"; public static final String CODE_NAME = "ClusterUpdateProvider"; @@ -78,7 +80,7 @@ private static final String IMPORTED = "imported"; // NOI18N @Override - public void restored () { + public void run() { // don't try to invoke at all in these special cases if (Boolean.getBoolean("netbeans.full.hack") || Boolean.getBoolean("netbeans.close")) { // NOI18N return; @@ -88,14 +90,7 @@ Preferences au_pref = NbPreferences.root ().node ("/org/netbeans/modules/autoupdate"); // NOI18N au_pref.node (Installer.CODE_NAME + Installer.REMOVED).putBoolean (Installer.REMOVED, true); - // install plugin importer when UI is ready (main window shown) - WindowManager.getDefault ().invokeWhenUIReady (new Runnable () { - - @Override - public void run () { - RequestProcessor.getDefault ().post (doCheck, getImportDelay ()); // XXX: Need to wait until UC downloaded&parsed - } - }); + RequestProcessor.getDefault ().post (doCheck, getImportDelay ()); // XXX: Need to wait until UC downloaded&parsed } private Runnable doCheck = new Runnable () { diff -r 54345f481aa5 autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/actions/Installer.java --- a/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/actions/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/actions/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -44,18 +44,18 @@ package org.netbeans.modules.autoupdate.ui.actions; -import org.openide.modules.ModuleInstall; import org.openide.util.RequestProcessor; +import org.openide.util.lookup.ServiceProvider; /** * Manages a module's lifecycle. Remember that an installer is optional and * often not needed at all. */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class Installer implements Runnable { public static final RequestProcessor RP = new RequestProcessor("AutoUpdate-UI"); // NOI18N - @Override - public void restored () { + public void run() { // don't try to invoke at all in these special cases if (Boolean.getBoolean("netbeans.full.hack") || Boolean.getBoolean("netbeans.close")) { // NOI18N return; diff -r 54345f481aa5 db/src/org/netbeans/modules/db/DatabaseModule.java --- a/db/src/org/netbeans/modules/db/DatabaseModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/db/src/org/netbeans/modules/db/DatabaseModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -51,9 +51,10 @@ import org.netbeans.modules.db.explorer.DatabaseConnection; import org.netbeans.modules.db.runtime.DatabaseRuntimeManager; import org.netbeans.spi.db.explorer.DatabaseRuntime; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; -public class DatabaseModule extends ModuleInstall { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class DatabaseModule implements Runnable { public static final String IDENTIFIER_MYSQL = "MySQL"; // NOI18N public static final String IDENTIFIER_ORACLE = "Oracle"; // NOI18N @@ -61,7 +62,7 @@ public static final String IDENTIFIER_ORACLE_OCI_DRIVER = "OCI"; // NOI18N @Override - public void close () { + public void run() { // XXX this method is called in the event thread and could take long // to execute diff -r 54345f481aa5 editor.completion/src/org/netbeans/modules/editor/completion/CompletionModule.java --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -44,15 +44,16 @@ package org.netbeans.modules.editor.completion; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * * @author Dusan Balek */ -public class CompletionModule extends ModuleInstall { - - public void restored() { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class CompletionModule implements Runnable { + @Override + public void run() { CompletionImpl.get(); } } diff -r 54345f481aa5 form.j2ee/src/org/netbeans/modules/form/j2ee/Installer.java --- a/form.j2ee/src/org/netbeans/modules/form/j2ee/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/form.j2ee/src/org/netbeans/modules/form/j2ee/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -45,20 +45,21 @@ import org.netbeans.modules.form.CreationDescriptor; import org.netbeans.modules.form.CreationFactory; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Management of form/j2ee module's lifecycle. * * @author Jan Stola */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class Installer implements Runnable { /** * Registers creation descriptors. */ @Override - public void restored() { + public void run() { // Install creator for EntityManager CreationDescriptor cd = new CreationDescriptor() { @Override diff -r 54345f481aa5 glassfish.common/src/org/netbeans/modules/glassfish/common/Installer.java --- a/glassfish.common/src/org/netbeans/modules/glassfish/common/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -41,7 +41,7 @@ */ package org.netbeans.modules.glassfish.common; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Manages a module's lifecycle. Remember that an installer is optional and @@ -49,12 +49,10 @@ * * @auther Peter Williams */ -public class Installer extends ModuleInstall { - +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class Installer implements Runnable { @Override - public void close() { - super.close(); - + public void run() { // Send a shutdown message to any V3 server instances we started. if (GlassfishInstanceProvider.initialized()) { for(GlassfishInstanceProvider provider: GlassfishInstanceProvider.getProviders(false)) { diff -r 54345f481aa5 httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java --- a/httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -66,13 +66,15 @@ import org.openide.util.LookupListener; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; +import org.openide.util.lookup.ServiceProvider; /** * Module installation class for Http Server * * @author Petr Jiricka */ -public class HttpServerModule extends ModuleInstall implements Externalizable { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class HttpServerModule implements Runnable { private static ContextManager server; @@ -84,7 +86,8 @@ private static boolean inSetRunning = false; /** Module is being closed. */ - public void close () { + @Override + public void run() { // stop the server, don't set the running status synchronized (HttpServerSettings.httpLock ()) { stopHTTPServer(); diff -r 54345f481aa5 hudson/src/org/netbeans/modules/hudson/Installer.java --- a/hudson/src/org/netbeans/modules/hudson/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/hudson/src/org/netbeans/modules/hudson/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -46,26 +46,30 @@ import java.util.prefs.BackingStoreException; import org.netbeans.modules.hudson.impl.HudsonManagerImpl; -import org.openide.modules.ModuleInstall; import org.openide.util.Exceptions; import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; +import org.openide.util.lookup.ServiceProvider; -public class Installer extends ModuleInstall implements Runnable { +@ServiceProvider(path="Modules/UIReady", service=Runnable.class) +public class Installer implements Runnable { - public @Override void restored() { + public @Override void run() { if (active()) { - WindowManager.getDefault().invokeWhenUIReady(this); + init(); } } - public void run() { + private void init() { HudsonManagerImpl.getDefault().getInstances(); } - public @Override void uninstalled() { - if (active()) { - HudsonManagerImpl.getDefault().terminate(); + @ServiceProvider(path="Modules/Stop", service=Runnable.class) + public static final class Down implements Runnable { + @Override + public void run() { + if (active()) { + HudsonManagerImpl.getDefault().terminate(); + } } } diff -r 54345f481aa5 i18n.form/src/org/netbeans/modules/i18n/form/I18nFormCrossModule.java --- a/i18n.form/src/org/netbeans/modules/i18n/form/I18nFormCrossModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/i18n.form/src/org/netbeans/modules/i18n/form/I18nFormCrossModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -47,6 +47,7 @@ import org.netbeans.modules.form.FormPropertyEditorManager; import org.netbeans.modules.i18n.I18nSupport; import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Installation class for i18n to form cross dependency module. @@ -54,15 +55,11 @@ * * @author Peter Zavadsky */ -public class I18nFormCrossModule extends ModuleInstall { - +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class I18nFormCrossModule implements Runnable { /** Registers property editor in form module and factory in i18n module. */ - public void restored() { - registerFormPropertyEditor(); - } - - /** Registers FormI18nStringEditor form property editor to form module. */ - private void registerFormPropertyEditor() { + @Override + public void run() { Class newEditorClass = FormI18nStringEditor.class; Class newEditorClassInteger = FormI18nIntegerEditor.class; Class newEditorClassMnemonic = FormI18nMnemonicEditor.class; diff -r 54345f481aa5 j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/Install.java --- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/Install.java Tue Mar 13 11:10:02 2012 +0100 +++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/Install.java Tue Mar 13 11:42:45 2012 +0100 @@ -46,18 +46,15 @@ import java.util.Collection; import java.util.Iterator; +import org.openide.util.lookup.ServiceProvider; /** * @author nn136682 */ -public class Install extends org.openide.modules.ModuleInstall { - - /** Creates a new instance of Install */ - public Install() { - } - - @Override public void close() { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class Install implements Runnable { + @Override public void run() { if (ServerRegistry.wasInitialized ()) { Collection instances = ServerRegistry.getInstance().getInstances(); for (Iterator i=instances.iterator(); i.hasNext();) { diff -r 54345f481aa5 java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/J2SEPlatformModule.java --- a/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/J2SEPlatformModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/J2SEPlatformModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -49,32 +49,26 @@ import org.openide.cookies.InstanceCookie; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; -import org.openide.modules.ModuleInstall; import org.openide.util.Exceptions; import org.netbeans.api.project.ProjectManager; import org.openide.filesystems.FileUtil; +import org.openide.util.lookup.ServiceProvider; -public class J2SEPlatformModule extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class J2SEPlatformModule implements Runnable { private static final String DEFAULT_PLATFORM = "Services/Platforms/org-netbeans-api-java-Platform/default_platform.xml"; //NOI18N - public void restored() { - super.restored(); - ProjectManager.mutex().postWriteRequest( - new Runnable () { - public void run () { - recoverDefaultPlatform (); - } - } - ); - + @Override + public void run() { + if (ProjectManager.mutex().isWriteAccess()) { + recoverDefaultPlatform(); + } else { + ProjectManager.mutex().postWriteRequest(this); + } } - - - - private static void recoverDefaultPlatform () { final FileObject defaultPlatform = FileUtil.getConfigFile(DEFAULT_PLATFORM); if (defaultPlatform != null) { diff -r 54345f481aa5 java.source/src/org/netbeans/modules/java/source/JBrowseModule.java --- a/java.source/src/org/netbeans/modules/java/source/JBrowseModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/java.source/src/org/netbeans/modules/java/source/JBrowseModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -45,22 +45,16 @@ package org.netbeans.modules.java.source; import org.netbeans.modules.java.source.usages.ClassIndexManager; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * * @author Petr Hrebejk * @author Tomas Zezula */ -public class JBrowseModule extends ModuleInstall { - - /** Creates a new instance of JBrowseModule */ - public JBrowseModule() { - } - - - public @Override void close () { - super.close(); +@ServiceProvider(path="Module/Stop", service=Runnable.class) +public class JBrowseModule implements Runnable { + public @Override void run() { ClassIndexManager.getDefault().close(); } } diff -r 54345f481aa5 java.sourceui/src/org/netbeans/modules/java/source/ui/JavaSourceUIModule.java --- a/java.sourceui/src/org/netbeans/modules/java/source/ui/JavaSourceUIModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/java.sourceui/src/org/netbeans/modules/java/source/ui/JavaSourceUIModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -41,17 +41,17 @@ */ package org.netbeans.modules.java.source.ui; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Activates the GPR Listener that prepares 'fast index' * * @author sdedic */ -public class JavaSourceUIModule extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class JavaSourceUIModule implements Runnable { @Override - public void restored() { - super.restored(); + public void run() { // attach to GPR OpenProjectFastIndex.getDefault(); } diff -r 54345f481aa5 javadoc/src/org/netbeans/modules/javadoc/JavadocModule.java --- a/javadoc/src/org/netbeans/modules/javadoc/JavadocModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/javadoc/src/org/netbeans/modules/javadoc/JavadocModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -50,13 +50,15 @@ import java.util.Iterator; import java.util.LinkedList; import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; /** * Class for initializing Javadoc module on IDE startup. * @author Petr Hrebejk */ -public final class JavadocModule extends ModuleInstall { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public final class JavadocModule implements Runnable { private static Collection/**/ floatingTopComponents; @@ -72,7 +74,8 @@ floatingTopComponents.remove(tc); } - public void uninstalled() { + @Override + public void run() { Collection c; synchronized (JavadocModule.class) { if (floatingTopComponents != null) { diff -r 54345f481aa5 javascript.editing/src/org/netbeans/modules/javascript/editing/Installer.java --- a/javascript.editing/src/org/netbeans/modules/javascript/editing/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/javascript.editing/src/org/netbeans/modules/javascript/editing/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -43,16 +43,12 @@ import org.netbeans.api.java.classpath.ClassPath; import org.netbeans.api.java.classpath.GlobalPathRegistry; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; -/** - * Manages a module's lifecycle. Remember that an installer is optional and - * often not needed at all. - */ -public class Installer extends ModuleInstall { - +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class Installer implements Runnable { @Override - public void uninstalled() { + public void run() { GlobalPathRegistry.getDefault().unregister(JsClassPathProvider.BOOT_CP, new ClassPath[] { JsClassPathProvider.getBootClassPath() }); } diff -r 54345f481aa5 localhistory/src/org/netbeans/modules/localhistory/ModuleLifecycleManager.java --- a/localhistory/src/org/netbeans/modules/localhistory/ModuleLifecycleManager.java Tue Mar 13 11:10:02 2012 +0100 +++ b/localhistory/src/org/netbeans/modules/localhistory/ModuleLifecycleManager.java Tue Mar 13 11:42:45 2012 +0100 @@ -43,14 +43,16 @@ */ package org.netbeans.modules.localhistory; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * * @author Tomas Stupka */ -public class ModuleLifecycleManager extends ModuleInstall { - public void restored() { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class ModuleLifecycleManager implements Runnable { + @Override + public void run() { LocalHistory.getInstance().init(); } } diff -r 54345f481aa5 masterfs/src/org/netbeans/modules/masterfs/Installer.java --- a/masterfs/src/org/netbeans/modules/masterfs/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/masterfs/src/org/netbeans/modules/masterfs/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -42,23 +42,22 @@ package org.netbeans.modules.masterfs; import org.netbeans.modules.masterfs.watcher.Watcher; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** Shutdown the watcher system. */ -public final class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public final class Installer implements Runnable { @Override - public void restored() { + public void run() { Watcher.isEnabled(); } - @Override - public void uninstalled() { - close(); - } - - @Override - public void close() { - Watcher.shutdown(); + @ServiceProvider(path="Modules/Stop", service=Runnable.class) + public static final class Down implements Runnable { + @Override + public void run() { + Watcher.shutdown(); + } } } diff -r 54345f481aa5 maven.indexer/src/org/netbeans/modules/maven/indexer/Installer.java --- a/maven.indexer/src/org/netbeans/modules/maven/indexer/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/maven.indexer/src/org/netbeans/modules/maven/indexer/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -47,13 +47,14 @@ import java.util.logging.Logger; import org.netbeans.modules.maven.indexer.api.RepositoryPreferences; import org.netbeans.modules.maven.indexer.spi.RepositoryIndexerImplementation; -import org.openide.modules.ModuleInstall; import org.openide.util.Lookup; +import org.openide.util.lookup.ServiceProvider; -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class Installer implements Runnable { @SuppressWarnings("deprecation") - public @Override void close() { + public @Override void run() { Logger LOG = Logger.getLogger(Installer.class.getName()); if (!Cancellation.cancelAll()) { // Cf. #188883. Hard to kill HTTP connections. diff -r 54345f481aa5 mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/startup/DefaultEmulatorInstall.java --- a/mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/startup/DefaultEmulatorInstall.java Tue Mar 13 11:10:02 2012 +0100 +++ b/mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/startup/DefaultEmulatorInstall.java Tue Mar 13 11:42:45 2012 +0100 @@ -72,6 +72,7 @@ import org.openide.modules.InstalledFileLocator; import org.openide.modules.ModuleInstall; import org.openide.util.RequestProcessor; +import org.openide.util.lookup.ServiceProvider; import org.openide.xml.XMLUtil; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -81,11 +82,13 @@ /** * @author David Kaspar */ -public class DefaultEmulatorInstall extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class DefaultEmulatorInstall implements Runnable { static private final String EMU_MARKER="emu_installed.mark"; static private final String DSC_MARKER="dsc_installed.mark"; - public void restored() { + @Override + public void run() { new LibraryConverter(); installEmulators(); installDescriptors(); diff -r 54345f481aa5 openide.text/src/org/netbeans/modules/openide/text/Installer.java --- a/openide.text/src/org/netbeans/modules/openide/text/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/openide.text/src/org/netbeans/modules/openide/text/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -47,7 +47,7 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Log number of editors opened during IDE session by mime type. @@ -55,7 +55,8 @@ * * @author Marek Slama */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class Installer implements Runnable { private static Map mimeTypes = new HashMap(); @@ -71,7 +72,7 @@ } @Override - public void close() { + public void run() { for (String s : mimeTypes.keySet()) { Logger logger = Logger.getLogger("org.netbeans.ui.metrics.editor"); //NOI18N LogRecord rec = new LogRecord(Level.INFO, "USG_EDITOR_MIME_TYPE"); //NOI18N diff -r 54345f481aa5 parsing.api/src/org/netbeans/modules/parsing/impl/Installer.java --- a/parsing.api/src/org/netbeans/modules/parsing/impl/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/parsing.api/src/org/netbeans/modules/parsing/impl/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -4,38 +4,40 @@ */ package org.netbeans.modules.parsing.impl; +import java.awt.EventQueue; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; -import org.openide.modules.ModuleInstall; import org.openide.util.RequestProcessor; -import org.openide.windows.WindowManager; +import org.openide.util.lookup.ServiceProvider; /** * Manages a module's lifecycle. Remember that an installer is optional and * often not needed at all. */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class Installer implements Runnable { @Override - public void restored () { - super.restored(); + public void run() { RepositoryUpdater.getDefault().start(false); - - WindowManager.getDefault().invokeWhenUIReady(new Runnable() { - public void run () { - RequestProcessor.getDefault().post(new Runnable() { - public void run() { - Schedulers.init(); - } - }); + } + + @ServiceProvider(path="Modules/UIReady", service=Runnable.class) + public static class UI implements Runnable { + @Override + public void run() { + if (EventQueue.isDispatchThread()) { + RequestProcessor.getDefault().post(this); + } else { + Schedulers.init(); } - }); + } } - @Override - public boolean closing () { - final boolean ret = super.closing(); - RepositoryUpdater.getDefault().stop(); - return ret; + @ServiceProvider(path="Modules/Stop", service=Runnable.class) + public static class Stop implements Runnable { + @Override + public void run() { + RepositoryUpdater.getDefault().stop(); + } } - } diff -r 54345f481aa5 profiler.drilldown/src/org/netbeans/modules/profiler/drilldown/Installer.java --- a/profiler.drilldown/src/org/netbeans/modules/profiler/drilldown/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/profiler.drilldown/src/org/netbeans/modules/profiler/drilldown/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -41,16 +41,16 @@ */ package org.netbeans.modules.profiler.drilldown; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Manages a module's lifecycle. Remember that an installer is optional and * often not needed at all. */ -public class Installer extends ModuleInstall { - +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class Installer implements Runnable { @Override - public void uninstalled() { + public void run() { DrillDownWindow.closeIfOpened(); } } diff -r 54345f481aa5 profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Installer.java --- a/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -41,16 +41,18 @@ */ package org.netbeans.modules.profiler.ppoints; -import org.openide.modules.ModuleInstall; +import java.util.concurrent.Callable; +import org.openide.util.lookup.ServiceProvider; /** * Manages a module's lifecycle. Remember that an installer is optional and * often not needed at all. */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Stop", service=Callable.class) +public class Installer implements Callable { @Override - public boolean closing() { + public Boolean call() { ProfilingPointsManager.getDefault().ideClosing(); // TODO: dirty profiling points should be persisted on document save! return true; } diff -r 54345f481aa5 project.ant/src/org/netbeans/modules/project/ant/AntProjectModule.java --- a/project.ant/src/org/netbeans/modules/project/ant/AntProjectModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/project.ant/src/org/netbeans/modules/project/ant/AntProjectModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -63,8 +63,8 @@ import org.openide.DialogDisplayer; import org.openide.LifecycleManager; import org.openide.NotifyDescriptor; -import org.openide.modules.ModuleInstall; import org.openide.util.NbBundle; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.WindowManager; import org.openide.xml.XMLUtil; import org.w3c.dom.Document; @@ -75,11 +75,9 @@ * @author Jan Lahoda * @see "issue #70130" */ -public class AntProjectModule extends ModuleInstall { - - public @Override void restored() { - super.restored(); - +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class AntProjectModule implements Runnable { + public @Override void run() { if (Boolean.getBoolean("netbeans.do.not.check.xalan")) // NOI18N return ; diff -r 54345f481aa5 project.libraries/src/org/netbeans/modules/project/libraries/LibrariesModule.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/LibrariesModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/project.libraries/src/org/netbeans/modules/project/libraries/LibrariesModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -43,9 +43,9 @@ */ package org.netbeans.modules.project.libraries; -import org.openide.modules.ModuleInstall; import org.openide.util.Lookup; import org.netbeans.spi.project.libraries.LibraryProvider; +import org.openide.util.lookup.ServiceProvider; /** * Ensures that all {@link LibraryProvider}s are actually loaded. @@ -54,14 +54,9 @@ * This needs to happen before any Ant build is run. * @author Tomas Zezula */ -public class LibrariesModule extends ModuleInstall { - - @Override public void restored() { - super.restored(); - this.initProviders(); - } - - private void initProviders () { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class LibrariesModule implements Runnable { + @Override public void run() { for (LibraryProvider lp : Lookup.getDefault().lookupAll(LibraryProvider.class)) { lp.getLibraries(); } diff -r 54345f481aa5 projectapi/src/org/netbeans/modules/projectapi/Installer.java --- a/projectapi/src/org/netbeans/modules/projectapi/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/projectapi/src/org/netbeans/modules/projectapi/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -44,23 +44,26 @@ package org.netbeans.modules.projectapi; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Manages a module's lifecycle. Remember that an installer is optional and * often not needed at all. */ -public class Installer extends ModuleInstall { - +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class Installer implements Runnable { @Override - public void restored() { + public void run() { //#125582 SimpleFileOwnerQueryImplementation.deserialize(); } - @Override - public void close() { - //#125582 - SimpleFileOwnerQueryImplementation.serialize(); + @ServiceProvider(path="Modules/Stop", service=Runnable.class) + public static final class Down implements Runnable { + @Override + public void run() { + //#125582 + SimpleFileOwnerQueryImplementation.serialize(); + } } } diff -r 54345f481aa5 projectui/src/org/netbeans/modules/project/ui/ProjectUiModule.java --- a/projectui/src/org/netbeans/modules/project/ui/ProjectUiModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/projectui/src/org/netbeans/modules/project/ui/ProjectUiModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -49,27 +49,32 @@ import org.netbeans.api.project.ProjectManager; import org.openide.ErrorManager; import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Startup and shutdown hooks for projectui module. * @author Jesse Glick */ -public class ProjectUiModule extends ModuleInstall { - - public void restored() { +@ServiceProvider(path="Modules/UIReady", service=Runnable.class) +public class ProjectUiModule implements Runnable { + @Override + public void run() { if (!GraphicsEnvironment.isHeadless()) { Hacks.keepCurrentProjectNameUpdated(); } } - public void close() { - OpenProjectList.shutdown(); - // Just in case something was modified outside the usual customizer dialog: - try { - ProjectManager.getDefault().saveAllProjects(); - } catch (IOException e) { - ErrorManager.getDefault().notify(e); + @ServiceProvider(path="Modules/Stop", service=Runnable.class) + public static final class Down implements Runnable { + @Override + public void run() { + OpenProjectList.shutdown(); + // Just in case something was modified outside the usual customizer dialog: + try { + ProjectManager.getDefault().saveAllProjects(); + } catch (IOException e) { + ErrorManager.getDefault().notify(e); + } } } - } diff -r 54345f481aa5 properties.syntax/src/org/netbeans/modules/properties/syntax/RestoreColoring.java --- a/properties.syntax/src/org/netbeans/modules/properties/syntax/RestoreColoring.java Tue Mar 13 11:10:02 2012 +0100 +++ b/properties.syntax/src/org/netbeans/modules/properties/syntax/RestoreColoring.java Tue Mar 13 11:42:45 2012 +0100 @@ -56,6 +56,7 @@ * * @author Petr Jiricka, Libor Kramolis, Jesse Glick */ +// XXX: Rewrite LocalizerSupport to obtain the registration via Lookup public class RestoreColoring extends ModuleInstall { /** Localizer passed to editor. */ diff -r 54345f481aa5 spi.debugger.ui/src/org/netbeans/modules/debugger/ui/DebuggerModule.java --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/DebuggerModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/DebuggerModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -44,19 +44,18 @@ package org.netbeans.modules.debugger.ui; -import org.openide.modules.ModuleInstall; +import java.util.concurrent.Callable; +import org.openide.util.lookup.ServiceProvider; /** * * @author Martin Entlicher */ -public class DebuggerModule extends ModuleInstall { - - /** Creates a new instance of DebuggerModule */ - public DebuggerModule() { - } - - public boolean closing() { +@ServiceProvider(path="Modules/Stop", service=Callable.class) +public class DebuggerModule implements Callable { + /** called on closing */ + @Override + public Boolean call() { DebuggerManagerListener.closeDebuggerUI(); return true; } diff -r 54345f481aa5 spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsModule.java --- a/spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -44,16 +44,17 @@ package org.netbeans.modules.editor.hints; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Module installation class for HintsModule. * * @author Jan Lahoda */ -public final class HintsModule extends ModuleInstall { - - public void restored () { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public final class HintsModule implements Runnable { + @Override + public void run() { //create HintsUI (which registers some listeners) HintsUI.getDefault(); } diff -r 54345f481aa5 spi.palette/src/org/netbeans/spi/palette/PaletteModule.java --- a/spi.palette/src/org/netbeans/spi/palette/PaletteModule.java Tue Mar 13 11:10:02 2012 +0100 +++ b/spi.palette/src/org/netbeans/spi/palette/PaletteModule.java Tue Mar 13 11:42:45 2012 +0100 @@ -44,29 +44,19 @@ package org.netbeans.spi.palette; -import org.openide.modules.ModuleInstall; -import org.openide.windows.WindowManager; +import org.openide.util.lookup.ServiceProvider; /** * * @author S. Aubrecht * @since 1.10 */ -public class PaletteModule extends ModuleInstall { - - /** Creates a new instance of ModuleInstall */ - public PaletteModule() { - } - +@ServiceProvider(path="Modules/UIReady", service=Runnable.class) +public class PaletteModule implements Runnable { @Override - public void restored() { - super.restored(); - WindowManager.getDefault().invokeWhenUIReady( new Runnable() { - public void run() { - //start listening to activated TopComponents and Nodes - //to see if palette window should be displayed - PaletteSwitch.getDefault().startListening(); - } - }); + public void run() { + //start listening to activated TopComponents and Nodes + //to see if palette window should be displayed + PaletteSwitch.getDefault().startListening(); } } diff -r 54345f481aa5 subversion/src/org/netbeans/modules/subversion/ModuleLifecycleManager.java --- a/subversion/src/org/netbeans/modules/subversion/ModuleLifecycleManager.java Tue Mar 13 11:10:02 2012 +0100 +++ b/subversion/src/org/netbeans/modules/subversion/ModuleLifecycleManager.java Tue Mar 13 11:42:45 2012 +0100 @@ -72,6 +72,7 @@ * @author Petr Kuzel * @author Maros Sandor */ +// XXX: No longer needed, I guess public final class ModuleLifecycleManager extends ModuleInstall implements ErrorHandler, EntityResolver { static final String [] vcsGenericModules = { diff -r 54345f481aa5 timers/src/org/netbeans/modules/timers/Install.java --- a/timers/src/org/netbeans/modules/timers/Install.java Tue Mar 13 11:10:02 2012 +0100 +++ b/timers/src/org/netbeans/modules/timers/Install.java Tue Mar 13 11:42:45 2012 +0100 @@ -57,13 +57,14 @@ import org.netbeans.api.editor.EditorRegistry; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * * @author nenik */ -public class Install extends ModuleInstall { +@ServiceProvider(path="Modules/UIReady", service=Runnable.class) +public class Install implements Runnable { static final boolean ENABLED; @@ -80,7 +81,7 @@ private static String INSTANCES = "Important instances"; - public @Override void restored() { + public @Override void run() { if (!ENABLED) { return ; } diff -r 54345f481aa5 versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ModuleLifecycleManager.java --- a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ModuleLifecycleManager.java Tue Mar 13 11:10:02 2012 +0100 +++ b/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ModuleLifecycleManager.java Tue Mar 13 11:42:45 2012 +0100 @@ -73,6 +73,7 @@ * @author Petr Kuzel * @author Maros Sandor */ +// XXX: No longer needed I guess public final class ModuleLifecycleManager extends ModuleInstall implements ErrorHandler, EntityResolver { static final String [] vcsGenericModules = { diff -r 54345f481aa5 webpreview/src/org/netbeans/modules/webpreview/Installer.java --- a/webpreview/src/org/netbeans/modules/webpreview/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/webpreview/src/org/netbeans/modules/webpreview/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -42,23 +42,26 @@ package org.netbeans.modules.webpreview; import org.netbeans.api.editor.EditorRegistry; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Web Preview module install */ -public class Installer extends ModuleInstall { +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class Installer implements Runnable { @Override - public void restored() { + public void run() { EditorRegistry.addPropertyChangeListener(new WebPreviewControler()); } - @Override - public boolean closing() { - // we don't want the browser to open on IDE startup - WebPreviewTopComponent.findInstance().close(); - return super.closing(); + @ServiceProvider(path = "Modules/Stop", service = Runnable.class) + public static final class Down implements Runnable { + @Override + public void run() { + // we don't want the browser to open on IDE startup + WebPreviewTopComponent.findInstance().close(); + } } } diff -r 54345f481aa5 websvc.jaxrpc/src/org/netbeans/modules/websvc/jaxrpc/Installer.java --- a/websvc.jaxrpc/src/org/netbeans/modules/websvc/jaxrpc/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/websvc.jaxrpc/src/org/netbeans/modules/websvc/jaxrpc/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -46,6 +46,7 @@ import java.io.File; import java.io.IOException; +import java.util.MissingResourceException; import org.netbeans.api.project.ProjectManager; import org.netbeans.modules.websvc.api.client.WebServicesClientSupport; import org.netbeans.spi.project.support.ant.EditableProperties; @@ -54,42 +55,43 @@ import org.openide.ErrorManager; import org.openide.NotifyDescriptor; import org.openide.modules.InstalledFileLocator; -import org.openide.modules.ModuleInstall; import org.openide.util.NbBundle; +import org.openide.util.lookup.ServiceProvider; /** * @author Peter Williams */ -public class Installer extends ModuleInstall { - - public Installer() { - super(); +@ServiceProvider(path="Modules/Start", service=Runnable.class) +public class Installer implements Runnable { + @Override + public void run() { + if (ProjectManager.mutex().isWriteAccess()) { + init(); + } else { + ProjectManager.mutex().postWriteRequest(this); + } } - - public void restored() { - ProjectManager.mutex().postWriteRequest(new Runnable(){ - public void run() { - try { - EditableProperties ep = PropertyUtils.getGlobalProperties(); - boolean changed = false; - File wsclient_update = InstalledFileLocator.getDefault().locate("ant/extra/wsclientuptodate.jar", null, false); - if (wsclient_update == null) { - String msg = NbBundle.getMessage(Installer.class, "MSG_WSClientUpdateMissing"); - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); - } else { - String wsclient_update_old = ep.getProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH); - if (wsclient_update_old == null || !wsclient_update_old.equals(wsclient_update.toString())) { - ep.setProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH, wsclient_update.toString()); - changed = true; - } - } - if (changed) { - PropertyUtils.putGlobalProperties(ep); - } - } catch (IOException ioe) { - ErrorManager.getDefault().notify(ioe); + + private void init() throws MissingResourceException { + try { + EditableProperties ep = PropertyUtils.getGlobalProperties(); + boolean changed = false; + File wsclient_update = InstalledFileLocator.getDefault().locate("ant/extra/wsclientuptodate.jar", null, false); + if (wsclient_update == null) { + String msg = NbBundle.getMessage(Installer.class, "MSG_WSClientUpdateMissing"); + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); + } else { + String wsclient_update_old = ep.getProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH); + if (wsclient_update_old == null || !wsclient_update_old.equals(wsclient_update.toString())) { + ep.setProperty(WebServicesClientSupport.WSCLIENTUPTODATE_CLASSPATH, wsclient_update.toString()); + changed = true; } } - }); + if (changed) { + PropertyUtils.putGlobalProperties(ep); + } + } catch (IOException ioe) { + ErrorManager.getDefault().notify(ioe); + } } } diff -r 54345f481aa5 websvc.manager/src/org/netbeans/modules/websvc/manager/WebServiceModuleInstaller.java --- a/websvc.manager/src/org/netbeans/modules/websvc/manager/WebServiceModuleInstaller.java Tue Mar 13 11:10:02 2012 +0100 +++ b/websvc.manager/src/org/netbeans/modules/websvc/manager/WebServiceModuleInstaller.java Tue Mar 13 11:42:45 2012 +0100 @@ -45,22 +45,19 @@ package org.netbeans.modules.websvc.manager; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; // This is here just to persist the snippets -public class WebServiceModuleInstaller extends ModuleInstall { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class WebServiceModuleInstaller implements Runnable { @Override - public void close() { + public void run() { /** * Persist the Webservice meta data in the user's directory. */ WebServicePersistenceManager persistenceManager = new WebServicePersistenceManager(); persistenceManager.save(); } - - public void uninstalled() { - close(); - } -} +} diff -r 54345f481aa5 welcome/src/org/netbeans/modules/welcome/Installer.java --- a/welcome/src/org/netbeans/modules/welcome/Installer.java Tue Mar 13 11:10:02 2012 +0100 +++ b/welcome/src/org/netbeans/modules/welcome/Installer.java Tue Mar 13 11:42:45 2012 +0100 @@ -31,7 +31,7 @@ package org.netbeans.modules.welcome; import java.util.Set; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; import org.openide.windows.Mode; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; @@ -41,10 +41,10 @@ /** * Checks the feedback survey. */ -public class Installer extends ModuleInstall implements Runnable { +@ServiceProvider(path="Modules/UIReady", service=Runnable.class) +public class Installer implements Runnable { - @Override public void restored() { - WindowManager.getDefault().invokeWhenUIReady(this); + private void initListener() { WindowManager.getDefault().addWindowSystemListener( new WindowSystemListener() { @Override @@ -90,6 +90,7 @@ @Override public void run() { + initListener(); FeedbackSurvey.start(); } } diff -r 54345f481aa5 xml.tax/src/org/netbeans/modules/xml/tax/TAXModuleInstall.java --- a/xml.tax/src/org/netbeans/modules/xml/tax/TAXModuleInstall.java Tue Mar 13 11:10:02 2012 +0100 +++ b/xml.tax/src/org/netbeans/modules/xml/tax/TAXModuleInstall.java Tue Mar 13 11:42:45 2012 +0100 @@ -55,6 +55,8 @@ * * @author Libor Kramolis */ +// XXX: Modifications to bean search path should not run in parallel, otherwise +// we risk race condition with others (Form?) public class TAXModuleInstall extends ModuleInstall { private static final String BEANINFO_PATH = "org.netbeans.modules.xml.tax.beans.beaninfo"; // NOI18N diff -r 54345f481aa5 xml/src/org/netbeans/modules/xml/CoreModuleInstall.java --- a/xml/src/org/netbeans/modules/xml/CoreModuleInstall.java Tue Mar 13 11:10:02 2012 +0100 +++ b/xml/src/org/netbeans/modules/xml/CoreModuleInstall.java Tue Mar 13 11:42:45 2012 +0100 @@ -45,16 +45,17 @@ package org.netbeans.modules.xml; import org.netbeans.modules.xml.actions.InputOutputReporter; -import org.openide.modules.ModuleInstall; +import org.openide.util.lookup.ServiceProvider; /** * Module installation class for core module. * * @author Libor Kramolis */ -public class CoreModuleInstall extends ModuleInstall { - - public void uninstalled() { +@ServiceProvider(path="Modules/Stop", service=Runnable.class) +public class CoreModuleInstall implements Runnable { + @Override + public void run() { InputOutputReporter.releaseAllAnnotations(); } }