Class WorkbenchPage
- All Implemented Interfaces:
IPartService
,ISelectionService
,IWorkbenchPage
-
Field Summary
Fields inherited from interface org.eclipse.ui.IWorkbenchPage
CHANGE_ACTION_SET_HIDE, CHANGE_ACTION_SET_SHOW, CHANGE_EDITOR_AREA_HIDE, CHANGE_EDITOR_AREA_SHOW, CHANGE_EDITOR_CLOSE, CHANGE_EDITOR_OPEN, CHANGE_FAST_VIEW_ADD, CHANGE_FAST_VIEW_REMOVE, CHANGE_RESET, CHANGE_RESET_COMPLETE, CHANGE_VIEW_HIDE, CHANGE_VIEW_SHOW, CHANGE_WORKING_SET_REPLACE, CHANGE_WORKING_SETS_REPLACE, EDITOR_ID_ATTR, MATCH_ID, MATCH_IGNORE_SIZE, MATCH_INPUT, MATCH_NONE, STATE_MAXIMIZED, STATE_MINIMIZED, STATE_RESTORED, VIEW_ACTIVATE, VIEW_CREATE, VIEW_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(IWorkbenchPart part) Activates a part.void
addEditorReference
(EditorReference editorReference) void
addHiddenItems
(String id) void
addHiddenItems
(MPerspective perspective, String id) void
Adds an IPartListener to the part service.void
Adds an IPartListener to the part service.void
addPostSelectionListener
(String partId, ISelectionListener listener) Adds a part-specific selection listener which is notified when selection changes in the part with the given id.void
addPostSelectionListener
(ISelectionListener listener) Adds the given post selection listener.It is equivalent to selection changed if the selection was triggered by the mouse but it has a delay if the selection is triggered by the keyboard arrows.void
Deprecated.individual views should store a working set if needed and register a property change listener directly with the working set manager to receive notification when the view working set is removed.void
addSelectionListener
(String partId, ISelectionListener listener) Adds a part-specific selection listener which is notified when selection changes in the part with the given id.void
addSelectionListener
(ISelectionListener listener) Adds the given selection listener.void
addViewReference
(ViewReference reference) void
bringToTop
(IWorkbenchPart part) Moves a part forward in the Z order of a perspective so it is visible.protected IViewPart
busyShowView
(String viewId, int mode) Shows a view.boolean
close()
Closes this page.boolean
closeAllEditors
(boolean save) See IWorkbenchPagevoid
closeAllPerspectives
(boolean saveEditors, boolean closePage) Closes all perspectives in this page.boolean
boolean
closeEditor
(IEditorPart editor, boolean save) See IWorkbenchPage#closeEditorboolean
closeEditor
(IEditorReference editor) boolean
closeEditor
(IEditorReference editorRef, boolean save) boolean
closeEditors
(IEditorReference[] refArray, boolean save) See IWorkbenchPagevoid
closePerspective
(IPerspectiveDescriptor desc, boolean saveParts, boolean closePage) Closes the specified perspective in this page.void
closePerspective
(IPerspectiveDescriptor desc, String perspectiveId, boolean saveParts, boolean closePage) createEditorReferenceForPart
(MPart part, IEditorInput input, String editorId, IMemento memento) void
createViewReferenceForPart
(MPart part, String viewId) void
dispose()
Cleanup.boolean
findEditor
(IEditorInput input) Returns the editor with the specified input.findEditors
(IEditorInput input, String editorId, int matchFlags) Returns an array of editor references that match the given input and/or editor id, as specified by the given match flags.findPart
(IWorkbenchPart part) See IWorkbenchPage@findView.findViewReference
(String viewId) Returns the view reference with the specified id.findViewReference
(String viewId, String secondaryId) Returns the view reference with the specified id and secondary id.void
firePartClosed
(org.eclipse.ui.internal.e4.compatibility.CompatibilityPart compatibilityPart) void
FiresIPartListener2.partDeactivated(IWorkbenchPartReference)
if the passed part is the currently active part according to the part service.void
firePartHidden
(MPart part) void
firePartInputChanged
(IWorkbenchPartReference partReference) void
firePartOpened
(org.eclipse.ui.internal.e4.compatibility.CompatibilityPart compatibilityPart) org.eclipse.ui.internal.registry.IActionSetDescriptor[]
Returns an array of the visible action sets.Returns the active editor open in this page.Returns the active part.Returns the active part reference.Return a working set that contains all of the elements contained in the array of working sets provided byIWorkbenchPage.getWorkingSets()
.Returns a list of dirty editors in this page.getEditorReference
(MPart part) Returns an array of references to open editors in this page.int
Returns the number of open editors before reusing editors.Returns a list of the editors open in this page.IMemento[]
getEditorState
(IEditorReference[] editorRefs, boolean includeInputState) Return an IMemento containing the current state of the editor for each of the given references.Return the extension tracker for the workbench.getInput()
Returns the input for this page.getLabel()
Returns the page label.Returns the navigation history which manages a list of entries keeping the history of places (positions, selection and editors) the user visited making it easier to the user to move back and forward without losing context.String[]
Returns the new wizard shortcuts associated with the current perspective.Returns the descriptors for the perspectives that are open in this page, in the order in which they were opened.int
Returns the maximized/minimized/restored state of the given part reference.Returns the perspective.String[]
Returns the perspective shortcuts associated with the current perspective.getReference
(IWorkbenchPart part) Returns the reference to the given part, ornull
if it has no reference (i.e. it is not a top-level part in this workbench page).Returns the current selection in the active part.getSelection
(String partId) Returns the current selection in the part with the given id.Returns the ids of the parts to list in the Show In... prompter.String[]
Returns the show view shortcuts associated with the current perspective.Returns the descriptors for the perspectives that are open in this page, in the order in which they were activated (oldest first).getViewReference
(MPart part) See IWorkbenchPage.getViews()
See IWorkbenchPage.getViewStack
(IViewPart part) Returns an array of IViewParts that are stacked with the given part in the currently active perspective.Allow access to the UI model that this page is managingSee IWorkbenchPage.Deprecated.individual views should store a working set if neededReturn the visible working sets for this page.void
hideActionSet
(String actionSetID) Hides an action set in this page.void
Remove an open editor, turn it into a non-participating editor.void
Hides the given view.void
hideView
(IViewReference view) Hides the given view that belongs to the reference, if any.boolean
See IWorkbenchPage.boolean
isEditorPinned
(IEditorPart editor) See IWorkbenchPage.boolean
Returns the page "zoomed" state.boolean
isPartVisible
(IWorkbenchPart part) See IWorkbenchPage.boolean
isPartVisible
(IWorkbenchPartReference reference) openEditor
(IEditorInput input, String editorID) See IWorkbenchPage.openEditor
(IEditorInput input, String editorID, boolean activate) See IWorkbenchPage.openEditor
(IEditorInput input, String editorID, boolean activate, int matchFlags) See IWorkbenchPage.openEditor
(IEditorInput input, String editorID, boolean activate, int matchFlags, IMemento editorState, boolean notify) This is not public API but for use internally. editorState can benull
.openEditorFromDescriptor
(IEditorInput fileEditorInput, IEditorDescriptor editorDescriptor, boolean activate, IMemento editorState) Opens an editor represented by the descriptor with the given input.openEditors
(IEditorInput[] inputs, String[] editorIDs, int matchFlags) Opens editors for the given inputs.openEditors
(IEditorInput[] inputs, String[] editorIDs, IMemento[] mementos, int matchFlags, int activationIndex) Opens editors for the given inputs.void
performedShowIn
(String partId) The user successfully performed a Show In... action on the specified part.void
void
removeHiddenItems
(MPerspective perspective, String id) void
Removes an IPartListener from the part service.void
Removes an IPartListener from the part service.void
removePostSelectionListener
(String partId, ISelectionListener listener) Removes the given part-specific post selection listener.void
Removes the given post selection listener.void
Deprecated.individual views should store a working set if needed and register a property change listener directly with the working set manager to receive notification when the view working set is removed.void
removeSelectionListener
(String partId, ISelectionListener listener) Removes the given part-specific selection listener.void
removeSelectionListener
(ISelectionListener listener) Removes the given selection listener.void
Resets the layout for the perspective.void
void
void
reuseEditor
(IReusableEditor editor, IEditorInput input) See IWorkbenchPage.static boolean
saveAll
(List<IWorkbenchPart> dirtyParts, boolean confirm, boolean closing, boolean addNonPartSources, IRunnableContext runnableContext, IWorkbenchWindow workbenchWindow) boolean
saveAllEditors
(boolean confirm) See IWorkbenchPageboolean
saveAllEditors
(boolean confirm, boolean closing, boolean addNonPartSources) boolean
saveEditor
(IEditorPart editor, boolean confirm) Saves an editors in the workbench.void
Saves the visible views, their layout, and the visible action sets for this page to the current perspective descriptor.void
savePerspectiveAs
(IPerspectiveDescriptor perspective) Saves the visible views, their layout, and the visible action sets for this page to the given perspective descriptor.boolean
saveSaveable
(ISaveablePart saveable, IWorkbenchPart part, boolean confirm, boolean closing) Saves the contents of the provided saveable and returns whether the operation succeeded or not.void
void
void
setEditorAreaVisible
(boolean showEditorArea) Show or hide the editor area for the page's active perspective.void
setEditorReuseThreshold
(int openEditors) Set the number of open editors before reusing editors.void
setNewShortcuts
(List<String> wizards, String tagPrefix) void
setPartState
(IWorkbenchPartReference ref, int iState) Set the state of the given part reference.void
setPerspective
(IPerspectiveDescriptor perspective) Changes the visible views, their layout, and the visible action sets within the page to match the given perspective descriptor.void
setup
(MApplication application, EModelService modelService, IEventBroker broker, MWindow window, EPartService partService) void
setWorkingSet
(IWorkingSet newWorkingSet) Deprecated.individual views should store a working set if neededvoid
setWorkingSets
(IWorkingSet[] newWorkingSets) Set the working sets for this page.void
showActionSet
(String actionSetID) Shows an action set in this page.void
Add back an open but non-participating editorSee IWorkbenchPage.Shows a view in this page with the given id and secondary id.void
sortShowInPartIds
(ArrayList<?> partIds) Sorts the given collection of show in target part ids in MRU order.void
Zoom the page in on a part.void
Forces all perspectives on the page to zoom out.void
updateActionBars method comment.void
updateShowInSources
(MPart part) void
zoomOut()
Zooms out the zoomed-in part.
-
Field Details
-
legacyWindow
-
-
Constructor Details
-
WorkbenchPage
Constructs a page.restoreState(IMemento)
should be called to restore this page from data stored in a persistance file.- Parameters:
w
- the parent windowinput
- the page input
-
-
Method Details
-
updateShowInSources
-
getWindowModel
Allow access to the UI model that this page is managing- Returns:
- the MWindow element for this page
-
activate
Activates a part. The part will be brought to the front and given focus.- Specified by:
activate
in interfaceIWorkbenchPage
- Parameters:
part
- the part to activate
-
addPartListener
Adds an IPartListener to the part service.- Specified by:
addPartListener
in interfaceIPartService
- Parameters:
l
- a part listener- See Also:
-
addPartListener
Adds an IPartListener to the part service.- Specified by:
addPartListener
in interfaceIPartService
- Parameters:
l
- a part listener- See Also:
-
addPropertyChangeListener
Deprecated.individual views should store a working set if needed and register a property change listener directly with the working set manager to receive notification when the view working set is removed.Implements IWorkbenchPage- Specified by:
addPropertyChangeListener
in interfaceIWorkbenchPage
- Parameters:
listener
- the property change listener to add- Since:
- 2.0
- See Also:
-
addSelectionListener
Description copied from interface:ISelectionService
Adds the given selection listener. 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.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener- See Also:
-
addSelectionListener
Description copied from interface:ISelectionService
Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a
null
selection, but only if the listener implementsINullSelectionListener
.Note: this will not correctly track editor parts as each editor does not have a unique partId.
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.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener- See Also:
-
addPostSelectionListener
Description copied from interface:ISelectionService
Adds the given post selection listener.It is equivalent to selection changed if the selection was triggered by the mouse but it has a delay if the selection is triggered by the keyboard arrows. Has no effect if an identical listener is already registered. Note: Works only for StructuredViewer(s).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.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addPostSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener- See Also:
-
addPostSelectionListener
Description copied from interface:ISelectionService
Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a
null
selection, but only if the listener implementsINullSelectionListener
.Note: this will not correctly track editor parts as each editor does not have a unique partId.
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.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addPostSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener- See Also:
-
bringToTop
Moves a part forward in the Z order of a perspective so it is visible. If the part is in the same stack as the active part, the new part is activated.- Specified by:
bringToTop
in interfaceIWorkbenchPage
- Parameters:
part
- the part to bring to move forward
-
findPart
-
createEditorReferenceForPart
public EditorReference createEditorReferenceForPart(MPart part, IEditorInput input, String editorId, IMemento memento) -
getInternalEditorReferences
-
getEditorReference
-
getViewReference
-
addViewReference
-
addEditorReference
-
busyShowView
Shows a view. Assumes that a busy cursor is active.- Throws:
PartInitException
-
close
public boolean close()Closes this page.- Specified by:
close
in interfaceIWorkbenchPage
- Returns:
true
if the page was successfully closed, andfalse
if it is still open
-
closeAllSavedEditors
public boolean closeAllSavedEditors() -
closeAllEditors
public boolean closeAllEditors(boolean save) See IWorkbenchPage- Specified by:
closeAllEditors
in interfaceIWorkbenchPage
- Parameters:
save
-true
to save the editor contents if required (recommended), andfalse
to discard any unsaved changes- Returns:
true
if all editors were successfully closed, andfalse
if at least one is still open
-
closeEditors
See IWorkbenchPage- Specified by:
closeEditors
in interfaceIWorkbenchPage
- Parameters:
refArray
- the editors to closesave
-true
to save the editor contents if required (recommended), andfalse
to discard any unsaved changes- Returns:
true
if the editors were successfully closed, andfalse
if the editors are still open
-
closeEditor
-
closeEditor
-
closeEditor
See IWorkbenchPage#closeEditor- Specified by:
closeEditor
in interfaceIWorkbenchPage
- Parameters:
editor
- the editor to closesave
-true
to save the editor contents if required (recommended), andfalse
to discard any unsaved changes- Returns:
true
if the editor was successfully closed, andfalse
if the editor is still open
-
closePerspective
Description copied from interface:IWorkbenchPage
Closes the specified perspective in this page. If the last perspective in this page is closed, then all editors are closed. Views that are not shown in other perspectives are closed as well. IfsaveParts
istrue
, the user will be prompted to save any unsaved changes for parts that are being closed. The page itself is closed ifclosePage
istrue
.- Specified by:
closePerspective
in interfaceIWorkbenchPage
- Parameters:
desc
- the descriptor of the perspective to be closedsaveParts
- whether the page's parts should be saved if closedclosePage
- whether the page itself should be closed if last perspective
-
closePerspective
public void closePerspective(IPerspectiveDescriptor desc, String perspectiveId, boolean saveParts, boolean closePage) -
closeAllPerspectives
public void closeAllPerspectives(boolean saveEditors, boolean closePage) Description copied from interface:IWorkbenchPage
Closes all perspectives in this page. All editors are closed, prompting to save any unsaved changes ifsaveEditors
istrue
. The page itself is closed ifclosePage
istrue
.- Specified by:
closeAllPerspectives
in interfaceIWorkbenchPage
- Parameters:
saveEditors
- whether the page's editors should be savedclosePage
- whether the page itself should be closed
-
unzoomAllPerspectives
public void unzoomAllPerspectives()Forces all perspectives on the page to zoom out. -
dispose
public void dispose()Cleanup. -
editActionSets
public boolean editActionSets() -
findView
See IWorkbenchPage@findView.- Specified by:
findView
in interfaceIWorkbenchPage
- Parameters:
id
- the id of the view extension to use- Returns:
- the view, or
null
if none is found
-
findViewReference
Description copied from interface:IWorkbenchPage
Returns the view reference with the specified id.- Specified by:
findViewReference
in interfaceIWorkbenchPage
- Parameters:
viewId
- the id of the view extension to use- Returns:
- the view reference, or
null
if none is found
-
findViewReference
Description copied from interface:IWorkbenchPage
Returns the view reference with the specified id and secondary id.- Specified by:
findViewReference
in interfaceIWorkbenchPage
- Parameters:
viewId
- the id of the view extension to usesecondaryId
- the secondary id to use, ornull
for no secondary id- Returns:
- the view reference, or
null
if none is found
-
createViewReferenceForPart
-
getActionBars
-
getActionSets
public org.eclipse.ui.internal.registry.IActionSetDescriptor[] getActionSets()Returns an array of the visible action sets.- Returns:
- an array of the currently visible action sets
-
getActiveEditor
Description copied from interface:IWorkbenchPage
Returns the active editor open in this page.This is the visible editor on the page, or, if there is more than one visible editor, this is the one most recently brought to top.
- Specified by:
getActiveEditor
in interfaceIWorkbenchPage
- Returns:
- the active editor, or
null
if no editor is active - See Also:
-
getActivePart
Description copied from interface:IPartService
Returns the active part.- Specified by:
getActivePart
in interfaceIPartService
- Returns:
- the active part, or
null
if no part is currently active
-
getActivePartReference
Description copied from interface:IPartService
Returns the active part reference.- Specified by:
getActivePartReference
in interfaceIPartService
- Returns:
- the active part reference, or
null
if no part is currently active
-
getClientComposite
-
getDirtyEditors
Description copied from interface:IWorkbenchPage
Returns a list of dirty editors in this page.- Specified by:
getDirtyEditors
in interfaceIWorkbenchPage
- Returns:
- a list of dirty editors
-
findEditor
Description copied from interface:IWorkbenchPage
Returns the editor with the specified input. Returns null if there is no opened editor with that input.- Specified by:
findEditor
in interfaceIWorkbenchPage
- Parameters:
input
- the editor input- Returns:
- an editor with input equals to
input
-
findEditors
Description copied from interface:IWorkbenchPage
Returns an array of editor references that match the given input and/or editor id, as specified by the given match flags. Returns an empty array if there are no matching editors, or if matchFlags is MATCH_NONE.- Specified by:
findEditors
in interfaceIWorkbenchPage
- Parameters:
input
- the editor input, ornull
if MATCH_INPUT is not specified in matchFlagseditorId
- the editor id, ornull
if MATCH_ID is not specified in matchFlagsmatchFlags
- a bit mask consisting of zero or more of the MATCH_* constants OR-ed together- Returns:
- the references for the matching editors
- See Also:
-
getEditors
Description copied from interface:IWorkbenchPage
Returns a list of the editors open in this page.Note that each page has its own editors; editors are never shared between pages.
- Specified by:
getEditors
in interfaceIWorkbenchPage
- Returns:
- a list of open editors
-
getEditorReferences
Description copied from interface:IWorkbenchPage
Returns an array of references to open editors in this page.Note that each page has its own editors; editors are never shared between pages.
- Specified by:
getEditorReferences
in interfaceIWorkbenchPage
- Returns:
- a list of open editors
-
getSortedEditors
-
getSortedParts
-
getInput
Description copied from interface:IWorkbenchPage
Returns the input for this page.- Specified by:
getInput
in interfaceIWorkbenchPage
- Returns:
- the input for this page, or
null
if none - See Also:
-
getLabel
Returns the page label. This is a combination of the page input and active perspective.- Specified by:
getLabel
in interfaceIWorkbenchPage
- Returns:
- the page label
-
getPerspective
Returns the perspective.- Specified by:
getPerspective
in interfaceIWorkbenchPage
- Returns:
- the current perspective descriptor or
null
- See Also:
-
getPerspectiveDesc
-
getSelection
Description copied from interface:ISelectionService
Returns the current selection in the active part. If the selection in the active part is undefined (the active part has no selection provider) the result will benull
.- Specified by:
getSelection
in interfaceISelectionService
- Returns:
- the current selection, or
null
if undefined
-
getSelection
Description copied from interface:ISelectionService
Returns the current selection in the part with the given id. If the part is not open, or if the selection in the active part is undefined (the active part has no selection provider) the result will benull
.- Specified by:
getSelection
in interfaceISelectionService
- Parameters:
partId
- the id of the part- Returns:
- the current selection, or
null
if undefined
-
getShowInPartIds
Returns the ids of the parts to list in the Show In... prompter. This is a List of Strings.- Returns:
- the ids of the parts that should be available in the 'Show In...' prompt
-
performedShowIn
The user successfully performed a Show In... action on the specified part. Update the list of Show In items accordingly.- Parameters:
partId
- the id of the part that the action was performed on
-
sortShowInPartIds
Sorts the given collection of show in target part ids in MRU order.- Parameters:
partIds
- the collection of part ids to rearrange
-
getViewReferences
See IWorkbenchPage.- Specified by:
getViewReferences
in interfaceIWorkbenchPage
- Returns:
- a list of references to visible views
-
getViews
See IWorkbenchPage.- Specified by:
getViews
in interfaceIWorkbenchPage
- Returns:
- a list of visible views
-
getWorkbenchWindow
See IWorkbenchPage.- Specified by:
getWorkbenchWindow
in interfaceIWorkbenchPage
- Returns:
- the workbench window
-
getWorkingSet
Deprecated.individual views should store a working set if neededImplements IWorkbenchPage- Specified by:
getWorkingSet
in interfaceIWorkbenchPage
- Returns:
- the working set of this page.
- Since:
- 2.0
- See Also:
-
hideActionSet
Description copied from interface:IWorkbenchPage
Hides an action set in this page.In most cases where this method is used the caller is tightly coupled to a particular action set. They define it in the registry and may make it visible in certain scenarios by calling
showActionSet
. A static variable is often used to identify the action set id in caller code.- Specified by:
hideActionSet
in interfaceIWorkbenchPage
- Parameters:
actionSetID
- the action set to hide- See Also:
-
hideView
Description copied from interface:IWorkbenchPage
Hides the given view that belongs to the reference, if any.- Specified by:
hideView
in interfaceIWorkbenchPage
- Parameters:
view
- the references whos view is to be hidden
-
hideView
Description copied from interface:IWorkbenchPage
Hides the given view. The view must belong to this page.- Specified by:
hideView
in interfaceIWorkbenchPage
- Parameters:
view
- the view to hide
-
setup
@PostConstruct public void setup(MApplication application, EModelService modelService, IEventBroker broker, MWindow window, EPartService partService) -
restoreWorkingSets
public void restoreWorkingSets() -
saveWorkingSets
@PreDestroy public void saveWorkingSets() -
saveShowInMruPartIdsList
@PreDestroy public void saveShowInMruPartIdsList() -
isPartVisible
See IWorkbenchPage.- Specified by:
isPartVisible
in interfaceIWorkbenchPage
- Parameters:
part
- the part to test- Returns:
- boolean
true
if part is visible
-
isEditorAreaVisible
public boolean isEditorAreaVisible()See IWorkbenchPage.- Specified by:
isEditorAreaVisible
in interfaceIWorkbenchPage
- Returns:
true
when editor area visible,false
otherwise
-
isPageZoomed
public boolean isPageZoomed()Description copied from interface:IWorkbenchPage
Returns the page "zoomed" state.- Specified by:
isPageZoomed
in interfaceIWorkbenchPage
- Returns:
true
if the page is zoomed in the workbench window,false
otherwise.
-
reuseEditor
See IWorkbenchPage.- Specified by:
reuseEditor
in interfaceIWorkbenchPage
- Parameters:
editor
- the editor to be reusedinput
- the new input for the reusable editor
-
openEditor
See IWorkbenchPage.- Specified by:
openEditor
in interfaceIWorkbenchPage
- Parameters:
input
- the editor inputeditorID
- the id of the editor extension to use- Returns:
- an open and active editor, or
null
if an external editor was opened - Throws:
PartInitException
- if the editor could not be created or initialized
-
openEditor
public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException See IWorkbenchPage.- Specified by:
openEditor
in interfaceIWorkbenchPage
- Parameters:
input
- the editor inputeditorID
- the id of the editor extension to useactivate
- iftrue
the editor will be activated- Returns:
- an open editor, or
null
if an external editor was opened - Throws:
PartInitException
- if the editor could not be created or initialized
-
openEditor
public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate, int matchFlags) throws PartInitException See IWorkbenchPage.- Specified by:
openEditor
in interfaceIWorkbenchPage
- Parameters:
input
- the editor inputeditorID
- the id of the editor extension to useactivate
- iftrue
the editor will be activatedmatchFlags
- a bit mask consisting of zero or more of the MATCH_* constants OR-ed together- Returns:
- an open editor, or
null
if an external editor was opened - Throws:
PartInitException
- if the editor could not be created or initialized- See Also:
-
openEditor
public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate, int matchFlags, IMemento editorState, boolean notify) throws PartInitException This is not public API but for use internally. editorState can benull
.- Parameters:
input
- the input to open the editor witheditorID
- the id of the editor to openactivate
-true
if the editor should be activated,false
otherwisematchFlags
- a bit mask consisting of zero or more of the MATCH_* constants OR-ed togethereditorState
- the previously saved state of the editor as a memento, this may benull
notify
-true
if the perspective should fire off events about the editors being opened,false
otherwise- Returns:
- the opened editor
- Throws:
PartInitException
- if the editor could not be created or initialized
-
isEditorPinned
See IWorkbenchPage.- Specified by:
isEditorPinned
in interfaceIWorkbenchPage
- Parameters:
editor
- the editor to test- Returns:
- boolean whether the editor is pinned
-
removePartListener
Removes an IPartListener from the part service.- Specified by:
removePartListener
in interfaceIPartService
- Parameters:
l
- a part listener
-
removePartListener
Removes an IPartListener from the part service.- Specified by:
removePartListener
in interfaceIPartService
- Parameters:
l
- a part listener
-
removePropertyChangeListener
Deprecated.individual views should store a working set if needed and register a property change listener directly with the working set manager to receive notification when the view working set is removed.Implements IWorkbenchPage- Specified by:
removePropertyChangeListener
in interfaceIWorkbenchPage
- Parameters:
listener
- the property change listener to remove- Since:
- 2.0
- See Also:
-
removeSelectionListener
Description copied from interface:ISelectionService
Removes the given selection listener. Has no effect if an identical listener is not registered.- Specified by:
removeSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener
-
removeSelectionListener
Description copied from interface:ISelectionService
Removes the given part-specific selection listener. Has no effect if an identical listener is not registered for the given part id.- Specified by:
removeSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener
-
removePostSelectionListener
Description copied from interface:ISelectionService
Removes the given post selection listener. Has no effect if an identical listener is not registered.- Specified by:
removePostSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener
-
removePostSelectionListener
Description copied from interface:ISelectionService
Removes the given part-specific post selection listener. Has no effect if an identical listener is not registered for the given part id.- Specified by:
removePostSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener
-
resetPerspective
public void resetPerspective()Resets the layout for the perspective. The active part in the old layout is activated in the new layout for consistent user context.- Specified by:
resetPerspective
in interfaceIWorkbenchPage
-
saveAllEditors
public boolean saveAllEditors(boolean confirm) See IWorkbenchPage- Specified by:
saveAllEditors
in interfaceIWorkbenchPage
- Parameters:
confirm
-true
to ask the user before saving unsaved changes (recommended), andfalse
to save unsaved changes without asking- Returns:
true
if the command succeeded, andfalse
if the operation was canceled by the user or an error occurred while saving
-
getDirtyParts
- Returns:
ISaveablePart
objects derived fromIWorkbenchPart
's on this page
-
getDirtyWorkbenchParts
- Returns:
- workbench parts which are dirty (implement or adapt to
ISaveablePart
). Only parts matching different saveables are returned.
-
saveAllEditors
public boolean saveAllEditors(boolean confirm, boolean closing, boolean addNonPartSources) -
saveAll
public static boolean saveAll(List<IWorkbenchPart> dirtyParts, boolean confirm, boolean closing, boolean addNonPartSources, IRunnableContext runnableContext, IWorkbenchWindow workbenchWindow) -
saveSaveable
public boolean saveSaveable(ISaveablePart saveable, IWorkbenchPart part, boolean confirm, boolean closing) Saves the contents of the provided saveable and returns whether the operation succeeded or not.- Parameters:
saveable
- the saveable part to saveconfirm
- whether the user should be prompted for confirmation of the save requestclosing
- whether the part will be closed after the save operation has completed, this may determine whether whether the save operation will actually be invoked or not- Returns:
true
if the saveable's contents has been persisted,false
otherwise- See Also:
-
saveEditor
Saves an editors in the workbench. Ifconfirm
istrue
the user is prompted to confirm the command.- Specified by:
saveEditor
in interfaceIWorkbenchPage
- Parameters:
confirm
- if user confirmation should be soughteditor
- the editor to close- Returns:
true
if the command succeeded, orfalse
if the user cancels the command
-
savePerspective
public void savePerspective()Description copied from interface:IWorkbenchPage
Saves the visible views, their layout, and the visible action sets for this page to the current perspective descriptor. The contents of the current perspective descriptor are overwritten.- Specified by:
savePerspective
in interfaceIWorkbenchPage
-
savePerspectiveAs
Description copied from interface:IWorkbenchPage
Saves the visible views, their layout, and the visible action sets for this page to the given perspective descriptor. The contents of the given perspective descriptor are overwritten and it is made the current one for this page.- Specified by:
savePerspectiveAs
in interfaceIWorkbenchPage
- Parameters:
perspective
- the perspective descriptor to save to
-
setEditorAreaVisible
public void setEditorAreaVisible(boolean showEditorArea) Description copied from interface:IWorkbenchPage
Show or hide the editor area for the page's active perspective.- Specified by:
setEditorAreaVisible
in interfaceIWorkbenchPage
- Parameters:
showEditorArea
-true
to show the editor area,false
to hide the editor area
-
setPerspective
Description copied from interface:IWorkbenchPage
Changes the visible views, their layout, and the visible action sets within the page to match the given perspective descriptor. This is a rearrangement of components and not a replacement. The contents of the old perspective descriptor are unaffected.When a perspective change occurs the old perspective is deactivated (hidden) and cached for future reference. Then the new perspective is activated (shown). The views within the page are shared by all existing perspectives to make it easy for the user to switch between one perspective and another quickly without loss of context.
During activation the action sets are modified. If an action set is specified in the new perspective which is not visible in the old one it will be created. If an old action set is not specified in the new perspective it will be disposed.
The visible views and their layout within the page also change. If a view is specified in the new perspective which is not visible in the old one a new instance of the view will be created. If an old view is not specified in the new perspective it will be hidden. This view may reappear if the user selects it from the View menu or if they switch to a perspective (which may be the old one) where the view is visible.
The open editors are not modified by this method.
- Specified by:
setPerspective
in interfaceIWorkbenchPage
- Parameters:
perspective
- the perspective descriptor
-
setWorkingSet
Deprecated.individual views should store a working set if neededSets the active working set for the workbench page. Notifies property change listener about the change.- Parameters:
newWorkingSet
- the active working set for the page. May be null.- Since:
- 2.0
-
showActionSet
Description copied from interface:IWorkbenchPage
Shows an action set in this page.In most cases where this method is used the caller is tightly coupled to a particular action set. They define it in the registry and may make it visible in certain scenarios by calling
showActionSet
. A static variable is often used to identify the action set id in caller code.- Specified by:
showActionSet
in interfaceIWorkbenchPage
- Parameters:
actionSetID
- the action set to show- See Also:
-
showView
See IWorkbenchPage.- Specified by:
showView
in interfaceIWorkbenchPage
- Parameters:
viewID
- the id of the view extension to use- Returns:
- the shown view
- Throws:
PartInitException
- if the view could not be initialized
-
showView
Description copied from interface:IWorkbenchPage
Shows a view in this page with the given id and secondary id. The behaviour of this method varies based on the supplied mode. IfVIEW_ACTIVATE
is supplied, the view is given focus. IfVIEW_VISIBLE
is supplied, then it is made visible but not given focus. Finally, ifVIEW_CREATE
is supplied the view is created and will only be made visible if it is not created in a folder that already contains visible views.This allows multiple instances of a particular view to be created. They are disambiguated using the secondary id. If a secondary id is given, the view must allow multiple instances by having specified allowMultiple="true" in its extension.
- Specified by:
showView
in interfaceIWorkbenchPage
- Parameters:
viewID
- the id of the view extension to usesecondaryID
- the secondary id to use, ornull
for no secondary idmode
- the activation mode. Must beIWorkbenchPage.VIEW_ACTIVATE
,IWorkbenchPage.VIEW_VISIBLE
orIWorkbenchPage.VIEW_CREATE
- Returns:
- a view
- Throws:
PartInitException
- if the view could not be initialized
-
getActiveElement
-
setPartState
Description copied from interface:IWorkbenchPage
Set the state of the given part reference. Setting the state of one part can effect the state of other parts.- Specified by:
setPartState
in interfaceIWorkbenchPage
- Parameters:
ref
- the workbench part reference. Must not benull
.iState
- one of the STATE_* constants.
-
getPartState
Description copied from interface:IWorkbenchPage
Returns the maximized/minimized/restored state of the given part reference.- Specified by:
getPartState
in interfaceIWorkbenchPage
- Parameters:
ref
- the workbench part to query. Must not benull
.- Returns:
- one of the STATE_* contants.
-
updateActionBars
public void updateActionBars()updateActionBars method comment. -
zoomOut
public void zoomOut()Description copied from interface:IWorkbenchPage
Zooms out the zoomed-in part. If the page does not have a zoomed part, it does nothing.- Specified by:
zoomOut
in interfaceIWorkbenchPage
-
toggleZoom
Description copied from interface:IWorkbenchPage
Zoom the page in on a part. If the part is already in zoom then zoom out.- Specified by:
toggleZoom
in interfaceIWorkbenchPage
- Parameters:
ref
- the workbench part to zoom in on. Must not benull
.
-
getOpenPerspectives
Description copied from interface:IWorkbenchPage
Returns the descriptors for the perspectives that are open in this page, in the order in which they were opened.- Specified by:
getOpenPerspectives
in interfaceIWorkbenchPage
- Returns:
- the open perspective descriptors, in order of opening
-
getSortedPerspectives
Description copied from interface:IWorkbenchPage
Returns the descriptors for the perspectives that are open in this page, in the order in which they were activated (oldest first).- Specified by:
getSortedPerspectives
in interfaceIWorkbenchPage
- Returns:
- the open perspective descriptors, in order of activation
-
getReference
Returns the reference to the given part, ornull
if it has no reference (i.e. it is not a top-level part in this workbench page).- Specified by:
getReference
in interfaceIWorkbenchPage
- Parameters:
part
- the part- Returns:
- the part's reference or
null
if the given part does not belong to this workbench page
-
getCurrentPerspective
-
getViewStack
Description copied from interface:IWorkbenchPage
Returns an array of IViewParts that are stacked with the given part in the currently active perspective.- Specified by:
getViewStack
in interfaceIWorkbenchPage
- Parameters:
part
- the part to test- Returns:
- the parts that are stacked with this part, including the part in
question.
null
is returned if the part does not belong to this page or the part is not contained in the active perspective. The parts are in LRU order.
-
getExtensionTracker
Description copied from interface:IWorkbenchPage
Return 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 only exist over the lifespan of a page. For example,
ViewPart
objects fall into this category.- Specified by:
getExtensionTracker
in interfaceIWorkbenchPage
- Returns:
- the extension tracker
- See Also:
-
getNewWizardShortcuts
Description copied from interface:IWorkbenchPage
Returns the new wizard shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Specified by:
getNewWizardShortcuts
in interfaceIWorkbenchPage
- Returns:
- an array of wizard identifiers
- See Also:
-
getPerspectiveShortcuts
Description copied from interface:IWorkbenchPage
Returns the perspective shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Specified by:
getPerspectiveShortcuts
in interfaceIWorkbenchPage
- Returns:
- an array of perspective identifiers
- See Also:
-
getShowViewShortcuts
Description copied from interface:IWorkbenchPage
Returns the show view shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Specified by:
getShowViewShortcuts
in interfaceIWorkbenchPage
- Returns:
- an array of view identifiers
- See Also:
-
isPartVisible
-
getWorkingSets
Description copied from interface:IWorkbenchPage
Return the visible working sets for this page. Please note that this array is not filtered by activities. Clients should attempt to ensure that any use of this method is consistant with the currently enabled activity set.- Specified by:
getWorkingSets
in interfaceIWorkbenchPage
- Returns:
- the visible working sets for this page
- See Also:
-
setWorkingSets
Description copied from interface:IWorkbenchPage
Set the working sets for this page. Any duplicate entries will be removed from the array by this method.- Specified by:
setWorkingSets
in interfaceIWorkbenchPage
- Parameters:
newWorkingSets
- the new working sets for this page. The array may be empty, but no element in the array may benull
.
-
getAggregateWorkingSet
Description copied from interface:IWorkbenchPage
Return a working set that contains all of the elements contained in the array of working sets provided byIWorkbenchPage.getWorkingSets()
. Should this array or the underlying elements in any of the working sets change this set will be updated.This working set is never
null
, even if there are no working sets assigned to this page viaIWorkbenchPage.setWorkingSets(IWorkingSet[])
. It is recommended that any client that uses this API be aware of this and act accordingly. Specifically, it is recommended that any client utilizing this or any other IWorkingSet whoseIWorkingSet.isAggregateWorkingSet()
returnstrue
act as if they are not using any working set if the set is empty. These clients should also maintain an awareness of the contents of aggregate working sets and toggle this behavior should the contents of the aggregate either become empty or non-empty.Example pseudocode showing how some workingset utilizing component could react to changes in aggregate working sets:
private IWorkingSet myWorkingSet; IPropertyChangeListener workingSetListener = new IPropertyChangeListener() { void propertyChange(PropertyChangeEvent event) { if (isMyCurrentWorkingSet(event)) { if (isEmptyAggregate(myWorkingSet)) { showNoSet(); } else { showSet(); } } } }; void setWorkingSet(IWorkingSet newSet) { myWorkingSet = newSet; if (myWorkingSet == null || isEmptyAggregate(myWorkingSet)){ showNoSet(); } else { showSet(); } }
- Specified by:
getAggregateWorkingSet
in interfaceIWorkbenchPage
- Returns:
- the aggregate working set for this page, this implements
IAggregateWorkingSet
- See Also:
-
showEditor
Description copied from interface:IWorkbenchPage
Add back an open but non-participating editor- Specified by:
showEditor
in interfaceIWorkbenchPage
- Parameters:
ref
- the editor to re-add. Must be an editor removed using #hideEditor(IEditorReference), must not have been closed, and must not benull
.- See Also:
-
hideEditor
Description copied from interface:IWorkbenchPage
Remove an open editor, turn it into a non-participating editor.A non-participating editor will not be returned in the list of open editors (
IWorkbenchPage.getEditorReferences()
) and will not be visible in the editor area. However, it will continue to participate in the save lifecycle and may still be closed by some workbench close events.Behaviour for hiding and showing editors from multiple stacks is not defined (and unsupported) at this time.
- Specified by:
hideEditor
in interfaceIWorkbenchPage
- Parameters:
ref
- the editor reference to remove. It must be a current open editor belonging to this page, and must not benull
.- See Also:
-
getEditorState
Description copied from interface:IWorkbenchPage
Return an IMemento containing the current state of the editor for each of the given references. These mementos may be used to determine the initial state of an editor on a subsequent open.- Specified by:
getEditorState
in interfaceIWorkbenchPage
- Parameters:
editorRefs
- The array of editor references to get the state forincludeInputState
- Iftrue
then the resulting memento will be contain the editor input's state as well as the editor's state.- Returns:
- The array of mementos. The length of the array will match that of the refs array.
-
openEditors
public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, int matchFlags) throws MultiPartInitException Description copied from interface:IWorkbenchPage
Opens editors for the given inputs. Only the editor constructed for the first input gets activated.The editor type is determined by mapping
editorIDs
to an editor extension registered with the workbench. An editor id is passed rather than an editor object to prevent the accidental creation of more than one editor for the same input. It also guarantees a consistent lifecycle for editors, regardless of whether they are created by the user or restored from saved data.The length of the input array and editor ID arrays must be the same. The editors are opened using pairs of { input[i], editorIDs[i] }.
- Specified by:
openEditors
in interfaceIWorkbenchPage
- Parameters:
inputs
- the editor inputseditorIDs
- the IDs of the editor extensions to use, in the order of inputsmatchFlags
- a bit mask consisting of zero or more of the MATCH_* constants OR-ed together- Returns:
- references to the editors constructed for the inputs. The editors corresponding to those reference might not be materialized.
- Throws:
MultiPartInitException
- if at least one editor could not be created or initialized- See Also:
-
openEditors
public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, IMemento[] mementos, int matchFlags, int activationIndex) throws MultiPartInitException Description copied from interface:IWorkbenchPage
Opens editors for the given inputs. Only the editor constructed for the given index will be activated.There are effectively two different ways to use this method based on what information the supplied mementos contain @see org.eclipse.ui.IWorkbenchPage #getEditorState(org.eclipse.ui.IEditorReference []):
- If the mementos contain the 'input' information then only the memento itself is required since it can be used to re-create the editor input and its editorID. If all the mementos are of this type then the inputs and editorIDs arrays may be null.
- If the supplied memento only contains the editor state then both the input and editorID must be non-null.
The editor type is determined by mapping
editorIDs
to an editor extension registered with the workbench. An editor id is passed rather than an editor object to prevent the accidental creation of more than one editor for the same input. It also guarantees a consistent lifecycle for editors, regardless of whether they are created by the user or restored from saved data.The length of the input array and editor ID arrays must be the same. The editors are opened using pairs of { input[i], editorIDs[i] }.
The mementos array mat be null but if not must match the input array in length. Entries in the mementos array may also be null if no state is desired for that particular editor.
- Specified by:
openEditors
in interfaceIWorkbenchPage
- Parameters:
inputs
- the editor inputseditorIDs
- the IDs of the editor extensions to use, in the order of inputsmementos
- the mementos representing the state to open the editor with. If the supplied memento contains the input's state as well as the editor's state then the corresponding entries in the 'inputs' and 'ids' arrays may benull
(they will be created from the supplied memento).matchFlags
- a bit mask consisting of zero or more of the MATCH_* constants OR-ed togetheractivationIndex
- the index of the editor to make active or -1 if no activation is desired.- Returns:
- references to the editors constructed for the inputs. The editors corresponding to those reference might not be materialized.
- Throws:
MultiPartInitException
- if at least one editor could not be created or initialized- See Also:
-
firePartOpened
public void firePartOpened(org.eclipse.ui.internal.e4.compatibility.CompatibilityPart compatibilityPart) -
firePartClosed
public void firePartClosed(org.eclipse.ui.internal.e4.compatibility.CompatibilityPart compatibilityPart) -
firePartHidden
-
firePartInputChanged
-
getEditorReuseThreshold
public int getEditorReuseThreshold()Description copied from interface:IWorkbenchPage
Returns the number of open editors before reusing editors.- Specified by:
getEditorReuseThreshold
in interfaceIWorkbenchPage
- Returns:
- a int
-
setEditorReuseThreshold
public void setEditorReuseThreshold(int openEditors) Description copied from interface:IWorkbenchPage
Set the number of open editors before reusing editors. If < 0 the user preference settings will be used.- Specified by:
setEditorReuseThreshold
in interfaceIWorkbenchPage
- Parameters:
openEditors
- the threshold
-
openEditorFromDescriptor
public IEditorPart openEditorFromDescriptor(IEditorInput fileEditorInput, IEditorDescriptor editorDescriptor, boolean activate, IMemento editorState) throws PartInitException Opens an editor represented by the descriptor with the given input.- Parameters:
fileEditorInput
- the input that the editor should openeditorDescriptor
- the descriptor of the editor to openactivate
-true
if the editor should be activated,false
otherwiseeditorState
- the previously saved state of the editor as a memento, this may benull
- Returns:
- the opened editor
- Throws:
PartInitException
- if the editor could not be created or initialized
-
getHiddenItems
-
addHiddenItems
-
addHiddenItems
-
removeHiddenItems
-
removeHiddenItems
-
setNewShortcuts
-
resetToolBarLayout
public void resetToolBarLayout() -
firePartDeactivatedIfActive
FiresIPartListener2.partDeactivated(IWorkbenchPartReference)
if the passed part is the currently active part according to the part service. This method should only be called in the case of workbench shutdown, where E4 does not fire deactivate listeners on the active part.
-