|
|||||||||
| Home >> All >> org >> eclipse >> [ ui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.ui
Interface IWorkbench

- public interface IWorkbench
A workbench is the root object for the Eclipse Platform user interface.
A workbench has one or more main windows which present to the end user information based on some underlying model, typically on resources in an underlying workspace. A workbench usually starts with a single open window, and automatically closes when its last window closes.
Each workbench window has a collection of pages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time.
Each workbench page has a collection of workbench parts, of which there are two kinds: views and editors. A page's parts are arranged (tiled or stacked) for presentation on the screen. The arrangement is not fixed; the user can arrange the parts as they see fit. A perspective is a template for a page, capturing a collection of parts and their arrangement.
The platform creates a workbench when the workbench plug-in is activated;
since this happens at most once during the life of the running platform,
there is only one workbench instance. Due to its singular nature, it is
commonly referred to as
This interface is not intended to be implemented by clients.
| Method Summary | |
void |
addWindowListener(IWindowListener listener)
Adds a window listener. |
boolean |
close()
Closes this workbench and all its open windows. |
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. |
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. |
IDecoratorManager |
getDecoratorManager()
Returns the decorator manager. |
org.eclipse.swt.widgets.Display |
getDisplay()
Returns the display for this workbench. |
IEditorRegistry |
getEditorRegistry()
Returns the editor registry for the workbench. |
IElementFactory |
getElementFactory(java.lang.String factoryId)
Returns the element factory with the given id. |
org.eclipse.ui.intro.IIntroManager |
getIntroManager()
Return the intro manager for this workbench. |
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. |
org.eclipse.ui.progress.IProgressService |
getProgressService()
Returns the progress service for the workbench. |
ISharedImages |
getSharedImages()
Returns the shared images for the workbench. |
org.eclipse.ui.themes.IThemeManager |
getThemeManager()
Return the theme manager for this workbench. |
int |
getWorkbenchWindowCount()
Returns the number of open main windows associated with this workbench. |
IWorkbenchWindow[] |
getWorkbenchWindows()
Returns a list of the open main windows associated with this workbench. |
IWorkingSetManager |
getWorkingSetManager()
Returns the working set manager for the workbench. |
IWorkbenchWindow |
openWorkbenchWindow(org.eclipse.core.runtime.IAdaptable input)
Creates and opens a new workbench window with one page. |
IWorkbenchWindow |
openWorkbenchWindow(java.lang.String perspectiveId,
org.eclipse.core.runtime.IAdaptable input)
Creates and opens a new workbench window with one page. |
void |
removeWindowListener(IWindowListener listener)
Removes a window listener. |
boolean |
restart()
Closes then restarts this workbench. |
boolean |
saveAllEditors(boolean confirm)
Save all dirty editors in the workbench. |
IWorkbenchPage |
showPerspective(java.lang.String perspectiveId,
IWorkbenchWindow window)
Shows the specified perspective to the user. |
IWorkbenchPage |
showPerspective(java.lang.String perspectiveId,
IWorkbenchWindow window,
org.eclipse.core.runtime.IAdaptable input)
Shows the specified perspective to the user. |
| Method Detail |
getDisplay
public org.eclipse.swt.widgets.Display getDisplay()
- Returns the display for this workbench.
Code should always ask the workbench for the display rather than rely on Display.getDefault() 55 .
- Since:
- 3.0
getProgressService
public org.eclipse.ui.progress.IProgressService getProgressService()
- Returns the progress service for the workbench.
- Since:
- 3.0
addWindowListener
public void addWindowListener(IWindowListener listener)
- Adds a window listener.
- Since:
- 2.0
removeWindowListener
public void removeWindowListener(IWindowListener listener)
- Removes a window listener.
- Since:
- 2.0
close
public boolean close()
- 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.
getActiveWorkbenchWindow
public IWorkbenchWindow getActiveWorkbenchWindow()
- Returns the currently active window for this workbench (if any).
Returns
nullif there is no active workbench window. Returnsnullif called from a non-UI thread.
getEditorRegistry
public IEditorRegistry getEditorRegistry()
- Returns the editor registry for the workbench.
getPerspectiveRegistry
public IPerspectiveRegistry getPerspectiveRegistry()
- Returns the perspective registry for the workbench.
getPreferenceManager
public org.eclipse.jface.preference.PreferenceManager getPreferenceManager()
- Returns the preference manager for the workbench.
getPreferenceStore
public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
- Returns the preference store for the workbench.
- Since:
- 2.0
getSharedImages
public ISharedImages getSharedImages()
- Returns the shared images for the workbench.
getWorkbenchWindowCount
public int getWorkbenchWindowCount()
- 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.
- Since:
- 3.0 @issue Use getWorkbenchWindows().length?
getWorkbenchWindows
public IWorkbenchWindow[] getWorkbenchWindows()
- 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.
getWorkingSetManager
public IWorkingSetManager getWorkingSetManager()
- Returns the working set manager for the workbench.
- Since:
- 2.0
openWorkbenchWindow
public IWorkbenchWindow openWorkbenchWindow(java.lang.String perspectiveId, org.eclipse.core.runtime.IAdaptable input) throws WorkbenchException
- 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
openPerspectiveAPIs 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.
openWorkbenchWindow
public IWorkbenchWindow openWorkbenchWindow(org.eclipse.core.runtime.IAdaptable input) throws WorkbenchException
- 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
openPerspectiveAPIs 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.
restart
public boolean restart()
- 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.
- Since:
- 2.0
showPerspective
public IWorkbenchPage showPerspective(java.lang.String perspectiveId, IWorkbenchWindow window) throws WorkbenchException
- 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.- Since:
- 2.0
showPerspective
public IWorkbenchPage showPerspective(java.lang.String perspectiveId, IWorkbenchWindow window, org.eclipse.core.runtime.IAdaptable input) throws WorkbenchException
- 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.- Since:
- 2.0
getDecoratorManager
public IDecoratorManager getDecoratorManager()
- 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 anIResource), 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.
saveAllEditors
public boolean saveAllEditors(boolean confirm)
- Save all dirty editors in the workbench. Opens a dialog to prompt the
user if
confirmis true. Return true if successful. Return false if the user has cancelled the command.
getElementFactory
public IElementFactory getElementFactory(java.lang.String factoryId)
- Returns the element factory with the given id.
- Since:
- 3.0
getActivitySupport
public org.eclipse.ui.activities.IWorkbenchActivitySupport getActivitySupport()
- Returns an interface to manage activities at the workbench level.
- Since:
- 3.0
getCommandSupport
public org.eclipse.ui.commands.IWorkbenchCommandSupport getCommandSupport()
- Returns an interface to manage commands at the workbench level.
- Since:
- 3.0
getContextSupport
public org.eclipse.ui.contexts.IWorkbenchContextSupport getContextSupport()
- Returns an interface to manage contexts at the workbench level.
- Since:
- 3.0
getThemeManager
public org.eclipse.ui.themes.IThemeManager getThemeManager()
- Return the theme manager for this workbench.
- Since:
- 3.0
getIntroManager
public org.eclipse.ui.intro.IIntroManager getIntroManager()
- Return the intro manager for this workbench.
- Since:
- 3.0
|
|||||||||
| Home >> All >> org >> eclipse >> [ ui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC