public class Activator extends AbstractUIPlugin
| Modifier and Type | Field and Description |
|---|---|
static String |
PLUGIN_ID |
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME| Constructor and Description |
|---|
Activator()
The constructor
|
| Modifier and Type | Method and Description |
|---|---|
static Shell |
getActiveWorkbenchShell() |
static IWorkbenchWindow |
getActiveWorkbenchWindow() |
static Activator |
getDefault()
Returns the shared instance
|
protected void |
initializeImageRegistry(ImageRegistry registry)
Initializes an image registry with images which are frequently used by the
plugin.
|
static void |
logException(Throwable e) |
static void |
logException(Throwable e,
String title,
String message) |
void |
start(org.osgi.framework.BundleContext context)
The
AbstractUIPlugin implementation of this Plugin
method refreshes the plug-in actions. |
void |
stop(org.osgi.framework.BundleContext context)
The
AbstractUIPlugin implementation of this Plugin
method saves this plug-in's preference and dialog stores and shuts down
its image registry (if they are in use). |
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startupfind, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toStringpublic static final String PLUGIN_ID
public Activator()
public void start(org.osgi.framework.BundleContext context) throws Exception
AbstractUIPluginAbstractUIPlugin implementation of this Plugin
method refreshes the plug-in actions. Subclasses may extend this method,
but must send super first.
Starts up this plug-in.
This method should be overridden in subclasses that need to do something when this plug-in is started. Implementors should call the inherited method at the first possible point to ensure that any system requirements can be met.
If this method throws an exception, it is taken as an indication that plug-in initialization has failed; as a result, the plug-in will not be activated; moreover, the plug-in will be marked as disabled and ineligible for activation for the duration.
Note 1: This method is automatically invoked by the platform the first time any code in the plug-in is executed.
Note 2: This method is intended to perform simple initialization of the plug-in environment. The platform may terminate initializers that do not complete in a timely fashion.
Note 3: The class loader typically has monitors acquired during invocation of this method. It is strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms, as this would lead to deadlock vulnerability.
Note 4: The supplied bundle context represents the plug-in to the OSGi framework. For security reasons, it is strongly recommended that this object should not be divulged.
Note 5: This method and the Plugin.stop(BundleContext) may be called from separate threads,
but the OSGi framework ensures that both methods will not be called simultaneously.
start in interface org.osgi.framework.BundleActivatorstart in class AbstractUIPlugincontext - the bundle context for this plug-inException - if this plug-in did not start up properlypublic void stop(org.osgi.framework.BundleContext context) throws Exception
AbstractUIPluginAbstractUIPlugin implementation of this Plugin
method saves this plug-in's preference and dialog stores and shuts down
its image registry (if they are in use). Subclasses may extend this
method, but must send super last. A try-finally statement should
be used where necessary to ensure that super.stop() is
always done.
Stops this plug-in.
This method should be re-implemented in subclasses that need to do something when the plug-in is shut down. Implementors should call the inherited method as late as possible to ensure that any system requirements can be met.
Plug-in shutdown code should be robust. In particular, this method should always make an effort to shut down the plug-in. Furthermore, the code should not assume that the plug-in was started successfully.
Note 1: If a plug-in has been automatically started, this method will be automatically invoked by the platform when the platform is shut down.
Note 2: This method is intended to perform simple termination of the plug-in environment. The platform may terminate invocations that do not complete in a timely fashion.
Note 3: The supplied bundle context represents the plug-in to the OSGi framework. For security reasons, it is strongly recommended that this object should not be divulged.
Note 4: This method and the Plugin.start(BundleContext) may be called from separate threads,
but the OSGi framework ensures that both methods will not be called simultaneously.
stop in interface org.osgi.framework.BundleActivatorstop in class AbstractUIPlugincontext - the bundle context for this plug-inException - if this method fails to shut down this plug-inpublic static Activator getDefault()
protected void initializeImageRegistry(ImageRegistry registry)
AbstractUIPluginThe image registry contains the images used by this plug-in that are very frequently used and so need to be globally shared within the plug-in. Since many OSs have a severe limit on the number of images that can be in memory at any given time, each plug-in should only keep a small number of images in its registry.
Implementors should create a JFace image descriptor for each frequently used image. The descriptors describe how to create/find the image should it be needed. The image described by the descriptor is not actually allocated until someone retrieves it.
Subclasses may override this method to fill the image registry.
initializeImageRegistry in class AbstractUIPluginregistry - the registry to initializeAbstractUIPlugin.getImageRegistry()public static Shell getActiveWorkbenchShell()
public static IWorkbenchWindow getActiveWorkbenchWindow()
public static void logException(Throwable e, String title, String message)
public static void logException(Throwable e)