Class PluginActivator
- java.lang.Object
- org.eclipse.core.runtime.Plugin
- org.eclipse.ui.plugin.AbstractUIPlugin
- com.iizigo.term.PluginActivator
- All Implemented Interfaces:
IPluginInitialize,IModuleDisposeListener,IModulePerspective,IProjectListener,IServerApplicationSetupProvider,org.osgi.framework.BundleActivator
public class PluginActivator extends org.eclipse.ui.plugin.AbstractUIPlugin implements IPluginInitialize, IModulePerspective, IProjectListener, IModuleDisposeListener, IServerApplicationSetupProvider
The activator class controls the plug-in life cycle.
Field Summary
Fields Modifier and Type Field Description static java.awt.ImageawtImageErrorAWT image: error sign.static java.awt.ImageawtImageWarningAWT image: warning sign.static java.lang.StringPLUGIN_IDThe plug-in IDstatic PropertyEditorSetupsetupCaptureThe resource setup: capture.static PropertyEditorSetupsetupMonitorThe resource setup: server monitor.static PropertyEditorSetupsetupRecordingThe resource setup: recording.static PropertyEditorSetupsetupScreenThe resource setup: screen.Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
Fields inherited from interface com.iizix.server.prop.IServerApplicationSetupProvider
EMPTY_SETUP
Constructor Summary
Constructors Constructor Description PluginActivator()The constructor
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateNewWizards(java.util.ArrayList<org.eclipse.ui.menus.CommandContributionItem> newWizards)Call to fill the array with "New Wizards".static PluginActivatorgetDefault()Returns the default instance, required for the IIZI Plugin framework.static org.eclipse.jface.resource.ImageDescriptorgetIcon(java.lang.String fileName)Returns an image descriptor for the image file at the given plug-in relative path.static PluginActivatorgetInstance()Returns the shared instance.ModuleFolderPropCnrgetModuleContainer(ModuleModel model)Gets the Module Folder container for the Terminal plug-in.static PluginDescriptorgetPluginDescriptor()Gets the IIZI PluginDescriptor.IServerApplicationSetup[]getServerApplicationSetupInstances(PropCnr moduleRoot)Queries for instances of the IServerApplicationSetup required.EditorSessionsPropgetSessionsContainer()Gets the Sessions property container.voidinitializeModule(ModuleModel model)Initializes the plug-in after the Module project has been loaded.java.awt.ImageloadAWTIcon(java.lang.String fn)Loads an AWT image.static org.eclipse.swt.graphics.ImageloadIcon(java.lang.Class<? extends GProp<?>> propClass, java.lang.String fn)Load an image for this plugin.static org.eclipse.swt.graphics.ImageloadIcon(java.lang.String fn)Load an image for this plugin.voidonInitialLayout(org.eclipse.ui.IPageLayout layout, org.eclipse.ui.IFolderLayout folder, org.eclipse.ui.IFolderLayout outlineFolder, org.eclipse.ui.IFolderLayout outputfolder)Called when the Module perspective has completed initializing itself with IIZI-related items.voidonModuleProjectDeconfigured(ModuleModel model)Called when a Module project is de-configured from this plug-in.voidonModuleProjectDisposed(ModuleModel model)Called when a Module project is disposed of.voidonProjectChanged(org.eclipse.core.resources.IResourceDelta delta)Called during workspace change to inform the plug-in of a project change.voidregisterPlugin()Registers this plug-in with iiziGo.java.lang.ExceptionsaveSessions()Saves the sessions file.voidstart(org.osgi.framework.BundleContext context)Starts up the Terminal plug-in bundle.static voidstartupUI()Method to call as soon as possible to load images and other UI stuff.voidstop(org.osgi.framework.BundleContext context)Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
Field Detail
PLUGIN_ID
public static final java.lang.String PLUGIN_ID
The plug-in ID- See Also:
- Constant Field Values
setupScreen
public static final PropertyEditorSetup setupScreen
The resource setup: screen.
setupCapture
public static final PropertyEditorSetup setupCapture
The resource setup: capture.
setupRecording
public static final PropertyEditorSetup setupRecording
The resource setup: recording.
setupMonitor
public static final PropertyEditorSetup setupMonitor
The resource setup: server monitor.
awtImageWarning
public static java.awt.Image awtImageWarning
AWT image: warning sign.
awtImageError
public static java.awt.Image awtImageError
AWT image: error sign.
Method Detail
getInstance
public static PluginActivator getInstance()
Returns the shared instance.- Returns:
- The shared instance.
getDefault
public static PluginActivator getDefault()
Returns the default instance, required for the IIZI Plugin framework.- Returns:
- The shared instance.
start
public void start(org.osgi.framework.BundleContext context) throws java.lang.ExceptionStarts up the Terminal plug-in bundle.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 stop(BundleContext) may be called from separate threads, but the OSGi framework ensures that both methods will not be called simultaneously.
- Specified by:
startin interfaceorg.osgi.framework.BundleActivator- Overrides:
startin classorg.eclipse.ui.plugin.AbstractUIPlugin- Parameters:
context- The bundle context.- Throws:
java.lang.Exception- For errors in loading the IIZI properties framework.
registerPlugin
public void registerPlugin() throws org.eclipse.core.runtime.CoreExceptionRegisters this plug-in with iiziGo. This method is called from IIZI Designer when an application requires the plug-in. The plug-in should check if registration already has been done, and if so, skip the registration. This is required due to the OSGi framework threading at startup of Eclipse.- Specified by:
registerPluginin interfaceIPluginInitialize- Throws:
org.eclipse.core.runtime.CoreException- For registration failures.
initializeModule
public void initializeModule(ModuleModel model) throws org.eclipse.core.runtime.CoreException
Initializes the plug-in after the Module project has been loaded.- Specified by:
initializeModulein interfaceIPluginInitialize- Parameters:
model- The Module project.- Throws:
org.eclipse.core.runtime.CoreException- For initialization failures.
onModuleProjectDisposed
public void onModuleProjectDisposed(ModuleModel model)
Called when a Module project is disposed of.- Specified by:
onModuleProjectDisposedin interfaceIModuleDisposeListener
onModuleProjectDeconfigured
public void onModuleProjectDeconfigured(ModuleModel model)
Called when a Module project is de-configured from this plug-in.- Specified by:
onModuleProjectDeconfiguredin interfaceIModuleDisposeListener
getModuleContainer
public ModuleFolderPropCnr getModuleContainer(ModuleModel model)
Gets the Module Folder container for the Terminal plug-in.- Parameters:
model- The module model.- Returns:
- The ModuleFolder for the type, null if defined for the project.
createNewWizards
public void createNewWizards(java.util.ArrayList<org.eclipse.ui.menus.CommandContributionItem> newWizards)
Call to fill the array with "New Wizards".- Specified by:
createNewWizardsin interfaceIPluginInitialize- Parameters:
newWizards- Array of New Wizard's.
stop
public void stop(org.osgi.framework.BundleContext context) throws java.lang.Exception- Specified by:
stopin interfaceorg.osgi.framework.BundleActivator- Overrides:
stopin classorg.eclipse.ui.plugin.AbstractUIPlugin- Throws:
java.lang.Exception
saveSessions
public java.lang.Exception saveSessions()
Saves the sessions file.- Returns:
- An error for error, otherwise null.
getSessionsContainer
public EditorSessionsProp getSessionsContainer()
Gets the Sessions property container.- Returns:
- The sessions property.
getPluginDescriptor
public static PluginDescriptor getPluginDescriptor()
Gets the IIZI PluginDescriptor.- Returns:
- The singleton.
startupUI
public static void startupUI()
Method to call as soon as possible to load images and other UI stuff. If called from another thread than SWT, a syncExec is done.
loadAWTIcon
public java.awt.Image loadAWTIcon(java.lang.String fn)
Loads an AWT image.- Parameters:
fn- The file name, relative the "icons" directory for the plug-in.- Returns:
- The AWT image.
loadIcon
public static org.eclipse.swt.graphics.Image loadIcon(java.lang.String fn)
Load an image for this plugin.- Parameters:
fn- The file name, relative the "icons" directory for the plug-in.- Returns:
- null if not found or plugin is not started.
loadIcon
public static org.eclipse.swt.graphics.Image loadIcon(java.lang.Class<? extends GProp<?>> propClass, java.lang.String fn)
Load an image for this plugin.- Parameters:
propClass- The property class assigned.fn- The file name, relative the "icons" directory for the plug-in.- Returns:
- null if not found or plugin is not started.
getIcon
public static org.eclipse.jface.resource.ImageDescriptor getIcon(java.lang.String fileName)
Returns an image descriptor for the image file at the given plug-in relative path.- Parameters:
fileName- The image file name inside "icons".- Returns:
- the image descriptor.
onInitialLayout
public void onInitialLayout(org.eclipse.ui.IPageLayout layout, org.eclipse.ui.IFolderLayout folder, org.eclipse.ui.IFolderLayout outlineFolder, org.eclipse.ui.IFolderLayout outputfolder)Called when the Module perspective has completed initializing itself with IIZI-related items. Once the plug-ins complete their processing, additional Java and Java-EE items are added.- Specified by:
onInitialLayoutin interfaceIModulePerspective- Parameters:
layout- The page layout.folder- The folder area, left side.outlineFolder- The outline folder on the right side, perhaps null (be careful!).outputfolder- The output folder area, bottom placement.
onProjectChanged
public void onProjectChanged(org.eclipse.core.resources.IResourceDelta delta)
Called during workspace change to inform the plug-in of a project change.- Specified by:
onProjectChangedin interfaceIProjectListener- Parameters:
delta- The resource delta.
getServerApplicationSetupInstances
public IServerApplicationSetup[] getServerApplicationSetupInstances(PropCnr moduleRoot)
Queries for instances of the IServerApplicationSetup required. This call makes it possible to redirect the query to other properties. Most plug-ins would have a single instance.- Specified by:
getServerApplicationSetupInstancesin interfaceIServerApplicationSetupProvider- Parameters:
moduleRoot- The root of the Module application.- Returns:
- The IServerApplicationSetup instances that is participating in the setup.