org.eclipse.jst.pagedesigner
Class PDPlugin

java.lang.Object
  extended by org.eclipse.core.runtime.Plugin
      extended by org.eclipse.ui.plugin.AbstractUIPlugin
          extended by org.eclipse.jst.pagedesigner.PDPlugin
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public class PDPlugin
extends org.eclipse.ui.plugin.AbstractUIPlugin

The main plugin class to be used in the desktop.


Field Summary
 
Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
 
Constructor Summary
PDPlugin()
          The constructor.
 
Method Summary
static org.eclipse.ui.IWorkbenchPage getActivePage()
          Returns the active workbench page.
static org.eclipse.swt.widgets.Shell getActiveWorkbenchShell()
          Returns the active workbench Shell.
static org.eclipse.ui.IWorkbenchWindow getActiveWorkbenchWindow()
          Returns the active workbench window.
static org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts getAlerts()
          get the alerts objects associated with this plugin for alerting the user.
static org.eclipse.core.resources.IProject getCurrentProject()
          Returns current active project.
static PDPlugin getDefault()
          Returns the shared instance.
static org.eclipse.swt.widgets.Display getDisplay()
          Returns the active display.
 java.io.File getFile(java.lang.String file)
           
 org.eclipse.swt.graphics.Image getImage(java.lang.String name)
          Returns a shared image for the given name.
 org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String name)
          Returns a shared ImageDescriptor for the given name Note: ImageDescriptor returned from this method will be automatically disposed of when this plug-in shuts down.
static org.eclipse.core.runtime.Path getInstallLocation()
           
static org.eclipse.jst.jsf.common.ui.internal.logging.Logger getLogger(java.lang.Class theClass)
          Returns a logger for the new class using this plugin for reference.
static org.eclipse.wst.sse.core.internal.provisional.IModelManager getModelManager()
           
 java.util.ResourceBundle getPluginDecriptorBundle()
          Returns the plugin's descriptor's resource bundle,
static java.lang.String getPluginId()
          Returns this plugin's unique identifier
 java.util.Properties getProperties()
          Returns the plugin's default properties.
 java.util.ResourceBundle getResourceBundle()
          Returns the plugin's resource bundle,
static java.lang.String getResourceString(java.lang.String key)
          Returns the string from the plugin's resource bundle, or 'key' if not found.
 org.eclipse.jst.jsf.common.ui.internal.logging.Logger getRootLogger()
          Returns the plugin's root logger
static org.eclipse.swt.widgets.Display getStandardDisplay()
          Returns the standard display to be used.
static org.eclipse.core.resources.IWorkspace getWorkspace()
          Returns the workspace instance.
 java.io.InputStream readFile(java.lang.String file)
          Read a file resource.
 void start(org.osgi.framework.BundleContext context)
          This method is called upon plug-in activation
 
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, shutdown, startup, stop
 
Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDPlugin

public PDPlugin()
The constructor.

Method Detail

start

public void start(org.osgi.framework.BundleContext context)
           throws java.lang.Exception
This method is called upon plug-in activation

Specified by:
start in interface org.osgi.framework.BundleActivator
Overrides:
start in class org.eclipse.ui.plugin.AbstractUIPlugin
Throws:
java.lang.Exception

getDefault

public static PDPlugin getDefault()
Returns the shared instance.


getAlerts

public static org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts getAlerts()
get the alerts objects associated with this plugin for alerting the user.

Returns:

getLogger

public static org.eclipse.jst.jsf.common.ui.internal.logging.Logger getLogger(java.lang.Class theClass)
Returns a logger for the new class using this plugin for reference.


getRootLogger

public org.eclipse.jst.jsf.common.ui.internal.logging.Logger getRootLogger()
Returns the plugin's root logger


getPluginId

public static java.lang.String getPluginId()
Returns this plugin's unique identifier


getResourceBundle

public java.util.ResourceBundle getResourceBundle()
Returns the plugin's resource bundle,


getResourceString

public static java.lang.String getResourceString(java.lang.String key)
Returns the string from the plugin's resource bundle, or 'key' if not found.


getPluginDecriptorBundle

public java.util.ResourceBundle getPluginDecriptorBundle()
Returns the plugin's descriptor's resource bundle,


getProperties

public java.util.Properties getProperties()
Returns the plugin's default properties. These are normally used for default preferences.


getStandardDisplay

public static org.eclipse.swt.widgets.Display getStandardDisplay()
Returns the standard display to be used. The method first checks, if the thread calling this method has an associated dispaly. If so, this display is returned. Otherwise the method returns the default display.


getWorkspace

public static org.eclipse.core.resources.IWorkspace getWorkspace()
Returns the workspace instance.


getImage

public org.eclipse.swt.graphics.Image getImage(java.lang.String name)
Returns a shared image for the given name. Image must exist in icons folder of pagedesigner plugin.

Note: Images returned from this method will be automitically disposed of when this plug-in shuts down. Callers must not dispose of these images themselves.

Parameters:
name - the image name found in /icons (with extension)
Returns:
the image, null on error or not found.

getImageDescriptor

public org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String name)
Returns a shared ImageDescriptor for the given name

Note: ImageDescriptor returned from this method will be automatically disposed of when this plug-in shuts down. Callers must not dispose of these ImageDescriptor themselves.

Parameters:
name - the ImageDescriptor name found in /icons (with extension)
Returns:
the ImageDescriptor, null on error or not found.

readFile

public java.io.InputStream readFile(java.lang.String file)
                             throws java.net.MalformedURLException,
                                    java.io.IOException
Read a file resource. The file should contain any partial path and the filename from the plugin base. The caller is responsible for closing the file.

Throws:
java.net.MalformedURLException
java.io.IOException

getFile

public java.io.File getFile(java.lang.String file)
                     throws java.net.MalformedURLException,
                            java.io.IOException
Throws:
java.net.MalformedURLException
java.io.IOException

getInstallLocation

public static org.eclipse.core.runtime.Path getInstallLocation()

getModelManager

public static org.eclipse.wst.sse.core.internal.provisional.IModelManager getModelManager()

getActiveWorkbenchWindow

public static org.eclipse.ui.IWorkbenchWindow getActiveWorkbenchWindow()
Returns the active workbench window.

Returns:
the active workbench window. this can be null but I've never seen it.

getActivePage

public static org.eclipse.ui.IWorkbenchPage getActivePage()
Returns the active workbench page. Note that the active page may not be the one that the user perceives as active in some situations so this method of obtaining the activate page should only be used if no other method is available.

Returns:
the active workbench page

getActiveWorkbenchShell

public static org.eclipse.swt.widgets.Shell getActiveWorkbenchShell()
Returns the active workbench Shell. Used for some funciton need IShell Parameter.

Returns:

getDisplay

public static org.eclipse.swt.widgets.Display getDisplay()
Returns the active display.

Returns:

getCurrentProject

public static org.eclipse.core.resources.IProject getCurrentProject()
Returns current active project.

Returns: