org.ocleditor.internal.core
Class OclEditorPlugin

java.lang.Object
  extended byorg.eclipse.core.runtime.Plugin
      extended byorg.eclipse.ui.plugin.AbstractUIPlugin
          extended byorg.ocleditor.internal.core.OclEditorPlugin
All Implemented Interfaces:
org.osgi.framework.BundleActivator

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

The main plugin class to be used in the desktop.

Also handles the communication with plugins that extends this plugin. E.g. Parser and ParseListener.

Also handles adding/removing the OCL nature/builder.


Field Summary
 
Fields inherited from class org.eclipse.core.runtime.Plugin
PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
 
Constructor Summary
OclEditorPlugin(org.eclipse.core.runtime.IPluginDescriptor descriptor)
          The standard constructor.
 
Method Summary
 void addOclNature(org.eclipse.core.resources.IProject project)
          Adds the OCL nature to the specified project.
 void addParseListener(IOclParseRunListener listener)
          Manually add a parse listener.
 void fireParseFailed(IOclParserError[] errors)
          Parse listeners are informed about the test failed.
 void fireParseFinished()
          Parse listeners are informed about the test finished.
 void fireParseStarted(int type)
          Parse listeners are informed about the test started.
static org.eclipse.ui.IWorkbenchWindow getActiveWorkbenchWindow()
           
static OclEditorPlugin getDefault()
          Returns the shared instance.
 IOclParser getOclParser()
          Returns the plugin's OCL parser.
 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.
static org.eclipse.core.resources.IWorkspace getWorkspace()
          Returns the workspace instance.
 void removeOclNature(org.eclipse.core.resources.IProject project)
          Removes the OCL nature from the specified project.
 void removeParseListener(IOclParseRunListener listener)
          Remove a parse listener.
 
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, shutdown, startup
 
Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, start, stop, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OclEditorPlugin

public OclEditorPlugin(org.eclipse.core.runtime.IPluginDescriptor descriptor)
The standard constructor.

Parameters:
descriptor - contains information from the plugin's manifest file (plugin.xml).
Method Detail

getDefault

public static OclEditorPlugin getDefault()
Returns the shared instance.


getWorkspace

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


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.


getResourceBundle

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


getOclParser

public IOclParser getOclParser()
Returns the plugin's OCL parser. If more than one parser is registered then the first one is taken.


addParseListener

public void addParseListener(IOclParseRunListener listener)
Manually add a parse listener.

Parameters:
listener -

removeParseListener

public void removeParseListener(IOclParseRunListener listener)
Remove a parse listener.

Parameters:
listener -

fireParseStarted

public void fireParseStarted(int type)
Parse listeners are informed about the test started.

Parameters:
type - can be IOclParseRunListener.SYNTAXCHECK or IOclParseRunListener.TYPECHECK.

fireParseFinished

public void fireParseFinished()
Parse listeners are informed about the test finished.


fireParseFailed

public void fireParseFailed(IOclParserError[] errors)
Parse listeners are informed about the test failed.

Parameters:
errors - errors that occured.

addOclNature

public void addOclNature(org.eclipse.core.resources.IProject project)
                  throws org.eclipse.core.runtime.CoreException
Adds the OCL nature to the specified project.

Parameters:
project -
Throws:
org.eclipse.core.runtime.CoreException

removeOclNature

public void removeOclNature(org.eclipse.core.resources.IProject project)
                     throws org.eclipse.core.runtime.CoreException
Removes the OCL nature from the specified project.

Parameters:
project -
Throws:
org.eclipse.core.runtime.CoreException

getActiveWorkbenchWindow

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