Class WorkbenchWindow
- All Implemented Interfaces:
IRunnableContext,IShellProvider,IPageService,IWorkbenchWindow,IServiceLocator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intConstant (bit mask) indicating which the New Wizard submenu is probably present somewhere in this window.static final intConstant (bit mask) indicating which the Open Perspective submenu is probably present somewhere in this window.static final StringThe 'elementId' of the spacer used to right-align it in the trimstatic final StringCoolbar visibility change property.static final StringPerspective bar visibility change property.static final StringThe status line visibility change property. for internal use only.static final intConstant (bit mask) indicating which the Show View submenu is probably present somewhere in this window.static final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor pers) Creates and initializes a new workbench window. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given listener for page lifecycle events.voidAdds the given listener for a page's perspective lifecycle events.voidAdd a generic property listener.voidaddSubmenu(int type) Remembers that this window contains the given submenu.booleanclose()Closes this workbench window.booleanclose(boolean remove) booleancontainsSubmenu(int type) Checks to see if this window contains the given type of submenu.org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialogcreateCustomizePerspectiveDialog(Perspective persp, IEclipseContext context) voidfillActionBars(int flags) Fills the window's real action bars.voidfillActionBars(org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2 proxyBars, int flags) Fills the window's proxy action bars.voidfirePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) Fires perspective changedvoidfirePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) Fires perspective changed for an affected partReturns the action bars for this window.static StringReturns the currently active page for this workbench window.static StringgetCommandId(IConfigurationElement element) booleanstatic StringgetDefinitionId(IConfigurationElement element) Return the extension tracker for the workbench.getICEFor(MToolControl mtc) static StringgetId(IConfigurationElement element) protected LayoutReturns the layout for the shell.getModel()getPages()Returns a list of the pages in this workbench window.Returns the part service which tracks part activation within this workbench window.booleanorg.eclipse.ui.internal.progress.ProgressRegionstatic booleangetRetarget(IConfigurationElement element) Returns the selection service which tracks selection within this workbench window.final <T> TgetService(Class<T> key) Retrieves the service corresponding to the given API.getShell()Returns this workbench window's shell.booleanReturnstruewhen the window's shell is activated,falsewhen it's shell is deactivatedbooleanorg.eclipse.jface.internal.provisional.action.IToolBarManager2Returns the workbench for this window.final booleanhasService(Class<?> key) Whether this service exists within the scope of this service locator.booleanisApplicationMenu(String menuID) Returns whether the specified menu is an application menu as opposed to a part menu.booleanReturns a boolean indicating whether the workbench window is in the process of closing.booleanReturn true if the toolbar is visible.final voidIndicates the end of a large update within this window.final voidIndicates the start of a large update within this window.openPage(String perspectiveId, IAdaptable input) Creates and opens a new workbench page.openPage(IAdaptable input) Creates and opens a new workbench page.protected intReturn the style bits for the shortcut bar.voidRemoves the given page listener.voidRemoves the given page's perspective listener.voidRemoves a generic property listener.voidrun(boolean fork, boolean cancelable, IRunnableWithProgress runnable) This specialization of IRunnableContext#run(boolean, boolean, IRunnableWithProgress) blocks until the runnable has been run, regardless of the value offork.voidSets or clears the currently active page for this workbench window.voidsetCoolBarVisible(boolean visible) Cause the coolbar to be shown or hidden; note that the coolbar may still be visible depending on the visibility state of other elements.voidsetPerspectiveBarVisible(boolean visible) Cause the perspective bar to be shown or hidden; note that the perspective bar may still be visible depending on the visibility state of other elements.voidsetStatusLineVisible(boolean visible) voidsetup()voidshowHeapStatus(boolean show) protected booleanvoidToggle the visibility of the coolbar/perspective bar.voidupdate the action bars.voidUpdate the visible action sets.
-
Field Details
-
PERSPECTIVE_SPACER_ID
The 'elementId' of the spacer used to right-align it in the trim- See Also:
-
STATUS_LINE_ID
- See Also:
-
TRIM_CONTRIBUTION_URI
- See Also:
-
ACTION_SET_CMD_PREFIX
- See Also:
-
PROP_COOLBAR_VISIBLE
Coolbar visibility change property.- Since:
- 3.3
- See Also:
-
PROP_PERSPECTIVEBAR_VISIBLE
Perspective bar visibility change property.- Since:
- 3.3
- See Also:
-
PROP_STATUS_LINE_VISIBLE
The status line visibility change property. for internal use only.- Since:
- 3.4
- See Also:
-
SHOW_VIEW_SUBMENU
public static final int SHOW_VIEW_SUBMENUConstant (bit mask) indicating which the Show View submenu is probably present somewhere in this window.- Since:
- 3.0
- See Also:
-
OPEN_PERSPECTIVE_SUBMENU
public static final int OPEN_PERSPECTIVE_SUBMENUConstant (bit mask) indicating which the Open Perspective submenu is probably present somewhere in this window.- Since:
- 3.0
- See Also:
-
NEW_WIZARD_SUBMENU
public static final int NEW_WIZARD_SUBMENUConstant (bit mask) indicating which the New Wizard submenu is probably present somewhere in this window.- Since:
- 3.0
- See Also:
-
-
Constructor Details
-
WorkbenchWindow
Creates and initializes a new workbench window.- Parameters:
input- the input for this workbench windowpers- the perspective to initialize this workbench window with
-
-
Method Details
-
setup
@PostConstruct public void setup() -
getTopTrim
-
getId
-
getCommandId
-
getActionSetCommandId
-
getDefinitionId
-
getRetarget
-
perspectiveBarStyle
protected int perspectiveBarStyle()Return the style bits for the shortcut bar.- Returns:
- int
-
addPropertyChangeListener
Add a generic property listener.- Parameters:
listener- the listener to add- Since:
- 3.3
-
removePropertyChangeListener
Removes a generic property listener.- Parameters:
listener- the listener to remove- Since:
- 3.3
-
addPageListener
Description copied from interface:IPageServiceAdds the given listener for page lifecycle events. Has no effect if an identical listener is already registered.Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
- Specified by:
addPageListenerin interfaceIPageService- Parameters:
l- a page listener- See Also:
-
addPerspectiveListener
Description copied from interface:IPageServiceAdds the given listener for a page's perspective lifecycle events. Has no effect if an identical listener is already registered.Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
- Specified by:
addPerspectiveListenerin interfaceIPageService- Parameters:
l- a perspective listener- See Also:
-
getShell
Description copied from interface:IWorkbenchWindowReturns this workbench window's shell.- Specified by:
getShellin interfaceIShellProvider- Specified by:
getShellin interfaceIWorkbenchWindow- Returns:
- the shell containing this window's controls or
nullif the shell has not been created yet or if the window has been closed
-
close
public boolean close(boolean remove) -
close
public boolean close()Description copied from interface:IWorkbenchWindowCloses this workbench window.If the window has an open editor with unsaved content, the user will be given the opportunity to save it.
- Specified by:
closein interfaceIWorkbenchWindow- Returns:
trueif the window was successfully closed, andfalseif it is still open- See Also:
-
isClosing
public boolean isClosing()Description copied from interface:IWorkbenchWindowReturns a boolean indicating whether the workbench window is in the process of closing.- Specified by:
isClosingin interfaceIWorkbenchWindow- Returns:
trueif the workbench window is in the process of closing,falseotherwise
-
firePerspectiveChanged
public void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) Fires perspective changed -
firePerspectiveChanged
public void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) Fires perspective changed for an affected part -
getActionBars
Returns the action bars for this window.- Returns:
- this window's action bars
-
getActivePage
Description copied from interface:IWorkbenchWindowReturns the currently active page for this workbench window.- Specified by:
getActivePagein interfaceIPageService- Specified by:
getActivePagein interfaceIWorkbenchWindow- Returns:
- the active page, or
nullif none
-
getPages
Description copied from interface:IWorkbenchWindowReturns a list of the pages in this workbench window.Note that each window has its own pages; pages are never shared between different windows.
- Specified by:
getPagesin interfaceIWorkbenchWindow- Returns:
- a list of pages
-
getPartService
Description copied from interface:IWorkbenchWindowReturns the part service which tracks part activation within this workbench window.- Specified by:
getPartServicein interfaceIWorkbenchWindow- Returns:
- the part service
- See Also:
-
getLayout
Returns the layout for the shell.- Returns:
- the layout for the shell
-
getSelectionService
Description copied from interface:IWorkbenchWindowReturns the selection service which tracks selection within this workbench window.- Specified by:
getSelectionServicein interfaceIWorkbenchWindow- Returns:
- the selection service
- See Also:
-
getShellActivated
public boolean getShellActivated()Returnstruewhen the window's shell is activated,falsewhen it's shell is deactivated- Returns:
- boolean
truewhen shell activated,falsewhen shell deactivated
-
getWorkbench
Description copied from interface:IWorkbenchWindowReturns the workbench for this window.- Specified by:
getWorkbenchin interfaceIWorkbenchWindow- Returns:
- the workbench
- See Also:
-
isApplicationMenu
Description copied from interface:IWorkbenchWindowReturns whether the specified menu is an application menu as opposed to a part menu. Application menus contain items which affect the workbench or window. Part menus contain items which affect the active part (view or editor).This is typically used during "in place" editing. Application menus should be preserved during menu merging. All other menus may be removed from the window.
- Specified by:
isApplicationMenuin interfaceIWorkbenchWindow- Parameters:
menuID- the menu id- Returns:
trueif the specified menu is an application menu, andfalseif it is not- See Also:
-
openPage
Description copied from interface:IWorkbenchWindowCreates and opens a new workbench page. The perspective of the new page is defined by the specified perspective ID. The new page become active.Note: Since release 2.0, a window is limited to contain at most one page. If a page exist in the window when this method is used, then another window is created for the new page. Callers are strongly recommended to use the
IWorkbench.showPerspectiveAPIs to programmatically show a perspective.- Specified by:
openPagein interfaceIWorkbenchWindow- Parameters:
perspectiveId- the perspective id for the window's initial pageinput- the page input, ornullif there is no current input. This is used to seed the input for the new page's views.- Returns:
- the new workbench page
- Throws:
WorkbenchException- if a page could not be opened- See Also:
-
openPage
Description copied from interface:IWorkbenchWindowCreates and opens a new workbench page. The default perspective is used as a template for creating the page. The page becomes active.Note: Since release 2.0, a window is limited to contain at most one page. If a page exist in the window when this method is used, then another window is created for the new page. Callers are strongly recommended to use the
IWorkbench.showPerspectiveAPIs to programmatically show a perspective.- Specified by:
openPagein interfaceIWorkbenchWindow- Parameters:
input- the page input, ornullif there is no current input. This is used to seed the input for the new page's views.- Returns:
- the new workbench window
- Throws:
WorkbenchException- if a page could not be opened- See Also:
-
removePageListener
Description copied from interface:IPageServiceRemoves the given page listener. Has no effect if an identical listener is not registered.- Specified by:
removePageListenerin interfaceIPageService- Parameters:
l- a page listener
-
removePerspectiveListener
Description copied from interface:IPageServiceRemoves the given page's perspective listener. Has no effect if an identical listener is not registered.- Specified by:
removePerspectiveListenerin interfaceIPageService- Parameters:
l- a perspective listener- See Also:
-
run
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException Description copied from interface:IWorkbenchWindowThis specialization of IRunnableContext#run(boolean, boolean, IRunnableWithProgress) blocks until the runnable has been run, regardless of the value offork. It is recommended thatforkis set to true in most cases. Ifforkis set tofalse, the runnable will run in the UI thread and it is the runnable's responsibility to callDisplay.readAndDispatch()to ensure UI responsiveness.- Specified by:
runin interfaceIRunnableContext- Specified by:
runin interfaceIWorkbenchWindow- Parameters:
fork-trueif the runnable should be run in a separate thread, andfalseto run in the same threadcancelable-trueto enable the cancelation, andfalseto make the operation uncancellablerunnable- the runnable to run- Throws:
InvocationTargetException- wraps any exception or error which occurs while running the runnableInterruptedException- propagated by the context if the runnable acknowledges cancelation by throwing this exception. This should not be thrown if cancelable isfalse.
-
setActivePage
Description copied from interface:IWorkbenchWindowSets or clears the currently active page for this workbench window.- Specified by:
setActivePagein interfaceIWorkbenchWindow- Parameters:
in- the new active page, ornullfor no active page
-
getMenuRestrictions
-
updateActionBars
public void updateActionBars()update the action bars. -
largeUpdateStart
public final void largeUpdateStart()Indicates the start of a large update within this window. 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!- Since:
- 3.1
-
largeUpdateEnd
public final void largeUpdateEnd()Indicates the end of a large update within this window. 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!- Since:
- 3.1
-
updateActionSets
public void updateActionSets()Update the visible action sets. This method is typically called from a page when the user changes the visible action sets within the prespective. -
showHeapStatus
public void showHeapStatus(boolean show) -
fillActionBars
public void fillActionBars(int flags) Fills the window's real action bars.- Parameters:
flags- indicate which bars to fill
-
fillActionBars
public void fillActionBars(org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2 proxyBars, int flags) Fills the window's proxy action bars.- Parameters:
proxyBars- the proxy configurerflags- indicate which bars to fill
-
setCoolBarVisible
public void setCoolBarVisible(boolean visible) Cause the coolbar to be shown or hidden; note that the coolbar may still be visible depending on the visibility state of other elements. This method is a lower-level method that affects the visibility but does not update any associated preference values.- Parameters:
visible- whether the cool bar should be shown. This is only applicable if the window configurer also wishes either the cool bar to be visible.- Since:
- 3.0
-
getCoolBarVisible
public boolean getCoolBarVisible()- Returns:
- whether the cool bar should be shown. This is only applicable if the window configurer also wishes either the cool bar to be visible.
- Since:
- 3.0
-
getActionPresentation
-
setPerspectiveBarVisible
public void setPerspectiveBarVisible(boolean visible) Cause the perspective bar to be shown or hidden; note that the perspective bar may still be visible depending on the visibility state of other elements. This method is a lower-level method that affects the visibility but does not update any associated preference values.- Parameters:
visible- whether the perspective bar should be shown. This is only applicable if the window configurer also wishes either the perspective bar to be visible.- Since:
- 3.0
-
getPerspectiveBarVisible
public boolean getPerspectiveBarVisible()- Returns:
- whether the perspective bar should be shown. This is only applicable if the window configurer also wishes either the perspective bar to be visible.
- Since:
- 3.0
-
setStatusLineVisible
public void setStatusLineVisible(boolean visible) - Parameters:
visible- whether the perspective bar should be shown. This is only applicable if the window configurer also wishes either the perspective bar to be visible.- Since:
- 3.0
-
getStatusLineVisible
public boolean getStatusLineVisible()- Returns:
- whether the perspective bar should be shown. This is only applicable if the window configurer also wishes either the perspective bar to be visible.
- Since:
- 3.0
-
showTopSeperator
protected boolean showTopSeperator() -
getProgressRegion
public org.eclipse.ui.internal.progress.ProgressRegion getProgressRegion()- Returns:
- Returns the progressRegion.
-
getExtensionTracker
Description copied from interface:IWorkbenchWindowReturn the extension tracker for the workbench. This tracker may be used by plug-ins to ensure responsiveness to changes to the plug-in registry.
The tracker at this level of the workbench is typically used to track elements that persist for the life of the workbench. For example, the action objects corresponding to new wizards contributed by plug-ins fall into this category.
- Specified by:
getExtensionTrackerin interfaceIWorkbenchWindow- Returns:
- the extension tracker
- See Also:
-
getService
Description copied from interface:IServiceLocatorRetrieves the service corresponding to the given API.- Specified by:
getServicein interfaceIServiceLocator- Parameters:
key- This is the interface that the service implements. Must not benull.- Returns:
- The service, or
nullif no such service could be found.
-
hasService
Description copied from interface:IServiceLocatorWhether this service exists within the scope of this service locator. This does not include looking for the service within the scope of the parents. This method can be used to determine whether a particular service supports nesting in this scope.- Specified by:
hasServicein interfaceIServiceLocator- Parameters:
key- This is the interface that the service implements. Must not benull.- Returns:
trueif the service locator can find a service for the given API;falseotherwise.
-
toggleToolbarVisibility
public void toggleToolbarVisibility()Toggle the visibility of the coolbar/perspective bar. This method respects the window configurer and will only toggle visibility if the item in question was originally declared visible by the window advisor.- Since:
- 3.3
-
isToolbarVisible
public boolean isToolbarVisible()Return true if the toolbar is visible. Note that it may not be possible to make the toolbar visible (i.e., the window configurer).- Returns:
- true if the toolbar is visible
- Since:
- 4.2
-
getModel
-
getStatusLineManager
-
getCoolBarManager2
-
getCoolBarManager
-
getMenuManager
-
getMenuBarManager
-
getToolBarManager2
public org.eclipse.jface.internal.provisional.action.IToolBarManager2 getToolBarManager2() -
getToolBarManager
-
createCustomizePerspectiveDialog
public org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog createCustomizePerspectiveDialog(Perspective persp, IEclipseContext context)