Previous Page
Next Page

20.10. Early Startup

As discussed in Section 3.4.2, Early plug-in startup, on page 114, use the org.eclipse.ui.startup extension point to ensure that your plug-in will be started when Eclipse starts. Doing so should not be done lightly because it defeats the Eclipse lazy-loading mechanism, causing Eclipse to always load and execute your plug-in thus consuming precious memory and startup time. If you must do this, then keep your early startup plug-in small so that it takes up less memory and executes quickly when it starts.

20.10.1. Managing early startup

Eclipse does not provide a mechanism for programmatically specifying whether a plug-in should be started immediately when it is launched. If you have one or more plug-ins that may need early startup, then consider creating a small plug-in that manages early startup (see Figure 20-6). For example, if you have a large plug-in that only needs early startup if the user has enabled some functionality, then create a small early startup plug-in that determines whether that functionality has been enabled, and if so, starts the larger plug-in.

Figure 20-6. Plug-in for managing early startup of other plug-ins.

20.10.2. Disabling early startup

The user can disable early plug-in startup using the General > Startup and Shutdown preference page. If you have added an early startup extension, then your plug-in will appear in this list, and the user can disable its startup. You can detect this situation and warn the user that some of your plug-in's functionality will be compromised.

public static boolean isEarlyStartupDisabled() {
   String plugins = PlatformUI.getPreferenceStore().getString(
       * Copy constant out of internal Eclipse interface
       * IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP
       * so that we are not accessing internal type.
   return plugins.indexOf(FavortesPlugin.ID) != -1;

Previous Page
Next Page