za.co.bluesphere.sens.internal.ui
Class SENSWorkbenchAdvisor

java.lang.Object
  extended by org.eclipse.ui.application.WorkbenchAdvisor
      extended by za.co.bluesphere.sens.internal.ui.SENSWorkbenchAdvisor

public class SENSWorkbenchAdvisor
extends org.eclipse.ui.application.WorkbenchAdvisor

Public base class for configuring the workbench.

Note that the workbench advisor object is created in advance of creating the workbench. However, by the time the workbench starts calling methods on this class, PlatformUI.getWorkbench is guaranteed to have been properly initialized.

Example of creating and running a workbench (in an IPlatformRunnable):

 
 public class MyApplication implements IPlatformRunnable {
   public Object run(Object args) {
     WorkbenchAdvisor workbenchAdvisor = new MyWorkbenchAdvisor();
     Display display = PlatformUI.createDisplay();
     int returnCode = PlatformUI.createAndRunWorkbench(display, workbenchAdvisor);
     if (returnCode == PlatformUI.RETURN_RESTART) {
        return IPlatformRunnable.EXIT_RESTART;
     } else {
        return IPlatformRunnable.EXIT_OK;
   }
 }
 
 

An application should declare a subclass of WorkbenchAdvisor and override methods to configure the workbench to suit the needs of the particular application.

The following advisor methods are called at strategic points in the workbench's lifecycle (all occur within the dynamic scope of the call to PlatformUI.createAndRunWorkbench):

Since:
3.0

Field Summary
 
Fields inherited from class org.eclipse.ui.application.WorkbenchAdvisor
FILL_COOL_BAR, FILL_MENU_BAR, FILL_PROXY, FILL_STATUS_LINE
 
Constructor Summary
SENSWorkbenchAdvisor()
           
 
Method Summary
 org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer)
          Creates a new workbench window advisor for configuring a new workbench window via the given workbench window configurer.
 java.lang.String getInitialWindowPerspectiveId()
          Returns the id of the perspective to use for the initial workbench window, we are stating up in the diagram prespective.
 void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer)
           
 
Methods inherited from class org.eclipse.ui.application.WorkbenchAdvisor
createWindowContents, eventLoopException, eventLoopIdle, fillActionBars, getDefaultPageInput, getMainPreferencePageId, getWorkbenchConfigurer, internalBasicInitialize, isApplicationMenu, openIntro, openWindows, postShutdown, postStartup, postWindowClose, postWindowCreate, postWindowOpen, postWindowRestore, preShutdown, preStartup, preWindowOpen, preWindowShellClose, restoreState, saveState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SENSWorkbenchAdvisor

public SENSWorkbenchAdvisor()
Method Detail

initialize

public void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer)
Overrides:
initialize in class org.eclipse.ui.application.WorkbenchAdvisor

getInitialWindowPerspectiveId

public java.lang.String getInitialWindowPerspectiveId()
Returns the id of the perspective to use for the initial workbench window, we are stating up in the diagram prespective.

This method is called during startup when the workbench is creating the first new window.

If the user already had a perspective from last time this method wont be called, it is only for the FIRST time the SENS aplication is run.

Specified by:
getInitialWindowPerspectiveId in class org.eclipse.ui.application.WorkbenchAdvisor
Returns:
the id of the perspective for the initial window, or null if no initial perspective should be shown

createWorkbenchWindowAdvisor

public org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer)
Creates a new workbench window advisor for configuring a new workbench window via the given workbench window configurer. Clients should override to provide their own window configurer. This method replaces all the other window and action bar lifecycle methods on the workbench advisor.

The default implementation creates a window advisor that calls back to the legacy window and action bar lifecycle methods on the workbench advisor, for backwards compatibility with 3.0.

Overrides:
createWorkbenchWindowAdvisor in class org.eclipse.ui.application.WorkbenchAdvisor
Parameters:
configurer - the workbench window configurer
Returns:
a new workbench window advisor
Since:
3.1