Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ui.internal
Class Workbench  view Workbench download Workbench.java

java.lang.Object
  extended byorg.eclipse.ui.internal.Workbench
All Implemented Interfaces:
org.eclipse.ui.IWorkbench

public final class Workbench
extends java.lang.Object
implements org.eclipse.ui.IWorkbench

The workbench class represents the top of the Eclipse user interface. Its primary responsability is the management of workbench windows, dialogs, wizards, and other workbench-related windows.

Note that any code that is run during the creation of a workbench instance should not required access to the display.

Note that this internal class changed significantly between 2.1 and 3.0. Applications that used to define subclasses of this internal class need to be rewritten to use the new workbench advisor API.


Field Summary
private  WorkbenchWindow activatedWindow
           
private  ActivityPersistanceHelper activityHelper
           
private  org.eclipse.ui.application.WorkbenchAdvisor advisor
          Advisor providing application-specific configuration and customization of the workbench.
private  org.eclipse.ui.commands.ICommandManagerListener commandManagerListener
           
private  org.eclipse.ui.contexts.IContextManagerListener contextManagerListener
           
private static java.lang.String DEFAULT_WORKBENCH_STATE_FILENAME
           
private  org.eclipse.swt.widgets.Display display
          The display used for all UI interactions with this workbench.
private  EditorHistory editorHistory
           
private  ExtensionEventHandler extensionEventHandler
          ExtensionEventHandler handles extension life-cycle events.
private static Workbench instance
          Holds onto the only instance of Workbench.
private  org.eclipse.ui.internal.intro.IntroDescriptor introDescriptor
          The descriptor for the intro extension that is valid for this workspace, null if none.
private  WorkbenchIntroManager introManager
           
private  boolean isClosing
           
private  boolean isStarting
           
private  int largeUpdates
          A count of how many large updates are going on.
private  int returnCode
          PlatformUI return code (as opposed to IPlatformRunnable return code).
private  boolean runEventLoop
           
private static org.eclipse.ui.internal.testing.WorkbenchTestable testableObject
          The testable object facade.
private static java.lang.String[] VERSION_STRING
           
private  org.eclipse.ui.IWindowListener windowListener
           
private  org.eclipse.jface.util.ListenerList windowListeners
           
private  org.eclipse.jface.window.WindowManager windowManager
           
private  org.eclipse.ui.internal.activities.ws.WorkbenchActivitySupport workbenchActivitySupport
           
private  org.eclipse.ui.internal.commands.ws.WorkbenchCommandSupport workbenchCommandSupport
           
private  WorkbenchConfigurer workbenchConfigurer
          Object for configuring the workbench.
private  org.eclipse.ui.internal.contexts.ws.WorkbenchContextSupport workbenchContextSupport
           
 
Constructor Summary
private Workbench(org.eclipse.swt.widgets.Display display, org.eclipse.ui.application.WorkbenchAdvisor advisor)
          Creates a new workbench.
 
Method Summary
 void addWindowListener(org.eclipse.ui.IWindowListener l)
          Adds a window listener.
private  boolean busyClose(boolean force)
          Closes the workbench.
private  org.eclipse.ui.IWorkbenchWindow busyOpenWorkbenchWindow(java.lang.String perspID, org.eclipse.core.runtime.IAdaptable input)
          Opens a new workbench window and page with a specific perspective.
 boolean close()
          Closes this workbench and all its open windows.
(package private)  boolean close(int returnCode, boolean force)
          Closes the workbench, returning the given return code from the run method.
static int createAndRunWorkbench(org.eclipse.swt.widgets.Display display, org.eclipse.ui.application.WorkbenchAdvisor advisor)
          Creates the workbench and associates it with the the given display and workbench advisor, and runs the workbench UI.
static org.eclipse.swt.widgets.Display createDisplay()
          Creates the Display to be used by the workbench.
protected  void fireWindowActivated(org.eclipse.ui.IWorkbenchWindow window)
          Fire window activated event.
protected  void fireWindowClosed(org.eclipse.ui.IWorkbenchWindow window)
          Fire window closed event.
protected  void fireWindowDeactivated(org.eclipse.ui.IWorkbenchWindow window)
          Fire window deactivated event.
protected  void fireWindowOpened(org.eclipse.ui.IWorkbenchWindow window)
          Fire window opened event.
private  void forceOpenPerspective()
           
private  WorkbenchWindow getActivatedWindow()
           
 org.eclipse.ui.IWorkbenchWindow getActiveWorkbenchWindow()
          Returns the currently active window for this workbench (if any).
 org.eclipse.ui.activities.IWorkbenchActivitySupport getActivitySupport()
          Returns an interface to manage activities at the workbench level.
(package private)  org.eclipse.ui.application.WorkbenchAdvisor getAdvisor()
          Returns the workbench advisor that created this workbench.
 org.eclipse.ui.commands.IWorkbenchCommandSupport getCommandSupport()
          Returns an interface to manage commands at the workbench level.
 org.eclipse.ui.contexts.IWorkbenchContextSupport getContextSupport()
          Returns an interface to manage contexts at the workbench level.
 org.eclipse.ui.IDecoratorManager getDecoratorManager()
          Returns the decorator manager.
 org.eclipse.core.runtime.IAdaptable getDefaultPageInput()
          Returns the default workbench window page input.
 java.lang.String getDefaultPerspectiveId()
          Returns the default perspective id.
 org.eclipse.swt.widgets.Display getDisplay()
          Returns the display for this workbench.
 java.lang.String[] getEarlyActivatedPlugins()
          Returns an array with the ids of all plugins that extend the org.eclipse.ui.startup extension point.
protected  EditorHistory getEditorHistory()
           
 org.eclipse.ui.IEditorRegistry getEditorRegistry()
          Returns the editor registry for the workbench.
 org.eclipse.ui.IElementFactory getElementFactory(java.lang.String factoryId)
          Returns the element factory with the given id.
static Workbench getInstance()
          Returns the one and only instance of the workbench, if there is one.
 org.eclipse.ui.internal.intro.IntroDescriptor getIntroDescriptor()
           
 org.eclipse.ui.intro.IIntroManager getIntroManager()
          Return the intro manager for this workbench.
 java.lang.String getMainPreferencePageId()
          Returns the id of the preference page that should be presented most prominently.
private  int getNewWindowNumber()
           
 org.eclipse.ui.IPerspectiveRegistry getPerspectiveRegistry()
          Returns the perspective registry for the workbench.
 org.eclipse.jface.preference.PreferenceManager getPreferenceManager()
          Returns the preference manager for the workbench.
 org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
          Returns the preference store for the workbench.
 java.lang.String getPresentationId()
          Return the presentation ID specified by the preference or the default ID if undefined.
 org.eclipse.ui.progress.IProgressService getProgressService()
          Returns the progress service for the workbench.
 org.eclipse.ui.ISharedImages getSharedImages()
          Returns the shared images for the workbench.
 org.eclipse.ui.themes.IThemeManager getThemeManager()
          Return the theme manager for this workbench.
(package private)  org.eclipse.jface.window.WindowManager getWindowManager()
          Returns the window manager for this workbench.
(package private)  WorkbenchConfigurer getWorkbenchConfigurer()
          Returns the unique object that applications use to configure the workbench.
(package private)  WorkbenchIntroManager getWorkbenchIntroManager()
           
private  java.io.File getWorkbenchStateFile()
           
static org.eclipse.ui.internal.testing.WorkbenchTestable getWorkbenchTestable()
          Returns the testable object facade, for use by the test harness.
 int getWorkbenchWindowCount()
          Returns the number of open main windows associated with this workbench.
 org.eclipse.ui.IWorkbenchWindow[] getWorkbenchWindows()
          Returns a list of the open main windows associated with this workbench.
 org.eclipse.ui.IWorkingSetManager getWorkingSetManager()
          Returns the working set manager for the workbench.
private  boolean init(org.eclipse.swt.widgets.Display display)
          Initializes the workbench now that the display is created.
private  void initializeApplicationColors()
          Initialize colors defined by the new colorDefinitions extension point.
private  void initializeColors()
           
private  void initializeCommandResolver()
          Establishes the relationship between JFace actions and the command manager.
private  void initializeFonts()
           
private  void initializeImages()
           
private  void initializeSingleClickOption()
           
 boolean isClosing()
          Returns true if the workbench is in the process of closing.
 boolean isRunning()
          Returns true if the workbench is running, false if it has been terminated.
(package private)  boolean isStarting()
           
 void largeUpdateEnd()
           Indicates the end of a large update within the workbench.
 void largeUpdateStart()
           Indicates the start of a large update within the workbench.
private  WorkbenchWindow newWorkbenchWindow()
           
(package private)  void openFirstTimeWindow()
           
 org.eclipse.ui.IWorkbenchWindow openWorkbenchWindow(org.eclipse.core.runtime.IAdaptable input)
          Creates and opens a new workbench window with one page.
 org.eclipse.ui.IWorkbenchWindow openWorkbenchWindow(java.lang.String perspID, org.eclipse.core.runtime.IAdaptable input)
          Creates and opens a new workbench window with one page.
private  org.eclipse.ui.XMLMemento recordWorkbenchState()
           
 void removeWindowListener(org.eclipse.ui.IWindowListener l)
          Removes a window listener.
 boolean restart()
          Closes then restarts this workbench.
(package private)  org.eclipse.core.runtime.IStatus restoreState()
           
private  org.eclipse.core.runtime.IStatus restoreState(org.eclipse.ui.IMemento memento)
           
private  void runEventLoop(org.eclipse.jface.window.Window.IExceptionHandler handler, org.eclipse.swt.widgets.Display display)
           
private  int runUI()
          Internal method for running the workbench UI.
 boolean saveAllEditors(boolean confirm)
          Save all dirty editors in the workbench.
private  boolean saveMementoToFile(org.eclipse.ui.XMLMemento memento)
           
private  org.eclipse.core.runtime.IStatus saveState(org.eclipse.ui.IMemento memento)
           
(package private)  void setActivatedWindow(WorkbenchWindow window)
           
 void setIntroDescriptor(org.eclipse.ui.internal.intro.IntroDescriptor descriptor)
          This method exists as a test hook.
 org.eclipse.ui.IWorkbenchPage showPerspective(java.lang.String perspectiveId, org.eclipse.ui.IWorkbenchWindow window)
          Shows the specified perspective to the user.
 org.eclipse.ui.IWorkbenchPage showPerspective(java.lang.String perspectiveId, org.eclipse.ui.IWorkbenchWindow window, org.eclipse.core.runtime.IAdaptable input)
          Shows the specified perspective to the user.
private  void shutdown()
           
private  void startPlugins()
           
private  void uninitializeImages()
           
private  void updateActiveWorkbenchWindowMenuManager(boolean textOnly)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_STRING

private static final java.lang.String[] VERSION_STRING

DEFAULT_WORKBENCH_STATE_FILENAME

private static final java.lang.String DEFAULT_WORKBENCH_STATE_FILENAME
See Also:
Constant Field Values

instance

private static Workbench instance
Holds onto the only instance of Workbench.


testableObject

private static org.eclipse.ui.internal.testing.WorkbenchTestable testableObject
The testable object facade.

Since:
3.0

display

private org.eclipse.swt.widgets.Display display
The display used for all UI interactions with this workbench.

Since:
3.0

windowManager

private org.eclipse.jface.window.WindowManager windowManager

activatedWindow

private WorkbenchWindow activatedWindow

editorHistory

private EditorHistory editorHistory

runEventLoop

private boolean runEventLoop

isStarting

private boolean isStarting

isClosing

private boolean isClosing

returnCode

private int returnCode
PlatformUI return code (as opposed to IPlatformRunnable return code).


windowListeners

private org.eclipse.jface.util.ListenerList windowListeners

advisor

private org.eclipse.ui.application.WorkbenchAdvisor advisor
Advisor providing application-specific configuration and customization of the workbench.

Since:
3.0

workbenchConfigurer

private WorkbenchConfigurer workbenchConfigurer
Object for configuring the workbench. Lazily initialized to an instance unique to the workbench instance.

Since:
3.0

extensionEventHandler

private ExtensionEventHandler extensionEventHandler
ExtensionEventHandler handles extension life-cycle events.


largeUpdates

private int largeUpdates
A count of how many large updates are going on. This tracks nesting of requests to disable services during a large update -- similar to the setRedraw functionality on Control. When this value becomes greater than zero, services are disabled. When this value becomes zero, services are enabled. Please see largeUpdateStart() and largeUpdateEnd().


workbenchActivitySupport

private org.eclipse.ui.internal.activities.ws.WorkbenchActivitySupport workbenchActivitySupport

workbenchCommandSupport

private org.eclipse.ui.internal.commands.ws.WorkbenchCommandSupport workbenchCommandSupport

workbenchContextSupport

private org.eclipse.ui.internal.contexts.ws.WorkbenchContextSupport workbenchContextSupport

commandManagerListener

private final org.eclipse.ui.commands.ICommandManagerListener commandManagerListener

contextManagerListener

private final org.eclipse.ui.contexts.IContextManagerListener contextManagerListener

windowListener

private final org.eclipse.ui.IWindowListener windowListener

activityHelper

private ActivityPersistanceHelper activityHelper

introManager

private WorkbenchIntroManager introManager

introDescriptor

private org.eclipse.ui.internal.intro.IntroDescriptor introDescriptor
The descriptor for the intro extension that is valid for this workspace, null if none.

Constructor Detail

Workbench

private Workbench(org.eclipse.swt.widgets.Display display,
                  org.eclipse.ui.application.WorkbenchAdvisor advisor)
Creates a new workbench.

Since:
3.0
Method Detail

getInstance

public static final Workbench getInstance()
Returns the one and only instance of the workbench, if there is one.


createAndRunWorkbench

public static final int createAndRunWorkbench(org.eclipse.swt.widgets.Display display,
                                              org.eclipse.ui.application.WorkbenchAdvisor advisor)
Creates the workbench and associates it with the the given display and workbench advisor, and runs the workbench UI. This entails processing and dispatching events until the workbench is closed or restarted.

This method is intended to be called by PlatformUI. Fails if the workbench UI has already been created.

The display passed in must be the default display.


createDisplay

public static org.eclipse.swt.widgets.Display createDisplay()
Creates the Display to be used by the workbench.


getWorkbenchTestable

public static org.eclipse.ui.internal.testing.WorkbenchTestable getWorkbenchTestable()
Returns the testable object facade, for use by the test harness.

Since:
3.0

addWindowListener

public void addWindowListener(org.eclipse.ui.IWindowListener l)
Description copied from interface: org.eclipse.ui.IWorkbench
Adds a window listener.

Specified by:
addWindowListener in interface org.eclipse.ui.IWorkbench

removeWindowListener

public void removeWindowListener(org.eclipse.ui.IWindowListener l)
Description copied from interface: org.eclipse.ui.IWorkbench
Removes a window listener.

Specified by:
removeWindowListener in interface org.eclipse.ui.IWorkbench

fireWindowOpened

protected void fireWindowOpened(org.eclipse.ui.IWorkbenchWindow window)
Fire window opened event.


fireWindowClosed

protected void fireWindowClosed(org.eclipse.ui.IWorkbenchWindow window)
Fire window closed event.


fireWindowActivated

protected void fireWindowActivated(org.eclipse.ui.IWorkbenchWindow window)
Fire window activated event.


fireWindowDeactivated

protected void fireWindowDeactivated(org.eclipse.ui.IWorkbenchWindow window)
Fire window deactivated event.


busyClose

private boolean busyClose(boolean force)
Closes the workbench. Assumes that the busy cursor is active.


saveAllEditors

public boolean saveAllEditors(boolean confirm)
Description copied from interface: org.eclipse.ui.IWorkbench
Save all dirty editors in the workbench. Opens a dialog to prompt the user if confirm is true. Return true if successful. Return false if the user has cancelled the command.

Specified by:
saveAllEditors in interface org.eclipse.ui.IWorkbench

busyOpenWorkbenchWindow

private org.eclipse.ui.IWorkbenchWindow busyOpenWorkbenchWindow(java.lang.String perspID,
                                                                org.eclipse.core.runtime.IAdaptable input)
                                                         throws org.eclipse.ui.WorkbenchException
Opens a new workbench window and page with a specific perspective. Assumes that busy cursor is active.


close

public boolean close()
Description copied from interface: org.eclipse.ui.IWorkbench
Closes this workbench and all its open windows.

If the workbench has an open editor with unsaved content, the user will be given the opportunity to save it.

Specified by:
close in interface org.eclipse.ui.IWorkbench

close

boolean close(int returnCode,
              boolean force)
Closes the workbench, returning the given return code from the run method. If forced, the workbench is closed no matter what.


getActiveWorkbenchWindow

public org.eclipse.ui.IWorkbenchWindow getActiveWorkbenchWindow()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the currently active window for this workbench (if any). Returns null if there is no active workbench window. Returns null if called from a non-UI thread.

Specified by:
getActiveWorkbenchWindow in interface org.eclipse.ui.IWorkbench

getEditorHistory

protected EditorHistory getEditorHistory()

getEditorRegistry

public org.eclipse.ui.IEditorRegistry getEditorRegistry()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the editor registry for the workbench.

Specified by:
getEditorRegistry in interface org.eclipse.ui.IWorkbench

getNewWindowNumber

private int getNewWindowNumber()

getPerspectiveRegistry

public org.eclipse.ui.IPerspectiveRegistry getPerspectiveRegistry()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the perspective registry for the workbench.

Specified by:
getPerspectiveRegistry in interface org.eclipse.ui.IWorkbench

getPreferenceManager

public org.eclipse.jface.preference.PreferenceManager getPreferenceManager()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the preference manager for the workbench.

Specified by:
getPreferenceManager in interface org.eclipse.ui.IWorkbench

getPreferenceStore

public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the preference store for the workbench.

Specified by:
getPreferenceStore in interface org.eclipse.ui.IWorkbench

getSharedImages

public org.eclipse.ui.ISharedImages getSharedImages()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the shared images for the workbench.

Specified by:
getSharedImages in interface org.eclipse.ui.IWorkbench

getWindowManager

org.eclipse.jface.window.WindowManager getWindowManager()
Returns the window manager for this workbench.


getWorkbenchStateFile

private java.io.File getWorkbenchStateFile()

getWorkbenchWindowCount

public int getWorkbenchWindowCount()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the number of open main windows associated with this workbench. Note that wizards and dialogs are not included in this list since they are not considered main windows.

Specified by:
getWorkbenchWindowCount in interface org.eclipse.ui.IWorkbench

getWorkbenchWindows

public org.eclipse.ui.IWorkbenchWindow[] getWorkbenchWindows()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns a list of the open main windows associated with this workbench. Note that wizards and dialogs are not included in this list since they are not considered main windows.

Specified by:
getWorkbenchWindows in interface org.eclipse.ui.IWorkbench

getWorkingSetManager

public org.eclipse.ui.IWorkingSetManager getWorkingSetManager()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the working set manager for the workbench.

Specified by:
getWorkingSetManager in interface org.eclipse.ui.IWorkbench

init

private boolean init(org.eclipse.swt.widgets.Display display)
Initializes the workbench now that the display is created.


initializeCommandResolver

private void initializeCommandResolver()
Establishes the relationship between JFace actions and the command manager.


initializeApplicationColors

private void initializeApplicationColors()
Initialize colors defined by the new colorDefinitions extension point. Note this will be rolled into initializeColors() at some point.

Since:
3.0

initializeSingleClickOption

private void initializeSingleClickOption()

initializeFonts

private void initializeFonts()

initializeImages

private void initializeImages()

uninitializeImages

private void uninitializeImages()

initializeColors

private void initializeColors()

isClosing

public boolean isClosing()
Returns true if the workbench is in the process of closing.


isStarting

boolean isStarting()

newWorkbenchWindow

private WorkbenchWindow newWorkbenchWindow()

forceOpenPerspective

private void forceOpenPerspective()

openFirstTimeWindow

void openFirstTimeWindow()

restoreState

org.eclipse.core.runtime.IStatus restoreState()

openWorkbenchWindow

public org.eclipse.ui.IWorkbenchWindow openWorkbenchWindow(org.eclipse.core.runtime.IAdaptable input)
                                                    throws org.eclipse.ui.WorkbenchException
Description copied from interface: org.eclipse.ui.IWorkbench
Creates and opens a new workbench window with one page. The perspective of the new page is defined by the default perspective ID. The new window and new page become active.

Note: The caller is responsible to ensure the action using this method will explicitly inform the user a new window will be opened. Otherwise, callers are strongly recommended to use the openPerspective APIs to programmatically show a perspective to avoid confusing the user.

The workbench also defines a number of menu items to activate or open each registered perspective. A complete list of these perspectives is available from the perspective registry found on IWorkbench.

Specified by:
openWorkbenchWindow in interface org.eclipse.ui.IWorkbench

openWorkbenchWindow

public org.eclipse.ui.IWorkbenchWindow openWorkbenchWindow(java.lang.String perspID,
                                                           org.eclipse.core.runtime.IAdaptable input)
                                                    throws org.eclipse.ui.WorkbenchException
Description copied from interface: org.eclipse.ui.IWorkbench
Creates and opens a new workbench window with one page. The perspective of the new page is defined by the specified perspective ID. The new window and new page become active.

Note: The caller is responsible to ensure the action using this method will explicitly inform the user a new window will be opened. Otherwise, callers are strongly recommended to use the openPerspective APIs to programmatically show a perspective to avoid confusing the user.

In most cases where this method is used the caller is tightly coupled to a particular perspective. They define it in the registry and contribute some user interface action to open or activate it. In situations like this a static variable is often used to identify the perspective Id.

The workbench also defines a number of menu items to activate or open each registered perspective. A complete list of these perspectives is available from the perspective registry found on IWorkbench.

Specified by:
openWorkbenchWindow in interface org.eclipse.ui.IWorkbench

recordWorkbenchState

private org.eclipse.ui.XMLMemento recordWorkbenchState()

restart

public boolean restart()
Description copied from interface: org.eclipse.ui.IWorkbench
Closes then restarts this workbench.

If the workbench has an open editor with unsaved content, the user will be given the opportunity to save it.

Specified by:
restart in interface org.eclipse.ui.IWorkbench

restoreState

private org.eclipse.core.runtime.IStatus restoreState(org.eclipse.ui.IMemento memento)

getEarlyActivatedPlugins

public java.lang.String[] getEarlyActivatedPlugins()
Returns an array with the ids of all plugins that extend the org.eclipse.ui.startup extension point.


startPlugins

private void startPlugins()

runUI

private int runUI()
Internal method for running the workbench UI. This entails processing and dispatching events until the workbench is closed or restarted.

Since:
3.0

runEventLoop

private void runEventLoop(org.eclipse.jface.window.Window.IExceptionHandler handler,
                          org.eclipse.swt.widgets.Display display)

saveState

private org.eclipse.core.runtime.IStatus saveState(org.eclipse.ui.IMemento memento)

saveMementoToFile

private boolean saveMementoToFile(org.eclipse.ui.XMLMemento memento)

showPerspective

public org.eclipse.ui.IWorkbenchPage showPerspective(java.lang.String perspectiveId,
                                                     org.eclipse.ui.IWorkbenchWindow window)
                                              throws org.eclipse.ui.WorkbenchException
Description copied from interface: org.eclipse.ui.IWorkbench
Shows the specified perspective to the user. The caller should use this method when the perspective to be shown is not dependent on the page's input. That is, the perspective can open in any page depending on user preferences.

The perspective may be shown in the specified window, in another existing window, or in a new window depending on user preferences. The exact policy is controlled by the workbench to ensure consistency to the user. The policy is subject to change. The current policy is as follows:

  • If the specified window has the requested perspective open, then the window is given focus and the perspective is shown. The page's input is ignored.
  • If another window that has the workspace root as input and the requested perpective open and active, then the window is given focus.
  • Otherwise the requested perspective is opened and shown in the specified window or in a new window depending on the current user preference for opening perspectives, and that window is given focus.

The workbench also defines a number of menu items to activate or open each registered perspective. A complete list of these perspectives is available from the perspective registry found on IWorkbench.

Specified by:
showPerspective in interface org.eclipse.ui.IWorkbench

showPerspective

public org.eclipse.ui.IWorkbenchPage showPerspective(java.lang.String perspectiveId,
                                                     org.eclipse.ui.IWorkbenchWindow window,
                                                     org.eclipse.core.runtime.IAdaptable input)
                                              throws org.eclipse.ui.WorkbenchException
Description copied from interface: org.eclipse.ui.IWorkbench
Shows the specified perspective to the user. The caller should use this method when the perspective to be shown is dependent on the page's input. That is, the perspective can only open in any page with the specified input.

The perspective may be shown in the specified window, in another existing window, or in a new window depending on user preferences. The exact policy is controlled by the workbench to ensure consistency to the user. The policy is subject to change. The current policy is as follows:

  • If the specified window has the requested perspective open and the same requested input, then the window is given focus and the perspective is shown.
  • If another window has the requested input and the requested perpective open and active, then that window is given focus.
  • If the specified window has the same requested input but not the requested perspective, then the window is given focus and the perspective is opened and shown on condition that the user preference is not to open perspectives in a new window.
  • Otherwise the requested perspective is opened and shown in a new window, and the window is given focus.

The workbench also defines a number of menu items to activate or open each registered perspective. A complete list of these perspectives is available from the perspective registry found on IWorkbench.

Specified by:
showPerspective in interface org.eclipse.ui.IWorkbench

shutdown

private void shutdown()

getDecoratorManager

public org.eclipse.ui.IDecoratorManager getDecoratorManager()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the decorator manager.

Any client using the decorator manager should come up with the text and image for the element (including any of the part's own decorations) before calling the decorator manager. It should also add a listener to be notified when decorations change.

Note that if the element implements IAdaptable, decorators may use this mechanism to obtain an adapter (for example an IResource), and derive the decoration from the adapter rather than the element. Since the adapter may differ from the original element, those using the decorator manager should be prepared to handle notification that the decoration for the adapter has changed, in addition to handling notification that the decoration for the element has changed. That is, it needs to be able to map back from the adapter to the element.

Specified by:
getDecoratorManager in interface org.eclipse.ui.IWorkbench

getActivatedWindow

private WorkbenchWindow getActivatedWindow()

setActivatedWindow

void setActivatedWindow(WorkbenchWindow window)

getWorkbenchConfigurer

WorkbenchConfigurer getWorkbenchConfigurer()
Returns the unique object that applications use to configure the workbench.

IMPORTANT This method is declared package-private to prevent regular plug-ins from downcasting IWorkbench to Workbench and getting hold of the workbench configurer that would allow them to tamper with the workbench. The workbench configurer is available only to the application.


getAdvisor

org.eclipse.ui.application.WorkbenchAdvisor getAdvisor()
Returns the workbench advisor that created this workbench.

IMPORTANT This method is declared package-private to prevent regular plug-ins from downcasting IWorkbench to Workbench and getting hold of the workbench advisor that would allow them to tamper with the workbench. The workbench advisor is internal to the application.


getDisplay

public org.eclipse.swt.widgets.Display getDisplay()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the display for this workbench.

Code should always ask the workbench for the display rather than rely on Display.getDefault() 55 .

Specified by:
getDisplay in interface org.eclipse.ui.IWorkbench

getDefaultPerspectiveId

public java.lang.String getDefaultPerspectiveId()
Returns the default perspective id.


getDefaultPageInput

public org.eclipse.core.runtime.IAdaptable getDefaultPageInput()
Returns the default workbench window page input.


getMainPreferencePageId

public java.lang.String getMainPreferencePageId()
Returns the id of the preference page that should be presented most prominently.


getElementFactory

public org.eclipse.ui.IElementFactory getElementFactory(java.lang.String factoryId)
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the element factory with the given id.

Specified by:
getElementFactory in interface org.eclipse.ui.IWorkbench

getProgressService

public org.eclipse.ui.progress.IProgressService getProgressService()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns the progress service for the workbench.

Specified by:
getProgressService in interface org.eclipse.ui.IWorkbench

getActivitySupport

public org.eclipse.ui.activities.IWorkbenchActivitySupport getActivitySupport()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns an interface to manage activities at the workbench level.

Specified by:
getActivitySupport in interface org.eclipse.ui.IWorkbench

getCommandSupport

public org.eclipse.ui.commands.IWorkbenchCommandSupport getCommandSupport()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns an interface to manage commands at the workbench level.

Specified by:
getCommandSupport in interface org.eclipse.ui.IWorkbench

getContextSupport

public org.eclipse.ui.contexts.IWorkbenchContextSupport getContextSupport()
Description copied from interface: org.eclipse.ui.IWorkbench
Returns an interface to manage contexts at the workbench level.

Specified by:
getContextSupport in interface org.eclipse.ui.IWorkbench

updateActiveWorkbenchWindowMenuManager

private void updateActiveWorkbenchWindowMenuManager(boolean textOnly)

getIntroManager

public org.eclipse.ui.intro.IIntroManager getIntroManager()
Description copied from interface: org.eclipse.ui.IWorkbench
Return the intro manager for this workbench.

Specified by:
getIntroManager in interface org.eclipse.ui.IWorkbench

getWorkbenchIntroManager

WorkbenchIntroManager getWorkbenchIntroManager()
Since:
3.0

getIntroDescriptor

public org.eclipse.ui.internal.intro.IntroDescriptor getIntroDescriptor()
Since:
3.0

setIntroDescriptor

public void setIntroDescriptor(org.eclipse.ui.internal.intro.IntroDescriptor descriptor)
This method exists as a test hook. This method should NEVER be called by clients.

Since:
3.0

getThemeManager

public org.eclipse.ui.themes.IThemeManager getThemeManager()
Description copied from interface: org.eclipse.ui.IWorkbench
Return the theme manager for this workbench.

Specified by:
getThemeManager in interface org.eclipse.ui.IWorkbench

isRunning

public boolean isRunning()
Returns true if the workbench is running, false if it has been terminated.


getPresentationId

public java.lang.String getPresentationId()
Return the presentation ID specified by the preference or the default ID if undefined.


largeUpdateStart

public final void largeUpdateStart()

Indicates the start of a large update within the workbench. This is used to disable CPU-intensive, change-sensitive services that were temporarily disabled in the midst of large changes. This method should always be called in tandem with largeUpdateEnd, and the event loop should not be allowed to spin before that method is called.

Important: always use with largeUpdateEnd!


largeUpdateEnd

public final void largeUpdateEnd()

Indicates the end of a large update within the workbench. This is used to re-enable services that were temporarily disabled in the midst of large changes. This method should always be called in tandem with largeUpdateStart, and the event loop should not be allowed to spin before this method is called.

Important: always protect this call by using finally!