Class WorkbenchPage
- All Implemented Interfaces:
IPartService,ISelectionService,IWorkbenchPage
-
Field Summary
FieldsFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(IWorkbenchPart part) Activates a part.voidaddEditorReference(EditorReference editorReference) voidaddHiddenItems(String id) voidaddHiddenItems(MPerspective perspective, String id) voidAdds an IPartListener to the part service.voidAdds an IPartListener to the part service.voidaddPostSelectionListener(String partId, ISelectionListener listener) Adds a part-specific selection listener which is notified when selection changes in the part with the given id.voidaddPostSelectionListener(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.voidDeprecated.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.voidaddSelectionListener(String partId, ISelectionListener listener) Adds a part-specific selection listener which is notified when selection changes in the part with the given id.voidaddSelectionListener(ISelectionListener listener) Adds the given selection listener.voidaddViewReference(ViewReference reference) voidbringToTop(IWorkbenchPart part) Moves a part forward in the Z order of a perspective so it is visible.protected IViewPartbusyShowView(String viewId, int mode) Shows a view.booleanclose()Closes this page.booleancloseAllEditors(boolean save) See IWorkbenchPagevoidcloseAllPerspectives(boolean saveEditors, boolean closePage) Closes all perspectives in this page.booleanbooleancloseEditor(IEditorPart editor, boolean save) See IWorkbenchPage#closeEditorbooleancloseEditor(IEditorReference editor) booleancloseEditor(IEditorReference editorRef, boolean save) booleancloseEditors(IEditorReference[] refArray, boolean save) See IWorkbenchPagevoidclosePerspective(IPerspectiveDescriptor desc, boolean saveParts, boolean closePage) Closes the specified perspective in this page.voidclosePerspective(IPerspectiveDescriptor desc, String perspectiveId, boolean saveParts, boolean closePage) createEditorReferenceForPart(MPart part, IEditorInput input, String editorId, IMemento memento) voidcreateViewReferenceForPart(MPart part, String viewId) voiddispose()Cleanup.booleanfindEditor(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.voidfirePartClosed(org.eclipse.ui.internal.e4.compatibility.CompatibilityPart compatibilityPart) voidFiresIPartListener2.partDeactivated(IWorkbenchPartReference)if the passed part is the currently active part according to the part service.voidfirePartHidden(MPart part) voidfirePartInputChanged(IWorkbenchPartReference partReference) voidfirePartOpened(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.intReturns 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.intReturns 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, ornullif 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.voidhideActionSet(String actionSetID) Hides an action set in this page.voidRemove an open editor, turn it into a non-participating editor.voidHides the given view.voidhideView(IViewReference view) Hides the given view that belongs to the reference, if any.booleanSee IWorkbenchPage.booleanisEditorPinned(IEditorPart editor) See IWorkbenchPage.booleanReturns the page "zoomed" state.booleanisPartVisible(IWorkbenchPart part) See IWorkbenchPage.booleanisPartVisible(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.voidperformedShowIn(String partId) The user successfully performed a Show In... action on the specified part.voidvoidremoveHiddenItems(MPerspective perspective, String id) voidRemoves an IPartListener from the part service.voidRemoves an IPartListener from the part service.voidremovePostSelectionListener(String partId, ISelectionListener listener) Removes the given part-specific post selection listener.voidRemoves the given post selection listener.voidDeprecated.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.voidremoveSelectionListener(String partId, ISelectionListener listener) Removes the given part-specific selection listener.voidremoveSelectionListener(ISelectionListener listener) Removes the given selection listener.voidResets the layout for the perspective.voidvoidvoidreuseEditor(IReusableEditor editor, IEditorInput input) See IWorkbenchPage.static booleansaveAll(List<IWorkbenchPart> dirtyParts, boolean confirm, boolean closing, boolean addNonPartSources, IRunnableContext runnableContext, IWorkbenchWindow workbenchWindow) booleansaveAllEditors(boolean confirm) See IWorkbenchPagebooleansaveAllEditors(boolean confirm, boolean closing, boolean addNonPartSources) booleansaveEditor(IEditorPart editor, boolean confirm) Saves an editors in the workbench.voidSaves the visible views, their layout, and the visible action sets for this page to the current perspective descriptor.voidsavePerspectiveAs(IPerspectiveDescriptor perspective) Saves the visible views, their layout, and the visible action sets for this page to the given perspective descriptor.booleansaveSaveable(ISaveablePart saveable, IWorkbenchPart part, boolean confirm, boolean closing) Saves the contents of the provided saveable and returns whether the operation succeeded or not.voidvoidvoidsetEditorAreaVisible(boolean showEditorArea) Show or hide the editor area for the page's active perspective.voidsetEditorReuseThreshold(int openEditors) Set the number of open editors before reusing editors.voidsetNewShortcuts(List<String> wizards, String tagPrefix) voidsetPartState(IWorkbenchPartReference ref, int iState) Set the state of the given part reference.voidsetPerspective(IPerspectiveDescriptor perspective) Changes the visible views, their layout, and the visible action sets within the page to match the given perspective descriptor.voidsetup(MApplication application, EModelService modelService, IEventBroker broker, MWindow window, EPartService partService) voidsetWorkingSet(IWorkingSet newWorkingSet) Deprecated.individual views should store a working set if neededvoidsetWorkingSets(IWorkingSet[] newWorkingSets) Set the working sets for this page.voidshowActionSet(String actionSetID) Shows an action set in this page.voidAdd back an open but non-participating editorSee IWorkbenchPage.Shows a view in this page with the given id and secondary id.voidsortShowInPartIds(ArrayList<?> partIds) Sorts the given collection of show in target part ids in MRU order.voidZoom the page in on a part.voidForces all perspectives on the page to zoom out.voidupdateActionBars method comment.voidupdateShowInSources(MPart part) voidzoomOut()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:
activatein interfaceIWorkbenchPage- Parameters:
part- the part to activate
-
addPartListener
Adds an IPartListener to the part service.- Specified by:
addPartListenerin interfaceIPartService- Parameters:
l- a part listener- See Also:
-
addPartListener
Adds an IPartListener to the part service.- Specified by:
addPartListenerin 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:
addPropertyChangeListenerin interfaceIWorkbenchPage- Parameters:
listener- the property change listener to add- Since:
- 2.0
- See Also:
-
addSelectionListener
Description copied from interface:ISelectionServiceAdds 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
SelectionListenerFactoryfor listeners that will only be called when the UI is visible to the user.- Specified by:
addSelectionListenerin interfaceISelectionService- Parameters:
listener- a selection listener- See Also:
-
addSelectionListener
Description copied from interface:ISelectionServiceAdds 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
nullselection, 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
SelectionListenerFactoryfor listeners that will only be called when the UI is visible to the user.- Specified by:
addSelectionListenerin interfaceISelectionService- Parameters:
partId- the id of the part to tracklistener- a selection listener- See Also:
-
addPostSelectionListener
Description copied from interface:ISelectionServiceAdds 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
SelectionListenerFactoryfor listeners that will only be called when the UI is visible to the user.- Specified by:
addPostSelectionListenerin interfaceISelectionService- Parameters:
listener- a selection listener- See Also:
-
addPostSelectionListener
Description copied from interface:ISelectionServiceAdds 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
nullselection, 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
SelectionListenerFactoryfor listeners that will only be called when the UI is visible to the user.- Specified by:
addPostSelectionListenerin 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:
bringToTopin 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:
closein interfaceIWorkbenchPage- Returns:
trueif the page was successfully closed, andfalseif it is still open
-
closeAllSavedEditors
public boolean closeAllSavedEditors() -
closeAllEditors
public boolean closeAllEditors(boolean save) See IWorkbenchPage- Specified by:
closeAllEditorsin interfaceIWorkbenchPage- Parameters:
save-trueto save the editor contents if required (recommended), andfalseto discard any unsaved changes- Returns:
trueif all editors were successfully closed, andfalseif at least one is still open
-
closeEditors
See IWorkbenchPage- Specified by:
closeEditorsin interfaceIWorkbenchPage- Parameters:
refArray- the editors to closesave-trueto save the editor contents if required (recommended), andfalseto discard any unsaved changes- Returns:
trueif the editors were successfully closed, andfalseif the editors are still open
-
closeEditor
-
closeEditor
-
closeEditor
See IWorkbenchPage#closeEditor- Specified by:
closeEditorin interfaceIWorkbenchPage- Parameters:
editor- the editor to closesave-trueto save the editor contents if required (recommended), andfalseto discard any unsaved changes- Returns:
trueif the editor was successfully closed, andfalseif the editor is still open
-
closePerspective
Description copied from interface:IWorkbenchPageCloses 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. IfsavePartsistrue, the user will be prompted to save any unsaved changes for parts that are being closed. The page itself is closed ifclosePageistrue.- Specified by:
closePerspectivein 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:IWorkbenchPageCloses all perspectives in this page. All editors are closed, prompting to save any unsaved changes ifsaveEditorsistrue. The page itself is closed ifclosePageistrue.- Specified by:
closeAllPerspectivesin 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:
findViewin interfaceIWorkbenchPage- Parameters:
id- the id of the view extension to use- Returns:
- the view, or
nullif none is found
-
findViewReference
Description copied from interface:IWorkbenchPageReturns the view reference with the specified id.- Specified by:
findViewReferencein interfaceIWorkbenchPage- Parameters:
viewId- the id of the view extension to use- Returns:
- the view reference, or
nullif none is found
-
findViewReference
Description copied from interface:IWorkbenchPageReturns the view reference with the specified id and secondary id.- Specified by:
findViewReferencein interfaceIWorkbenchPage- Parameters:
viewId- the id of the view extension to usesecondaryId- the secondary id to use, ornullfor no secondary id- Returns:
- the view reference, or
nullif 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:IWorkbenchPageReturns 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:
getActiveEditorin interfaceIWorkbenchPage- Returns:
- the active editor, or
nullif no editor is active - See Also:
-
getActivePart
Description copied from interface:IPartServiceReturns the active part.- Specified by:
getActivePartin interfaceIPartService- Returns:
- the active part, or
nullif no part is currently active
-
getActivePartReference
Description copied from interface:IPartServiceReturns the active part reference.- Specified by:
getActivePartReferencein interfaceIPartService- Returns:
- the active part reference, or
nullif no part is currently active
-
getClientComposite
-
getDirtyEditors
Description copied from interface:IWorkbenchPageReturns a list of dirty editors in this page.- Specified by:
getDirtyEditorsin interfaceIWorkbenchPage- Returns:
- a list of dirty editors
-
findEditor
Description copied from interface:IWorkbenchPageReturns the editor with the specified input. Returns null if there is no opened editor with that input.- Specified by:
findEditorin interfaceIWorkbenchPage- Parameters:
input- the editor input- Returns:
- an editor with input equals to
input
-
findEditors
Description copied from interface:IWorkbenchPageReturns 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:
findEditorsin interfaceIWorkbenchPage- Parameters:
input- the editor input, ornullif MATCH_INPUT is not specified in matchFlagseditorId- the editor id, ornullif 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:IWorkbenchPageReturns 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:
getEditorsin interfaceIWorkbenchPage- Returns:
- a list of open editors
-
getEditorReferences
Description copied from interface:IWorkbenchPageReturns 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:
getEditorReferencesin interfaceIWorkbenchPage- Returns:
- a list of open editors
-
getSortedEditors
-
getSortedParts
-
getInput
Description copied from interface:IWorkbenchPageReturns the input for this page.- Specified by:
getInputin interfaceIWorkbenchPage- Returns:
- the input for this page, or
nullif none - See Also:
-
getLabel
Returns the page label. This is a combination of the page input and active perspective.- Specified by:
getLabelin interfaceIWorkbenchPage- Returns:
- the page label
-
getPerspective
Returns the perspective.- Specified by:
getPerspectivein interfaceIWorkbenchPage- Returns:
- the current perspective descriptor or
null - See Also:
-
getPerspectiveDesc
-
getSelection
Description copied from interface:ISelectionServiceReturns 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:
getSelectionin interfaceISelectionService- Returns:
- the current selection, or
nullif undefined
-
getSelection
Description copied from interface:ISelectionServiceReturns 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:
getSelectionin interfaceISelectionService- Parameters:
partId- the id of the part- Returns:
- the current selection, or
nullif 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:
getViewReferencesin interfaceIWorkbenchPage- Returns:
- a list of references to visible views
-
getViews
See IWorkbenchPage.- Specified by:
getViewsin interfaceIWorkbenchPage- Returns:
- a list of visible views
-
getWorkbenchWindow
See IWorkbenchPage.- Specified by:
getWorkbenchWindowin interfaceIWorkbenchPage- Returns:
- the workbench window
-
getWorkingSet
Deprecated.individual views should store a working set if neededImplements IWorkbenchPage- Specified by:
getWorkingSetin interfaceIWorkbenchPage- Returns:
- the working set of this page.
- Since:
- 2.0
- See Also:
-
hideActionSet
Description copied from interface:IWorkbenchPageHides 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:
hideActionSetin interfaceIWorkbenchPage- Parameters:
actionSetID- the action set to hide- See Also:
-
hideView
Description copied from interface:IWorkbenchPageHides the given view that belongs to the reference, if any.- Specified by:
hideViewin interfaceIWorkbenchPage- Parameters:
view- the references whos view is to be hidden
-
hideView
Description copied from interface:IWorkbenchPageHides the given view. The view must belong to this page.- Specified by:
hideViewin 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:
isPartVisiblein interfaceIWorkbenchPage- Parameters:
part- the part to test- Returns:
- boolean
trueif part is visible
-
isEditorAreaVisible
public boolean isEditorAreaVisible()See IWorkbenchPage.- Specified by:
isEditorAreaVisiblein interfaceIWorkbenchPage- Returns:
truewhen editor area visible,falseotherwise
-
isPageZoomed
public boolean isPageZoomed()Description copied from interface:IWorkbenchPageReturns the page "zoomed" state.- Specified by:
isPageZoomedin interfaceIWorkbenchPage- Returns:
trueif the page is zoomed in the workbench window,falseotherwise.
-
reuseEditor
See IWorkbenchPage.- Specified by:
reuseEditorin interfaceIWorkbenchPage- Parameters:
editor- the editor to be reusedinput- the new input for the reusable editor
-
openEditor
See IWorkbenchPage.- Specified by:
openEditorin interfaceIWorkbenchPage- Parameters:
input- the editor inputeditorID- the id of the editor extension to use- Returns:
- an open and active editor, or
nullif 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:
openEditorin interfaceIWorkbenchPage- Parameters:
input- the editor inputeditorID- the id of the editor extension to useactivate- iftruethe editor will be activated- Returns:
- an open editor, or
nullif 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:
openEditorin interfaceIWorkbenchPage- Parameters:
input- the editor inputeditorID- the id of the editor extension to useactivate- iftruethe editor will be activatedmatchFlags- a bit mask consisting of zero or more of the MATCH_* constants OR-ed together- Returns:
- an open editor, or
nullif 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-trueif the editor should be activated,falseotherwisematchFlags- 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 benullnotify-trueif the perspective should fire off events about the editors being opened,falseotherwise- Returns:
- the opened editor
- Throws:
PartInitException- if the editor could not be created or initialized
-
isEditorPinned
See IWorkbenchPage.- Specified by:
isEditorPinnedin interfaceIWorkbenchPage- Parameters:
editor- the editor to test- Returns:
- boolean whether the editor is pinned
-
removePartListener
Removes an IPartListener from the part service.- Specified by:
removePartListenerin interfaceIPartService- Parameters:
l- a part listener
-
removePartListener
Removes an IPartListener from the part service.- Specified by:
removePartListenerin 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:
removePropertyChangeListenerin interfaceIWorkbenchPage- Parameters:
listener- the property change listener to remove- Since:
- 2.0
- See Also:
-
removeSelectionListener
Description copied from interface:ISelectionServiceRemoves the given selection listener. Has no effect if an identical listener is not registered.- Specified by:
removeSelectionListenerin interfaceISelectionService- Parameters:
listener- a selection listener
-
removeSelectionListener
Description copied from interface:ISelectionServiceRemoves the given part-specific selection listener. Has no effect if an identical listener is not registered for the given part id.- Specified by:
removeSelectionListenerin interfaceISelectionService- Parameters:
partId- the id of the part to tracklistener- a selection listener
-
removePostSelectionListener
Description copied from interface:ISelectionServiceRemoves the given post selection listener. Has no effect if an identical listener is not registered.- Specified by:
removePostSelectionListenerin interfaceISelectionService- Parameters:
listener- a selection listener
-
removePostSelectionListener
Description copied from interface:ISelectionServiceRemoves the given part-specific post selection listener. Has no effect if an identical listener is not registered for the given part id.- Specified by:
removePostSelectionListenerin 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:
resetPerspectivein interfaceIWorkbenchPage
-
saveAllEditors
public boolean saveAllEditors(boolean confirm) See IWorkbenchPage- Specified by:
saveAllEditorsin interfaceIWorkbenchPage- Parameters:
confirm-trueto ask the user before saving unsaved changes (recommended), andfalseto save unsaved changes without asking- Returns:
trueif the command succeeded, andfalseif the operation was canceled by the user or an error occurred while saving
-
getDirtyParts
- Returns:
ISaveablePartobjects 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:
trueif the saveable's contents has been persisted,falseotherwise- See Also:
-
saveEditor
Saves an editors in the workbench. Ifconfirmistruethe user is prompted to confirm the command.- Specified by:
saveEditorin interfaceIWorkbenchPage- Parameters:
editor- the editor to closeconfirm- if user confirmation should be sought- Returns:
trueif the command succeeded, orfalseif the user cancels the command
-
savePerspective
public void savePerspective()Description copied from interface:IWorkbenchPageSaves 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:
savePerspectivein interfaceIWorkbenchPage
-
savePerspectiveAs
Description copied from interface:IWorkbenchPageSaves 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:
savePerspectiveAsin interfaceIWorkbenchPage- Parameters:
perspective- the perspective descriptor to save to
-
setEditorAreaVisible
public void setEditorAreaVisible(boolean showEditorArea) Description copied from interface:IWorkbenchPageShow or hide the editor area for the page's active perspective.- Specified by:
setEditorAreaVisiblein interfaceIWorkbenchPage- Parameters:
showEditorArea-trueto show the editor area,falseto hide the editor area
-
setPerspective
Description copied from interface:IWorkbenchPageChanges 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:
setPerspectivein 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:IWorkbenchPageShows 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:
showActionSetin interfaceIWorkbenchPage- Parameters:
actionSetID- the action set to show- See Also:
-
showView
See IWorkbenchPage.- Specified by:
showViewin 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:IWorkbenchPageShows a view in this page with the given id and secondary id. The behaviour of this method varies based on the supplied mode. IfVIEW_ACTIVATEis supplied, the view is given focus. IfVIEW_VISIBLEis supplied, then it is made visible but not given focus. Finally, ifVIEW_CREATEis 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:
showViewin interfaceIWorkbenchPage- Parameters:
viewID- the id of the view extension to usesecondaryID- the secondary id to use, ornullfor no secondary idmode- the activation mode. Must beIWorkbenchPage.VIEW_ACTIVATE,IWorkbenchPage.VIEW_VISIBLEorIWorkbenchPage.VIEW_CREATE- Returns:
- a view
- Throws:
PartInitException- if the view could not be initialized
-
getActiveElement
-
setPartState
Description copied from interface:IWorkbenchPageSet the state of the given part reference. Setting the state of one part can effect the state of other parts.- Specified by:
setPartStatein interfaceIWorkbenchPage- Parameters:
ref- the workbench part reference. Must not benull.iState- one of the STATE_* constants.
-
getPartState
Description copied from interface:IWorkbenchPageReturns the maximized/minimized/restored state of the given part reference.- Specified by:
getPartStatein 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:IWorkbenchPageZooms out the zoomed-in part. If the page does not have a zoomed part, it does nothing.- Specified by:
zoomOutin interfaceIWorkbenchPage
-
toggleZoom
Description copied from interface:IWorkbenchPageZoom the page in on a part. If the part is already in zoom then zoom out.- Specified by:
toggleZoomin interfaceIWorkbenchPage- Parameters:
ref- the workbench part to zoom in on. Must not benull.
-
getOpenPerspectives
Description copied from interface:IWorkbenchPageReturns the descriptors for the perspectives that are open in this page, in the order in which they were opened.- Specified by:
getOpenPerspectivesin interfaceIWorkbenchPage- Returns:
- the open perspective descriptors, in order of opening
-
getSortedPerspectives
Description copied from interface:IWorkbenchPageReturns the descriptors for the perspectives that are open in this page, in the order in which they were activated (oldest first).- Specified by:
getSortedPerspectivesin interfaceIWorkbenchPage- Returns:
- the open perspective descriptors, in order of activation
-
getReference
Returns the reference to the given part, ornullif it has no reference (i.e. it is not a top-level part in this workbench page).- Specified by:
getReferencein interfaceIWorkbenchPage- Parameters:
part- the part- Returns:
- the part's reference or
nullif the given part does not belong to this workbench page
-
getCurrentPerspective
-
getViewStack
Description copied from interface:IWorkbenchPageReturns an array of IViewParts that are stacked with the given part in the currently active perspective.- Specified by:
getViewStackin interfaceIWorkbenchPage- Parameters:
part- the part to test- Returns:
- the parts that are stacked with this part, including the part in
question.
nullis 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:IWorkbenchPageReturn 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,
ViewPartobjects fall into this category.- Specified by:
getExtensionTrackerin interfaceIWorkbenchPage- Returns:
- the extension tracker
- See Also:
-
getNewWizardShortcuts
Description copied from interface:IWorkbenchPageReturns the new wizard shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Specified by:
getNewWizardShortcutsin interfaceIWorkbenchPage- Returns:
- an array of wizard identifiers
- See Also:
-
getPerspectiveShortcuts
Description copied from interface:IWorkbenchPageReturns the perspective shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Specified by:
getPerspectiveShortcutsin interfaceIWorkbenchPage- Returns:
- an array of perspective identifiers
- See Also:
-
getShowViewShortcuts
Description copied from interface:IWorkbenchPageReturns the show view shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Specified by:
getShowViewShortcutsin interfaceIWorkbenchPage- Returns:
- an array of view identifiers
- See Also:
-
isPartVisible
-
getWorkingSets
Description copied from interface:IWorkbenchPageReturn 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:
getWorkingSetsin interfaceIWorkbenchPage- Returns:
- the visible working sets for this page
- See Also:
-
setWorkingSets
Description copied from interface:IWorkbenchPageSet the working sets for this page. Any duplicate entries will be removed from the array by this method.- Specified by:
setWorkingSetsin 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:IWorkbenchPageReturn 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()returnstrueact 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:
getAggregateWorkingSetin interfaceIWorkbenchPage- Returns:
- the aggregate working set for this page, this implements
IAggregateWorkingSet - See Also:
-
showEditor
Description copied from interface:IWorkbenchPageAdd back an open but non-participating editor- Specified by:
showEditorin 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:IWorkbenchPageRemove 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:
hideEditorin 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:IWorkbenchPageReturn 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:
getEditorStatein interfaceIWorkbenchPage- Parameters:
editorRefs- The array of editor references to get the state forincludeInputState- Iftruethen 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:IWorkbenchPageOpens editors for the given inputs. Only the editor constructed for the first input gets activated.The editor type is determined by mapping
editorIDsto 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:
openEditorsin 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:IWorkbenchPageOpens 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
editorIDsto 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:
openEditorsin 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:IWorkbenchPageReturns the number of open editors before reusing editors.- Specified by:
getEditorReuseThresholdin interfaceIWorkbenchPage- Returns:
- a int
-
setEditorReuseThreshold
public void setEditorReuseThreshold(int openEditors) Description copied from interface:IWorkbenchPageSet the number of open editors before reusing editors. If < 0 the user preference settings will be used.- Specified by:
setEditorReuseThresholdin 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-trueif the editor should be activated,falseotherwiseeditorState- 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.
-