Interface IWorkbenchPage
- All Superinterfaces:
IPartService
,ISelectionService
- All Known Implementing Classes:
WorkbenchPage
A page can contain 0 or more views and 0 or more editors. These views and editors are contained wholly within the page and are not shared with other pages. The layout and visible action set for the page is defined by a perspective.
The number of views and editors within a page is restricted to simplify part management for the user. In particular:
- Unless a view explicitly allows for multiple instances in its plug-in declaration there will be only one instance in a given workbench page.
- Only one editor can exist for each editor input within a page.
This interface is not intended to be implemented by clients.
- See Also:
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Change event id when an action set is hidden in a perspective.static final String
Change event id when an action set is shown in a perspective.static final String
Change event id when the editor area is hidden in a perspective.static final String
Change event id when the editor area is shown in a perspective.static final String
Change event id when one or more editors are closed in a perspective.static final String
Change event id when one or more editors are opened in a perspective.static final String
Change event id when a fast view is added in a perspective.static final String
Change event id when a fast view is removed in a perspective.static final String
Change event id when the perspective is reset to its original state.static final String
Change event id when the perspective has completed a reset to its original state.static final String
Change event id when one or more views are hidden in a perspective.static final String
Change event id when one or more views are shown in a perspective.static final String
Change event id when the page working set was replacedstatic final String
Change event id when the page working set list was replacedstatic final String
Deprecated.in 3.0 since the notion of markers this is not generally applicable.static final int
Editor opening match mode specifying that the editor id should be considered when matching against existing editors.static final int
Editor opening match mode specifying that the editor selection strategy should ignore file sizestatic final int
Editor opening match mode specifying that the editor input should be considered when matching against existing editors.static final int
Editor opening match mode specifying that no matching against existing editors should be done.static final int
State of a view in a given page when the page is zoomed in on the view stack.static final int
State of a view in a given page when the view stack is minimized.static final int
State of a view in a given page when the view stack is in it's normal state.static final int
Show view mode that indicates the view should be made visible and activated.static final int
Show view mode that indicates the view should be made created but not necessarily be made visible.static final int
Show view mode that indicates the view should be made visible. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(IWorkbenchPart part) Activates the given part.void
Deprecated.client should register listeners on the instance ofIWorkingSetManager
returned byIWorkbench.getWorkingSetManager()
instead.void
bringToTop
(IWorkbenchPart part) Moves the given part forward in the Z order of this page so as to make it visible, without changing which part has focus.boolean
close()
Closes this workbench page.boolean
closeAllEditors
(boolean save) Closes all of the editors belonging to this workbench page.void
closeAllPerspectives
(boolean saveEditors, boolean closePage) Closes all perspectives in this page.boolean
closeEditor
(IEditorPart editor, boolean save) Closes the given editor.boolean
closeEditors
(IEditorReference[] editorRefs, boolean save) Closes the givenArray
of editor references.void
closePerspective
(IPerspectiveDescriptor desc, boolean saveParts, boolean closePage) Closes the specified perspective in this page.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.Returns the view in this page with the specified id.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.Returns the active editor open in this page.Return a working set that contains all of the elements contained in the array of working sets provided bygetWorkingSets()
.Returns a list of dirty editors in this page.Returns an array of references to open editors in this page.int
Deprecated.Deprecated.Clients are encouraged to usegetEditorReferences()
instead.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 current perspective descriptor for this page, ornull
if there is no current perspective.String[]
Returns the perspective shortcuts associated with the current perspective.getReference
(IWorkbenchPart part) Find the part reference for the given part.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).Returns a list of the reference to views visible on this page.getViews()
Deprecated.Clients are encouraged to usegetViewReferences()
instead.getViewStack
(IViewPart part) Returns an array of IViewParts that are stacked with the given part in the currently active perspective.Returns the workbench window of this page.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
Returns whether the page's current perspective is showing the editor area.boolean
isEditorPinned
(IEditorPart editor) Returnstrue
if the editor is pinned and should not be reused.boolean
Returns the page "zoomed" state.boolean
isPartVisible
(IWorkbenchPart part) Returns whether the specified part is visible.openEditor
(IEditorInput input, String editorId) Opens an editor on the given input.openEditor
(IEditorInput input, String editorId, boolean activate) Opens an editor on the given input.openEditor
(IEditorInput input, String editorId, boolean activate, int matchFlags) Opens an editor on 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 activateIndex) Opens editors for the given inputs.void
Removes the property change listener.void
Changes the visible views, their layout, and the visible action sets within the page to match the current perspective descriptor.void
reuseEditor
(IReusableEditor editor, IEditorInput input) Reuses the specified editor by setting its new input.boolean
saveAllEditors
(boolean confirm) Saves the contents of all dirty editors belonging to this workbench page.boolean
saveEditor
(IEditorPart editor, boolean confirm) Saves the contents of the given editor if dirty.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.void
setEditorAreaVisible
(boolean showEditorArea) Show or hide the editor area for the page's active perspective.void
setEditorReuseThreshold
(int openEditors) Deprecated.use IPageLayout.setEditorReuseThreshold(int openEditors) instead.void
setPartState
(IWorkbenchPartReference ref, int state) 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
setWorkingSets
(IWorkingSet[] sets) 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 editorShows the view identified by the given view id in this page and gives it focus.Shows a view in this page with the given id and secondary id.void
Zoom the page in on a part.void
zoomOut()
Zooms out the zoomed-in part.Methods inherited from interface org.eclipse.ui.IPartService
addPartListener, addPartListener, getActivePart, getActivePartReference, removePartListener, removePartListener
Methods inherited from interface org.eclipse.ui.ISelectionService
addPostSelectionListener, addPostSelectionListener, addSelectionListener, addSelectionListener, getSelection, getSelection, removePostSelectionListener, removePostSelectionListener, removeSelectionListener, removeSelectionListener
-
Field Details
-
EDITOR_ID_ATTR
Deprecated.in 3.0 since the notion of markers this is not generally applicable. Use the IDE-specific constantIDE.EDITOR_ID_ATTR
.An optional attribute within a workspace marker (IMarker
) which identifies the preferred editor type to be opened whenopenEditor
is called. -
CHANGE_RESET
Change event id when the perspective is reset to its original state.- See Also:
-
CHANGE_RESET_COMPLETE
Change event id when the perspective has completed a reset to its original state.- Since:
- 3.0
- See Also:
-
CHANGE_VIEW_SHOW
Change event id when one or more views are shown in a perspective.- See Also:
-
CHANGE_VIEW_HIDE
Change event id when one or more views are hidden in a perspective.- See Also:
-
CHANGE_EDITOR_OPEN
Change event id when one or more editors are opened in a perspective.- See Also:
-
CHANGE_EDITOR_CLOSE
Change event id when one or more editors are closed in a perspective.- See Also:
-
CHANGE_EDITOR_AREA_SHOW
Change event id when the editor area is shown in a perspective.- See Also:
-
CHANGE_EDITOR_AREA_HIDE
Change event id when the editor area is hidden in a perspective.- See Also:
-
CHANGE_ACTION_SET_SHOW
Change event id when an action set is shown in a perspective.- See Also:
-
CHANGE_ACTION_SET_HIDE
Change event id when an action set is hidden in a perspective.- See Also:
-
CHANGE_FAST_VIEW_ADD
Change event id when a fast view is added in a perspective.- See Also:
-
CHANGE_FAST_VIEW_REMOVE
Change event id when a fast view is removed in a perspective.- See Also:
-
CHANGE_WORKING_SET_REPLACE
Change event id when the page working set was replaced- See Also:
-
CHANGE_WORKING_SETS_REPLACE
Change event id when the page working set list was replaced- Since:
- 3.2
- See Also:
-
VIEW_ACTIVATE
static final int VIEW_ACTIVATEShow view mode that indicates the view should be made visible and activated. Use of this mode has the same effect as callingshowView(String)
.- Since:
- 3.0
- See Also:
-
VIEW_VISIBLE
static final int VIEW_VISIBLEShow view mode that indicates the view should be made visible. If the view is opened in the container that contains the active view then this has the same effect asVIEW_CREATE
.- Since:
- 3.0
- See Also:
-
VIEW_CREATE
static final int VIEW_CREATEShow view mode that indicates the view should be made created but not necessarily be made visible. It will only be made visible in the event that it is opened in its own container. In other words, only if it is not stacked with another view.- Since:
- 3.0
- See Also:
-
MATCH_NONE
static final int MATCH_NONEEditor opening match mode specifying that no matching against existing editors should be done.- Since:
- 3.2
- See Also:
-
MATCH_INPUT
static final int MATCH_INPUTEditor opening match mode specifying that the editor input should be considered when matching against existing editors.- Since:
- 3.2
- See Also:
-
MATCH_ID
static final int MATCH_IDEditor opening match mode specifying that the editor id should be considered when matching against existing editors.- Since:
- 3.2
- See Also:
-
MATCH_IGNORE_SIZE
static final int MATCH_IGNORE_SIZEEditor opening match mode specifying that the editor selection strategy should ignore file size- Since:
- 3.125
- See Also:
-
STATE_MINIMIZED
static final int STATE_MINIMIZEDState of a view in a given page when the view stack is minimized.- Since:
- 3.2
- See Also:
-
STATE_MAXIMIZED
static final int STATE_MAXIMIZEDState of a view in a given page when the page is zoomed in on the view stack.- Since:
- 3.2
- See Also:
-
STATE_RESTORED
static final int STATE_RESTOREDState of a view in a given page when the view stack is in it's normal state.- Since:
- 3.2
- See Also:
-
-
Method Details
-
activate
Activates the given part. The part will be brought to the front and given focus. The part must belong to this page.- Parameters:
part
- the part to activate
-
addPropertyChangeListener
Deprecated.client should register listeners on the instance ofIWorkingSetManager
returned byIWorkbench.getWorkingSetManager()
instead.Adds a property change listener.- Parameters:
listener
- the property change listener to add- Since:
- 2.0
-
bringToTop
Moves the given part forward in the Z order of this page so as to make it visible, without changing which part has focus. The part must belong to this page.- Parameters:
part
- the part to bring forward
-
close
boolean close()Closes this workbench page. If this page is the active one, this honor is passed along to one of the window's other pages if possible.If the page has an open editor with unsaved content, the user will be given the opportunity to save it.
- Returns:
true
if the page was successfully closed, andfalse
if it is still open
-
closeAllEditors
boolean closeAllEditors(boolean save) Closes all of the editors belonging to this workbench page.If the page has open editors with unsaved content and
save
istrue
, the user will be given the opportunity to save them.- 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
Closes the givenArray
of editor references. The editors must belong to this workbench page.If any of the editors have unsaved content and
save
istrue
, the user will be given the opportunity to save them.- Parameters:
editorRefs
- 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- Since:
- 3.0
-
closeEditor
Closes the given editor. The editor must belong to this workbench page.If the editor has unsaved content and
save
istrue
, the user will be given the opportunity to save it.- 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
-
findView
Returns the view in this page with the specified id. There is at most one view in the page with the specified id.- Parameters:
viewId
- the id of the view extension to use- Returns:
- the view, or
null
if none is found
-
findViewReference
Returns the view reference with the specified id.- Parameters:
viewId
- the id of the view extension to use- Returns:
- the view reference, or
null
if none is found - Since:
- 3.0
-
findViewReference
Returns the view reference with the specified id and secondary id.- 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 - Since:
- 3.0
-
getActiveEditor
IEditorPart getActiveEditor()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.
- Returns:
- the active editor, or
null
if no editor is active
-
findEditor
Returns the editor with the specified input. Returns null if there is no opened editor with that input.- Parameters:
input
- the editor input- Returns:
- an editor with input equals to
input
-
findEditors
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.- 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
- Since:
- 3.2
- See Also:
-
getEditors
Deprecated.Clients are encouraged to usegetEditorReferences()
instead. Calling this method has the side effect of restoring all the editors in the page which can cause plug-in activation.Returns a list of the editors open in this page.Note that each page has its own editors; editors are never shared between pages.
- Returns:
- a list of open editors
-
getEditorReferences
IEditorReference[] getEditorReferences()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.
- Returns:
- a list of open editors
-
getDirtyEditors
IEditorPart[] getDirtyEditors()Returns a list of dirty editors in this page.- Returns:
- a list of dirty editors
-
getInput
IAdaptable getInput()Returns the input for this page.- Returns:
- the input for this page, or
null
if none
-
getLabel
String getLabel()Returns the page label. This will be a unique identifier within the containing workbench window.- Returns:
- the page label
-
getPerspective
IPerspectiveDescriptor getPerspective()Returns the current perspective descriptor for this page, ornull
if there is no current perspective.- Returns:
- the current perspective descriptor or
null
- See Also:
-
getViewReferences
IViewReference[] getViewReferences()Returns a list of the reference to views visible on this page.Note that each page has its own views; views are never shared between pages.
- Returns:
- a list of references to visible views
-
getViews
Deprecated.Clients are encouraged to usegetViewReferences()
instead. Calling this method has the side effect of restoring all the views in the page which can cause plug-in activation.Returns a list of the views visible on this page.Note that each page has its own views; views are never shared between pages.
- Returns:
- a list of visible views
-
getWorkbenchWindow
IWorkbenchWindow getWorkbenchWindow()Returns the workbench window of this page.- Returns:
- the workbench window
-
getWorkingSet
Deprecated.individual views should store a working set if neededReturns the working set of this page.- Returns:
- the working set of this page.
- Since:
- 2.0
-
hideActionSet
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.- Parameters:
actionSetID
- the action set to hide
-
hideView
Hides the given view. The view must belong to this page.- Parameters:
view
- the view to hide
-
hideView
Hides the given view that belongs to the reference, if any.- Parameters:
view
- the references whos view is to be hidden- Since:
- 3.0
-
isPartVisible
Returns whether the specified part is visible.- Parameters:
part
- the part to test- Returns:
- boolean
true
if part is visible
-
isEditorAreaVisible
boolean isEditorAreaVisible()Returns whether the page's current perspective is showing the editor area.- Returns:
true
when editor area visible,false
otherwise
-
reuseEditor
Reuses the specified editor by setting its new input.- Parameters:
editor
- the editor to be reusedinput
- the new input for the reusable editor
-
openEditor
Opens an editor on the given input.If this page already has an editor open on the target input that editor is activated; otherwise, a new editor is opened. Two editor inputs, input1 and input2, are considered the same if
input1.equals(input2) == true
The editor type is determined by mapping
editorId
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.- 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
IEditorPart openEditor(IEditorInput input, String editorId, boolean activate) throws PartInitException Opens an editor on the given input.If this page already has an editor open on the target input that editor is brought to the front; otherwise, a new editor is opened. Two editor inputs are considered the same if they equal. See
Object.equals(Object)
andIEditorInput
. Ifactivate == true
the editor will be activated.The editor type is determined by mapping
editorId
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.- 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
IEditorPart openEditor(IEditorInput input, String editorId, boolean activate, int matchFlags) throws PartInitException Opens an editor on the given input.If this page already has an editor open that matches the given input and/or editor id (as specified by the matchFlags argument), that editor is brought to the front; otherwise, a new editor is opened. Two editor inputs are considered the same if they equal. See
Object.equals(Object)
andIEditorInput
. Ifactivate == true
the editor will be activated.The editor type is determined by mapping
editorId
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.- 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- Since:
- 3.2
- See Also:
-
removePropertyChangeListener
Removes the property change listener.- Parameters:
listener
- the property change listener to remove- Since:
- 2.0
-
resetPerspective
void resetPerspective()Changes the visible views, their layout, and the visible action sets within the page to match the current perspective descriptor. This is a rearrangement of components and not a replacement. The contents of the current perspective descriptor are unaffected.For more information on perspective change see
setPerspective()
. -
saveAllEditors
boolean saveAllEditors(boolean confirm) Saves the contents of all dirty editors belonging to this workbench page. If there are no dirty editors this method returns without effect.If
confirm
istrue
the user is prompted to confirm the command.Note that as of 3.2, this method also saves views that implement ISaveablePart and are dirty.
- 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
-
saveEditor
Saves the contents of the given editor if dirty. If not, this method returns without effect.If
confirm
istrue
the user is prompted to confirm the command. Otherwise, the save happens without prompt.The editor must belong to this workbench page.
- Parameters:
editor
- the editor to closeconfirm
-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 editor was not saved
-
savePerspective
void savePerspective()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. -
savePerspectiveAs
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.- Parameters:
perspective
- the perspective descriptor to save to
-
setEditorAreaVisible
void setEditorAreaVisible(boolean showEditorArea) Show or hide the editor area for the page's active perspective.- Parameters:
showEditorArea
-true
to show the editor area,false
to hide the editor area
-
setPerspective
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.
- Parameters:
perspective
- the perspective descriptor
-
showActionSet
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.- Parameters:
actionSetID
- the action set to show
-
showView
Shows the view identified by the given view id in this page and gives it focus. If there is a view identified by the given view id (and with no secondary id) already open in this page, it is given focus.- Parameters:
viewId
- the id of the view extension to use- Returns:
- the shown view
- Throws:
PartInitException
- if the view could not be initialized
-
showView
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.
- Parameters:
viewId
- the id of the view extension to usesecondaryId
- the secondary id to use, ornull
for no secondary idmode
- the activation mode. Must beVIEW_ACTIVATE
,VIEW_VISIBLE
orVIEW_CREATE
- Returns:
- a view
- Throws:
PartInitException
- if the view could not be initializedIllegalArgumentException
- if the supplied mode is not valid- Since:
- 3.0
-
isEditorPinned
Returnstrue
if the editor is pinned and should not be reused.- Parameters:
editor
- the editor to test- Returns:
- boolean whether the editor is pinned
-
getEditorReuseThreshold
Deprecated.Returns the number of open editors before reusing editors.- Returns:
- a int
-
setEditorReuseThreshold
Deprecated.use IPageLayout.setEditorReuseThreshold(int openEditors) instead.Set the number of open editors before reusing editors. If < 0 the user preference settings will be used.- Parameters:
openEditors
- the threshold
-
getViewStack
Returns an array of IViewParts that are stacked with the given part in the currently active perspective.- 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. - Since:
- 3.0
-
getNewWizardShortcuts
String[] getNewWizardShortcuts()Returns the new wizard shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Returns:
- an array of wizard identifiers
- Since:
- 3.1
- See Also:
-
getPerspectiveShortcuts
String[] getPerspectiveShortcuts()Returns the perspective shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Returns:
- an array of perspective identifiers
- Since:
- 3.1
- See Also:
-
getShowViewShortcuts
String[] getShowViewShortcuts()Returns the show view shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.- Returns:
- an array of view identifiers
- Since:
- 3.1
- See Also:
-
getOpenPerspectives
IPerspectiveDescriptor[] getOpenPerspectives()Returns the descriptors for the perspectives that are open in this page, in the order in which they were opened.- Returns:
- the open perspective descriptors, in order of opening
- Since:
- 3.1
-
getSortedPerspectives
IPerspectiveDescriptor[] getSortedPerspectives()Returns the descriptors for the perspectives that are open in this page, in the order in which they were activated (oldest first).- Returns:
- the open perspective descriptors, in order of activation
- Since:
- 3.1
-
closePerspective
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
.- 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- Since:
- 3.1
-
closeAllPerspectives
void closeAllPerspectives(boolean saveEditors, boolean closePage) 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
.- Parameters:
saveEditors
- whether the page's editors should be savedclosePage
- whether the page itself should be closed- Since:
- 3.1
-
getExtensionTracker
IExtensionTracker getExtensionTracker()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.- Returns:
- the extension tracker
- Since:
- 3.1
- See Also:
-
getWorkingSets
IWorkingSet[] getWorkingSets()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.- Returns:
- the visible working sets for this page
- Since:
- 3.2
- See Also:
-
setWorkingSets
Set the working sets for this page. Any duplicate entries will be removed from the array by this method.- Parameters:
sets
- the new working sets for this page. The array may be empty, but no element in the array may benull
.- Since:
- 3.2
-
getAggregateWorkingSet
IWorkingSet getAggregateWorkingSet()Return a working set that contains all of the elements contained in the array of working sets provided bygetWorkingSets()
. 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 viasetWorkingSets(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(); } }
- Returns:
- the aggregate working set for this page, this implements
IAggregateWorkingSet
- Since:
- 3.2
- See Also:
-
isPageZoomed
boolean isPageZoomed()Returns the page "zoomed" state.- Returns:
true
if the page is zoomed in the workbench window,false
otherwise.- Since:
- 3.2
-
zoomOut
void zoomOut()Zooms out the zoomed-in part. If the page does not have a zoomed part, it does nothing.- Since:
- 3.2
-
toggleZoom
Zoom the page in on a part. If the part is already in zoom then zoom out.- Parameters:
ref
- the workbench part to zoom in on. Must not benull
.- Since:
- 3.2
-
getPartState
Returns the maximized/minimized/restored state of the given part reference.- Parameters:
ref
- the workbench part to query. Must not benull
.- Returns:
- one of the STATE_* contants.
- Since:
- 3.2
-
setPartState
Set the state of the given part reference. Setting the state of one part can effect the state of other parts.- Parameters:
ref
- the workbench part reference. Must not benull
.state
- one of the STATE_* constants.- Since:
- 3.2
-
getReference
Find the part reference for the given part. A convenience method to quickly go from part to part reference.- Parameters:
part
- The part to search for. It can benull
.- Returns:
- The reference for the given part, or
null
if no reference can be found. - Since:
- 3.2
-
showEditor
Add back an open but non-participating editor- Parameters:
ref
- the editor to re-add. Must be an editor removed using #hideEditor(IEditorReference), must not have been closed, and must not benull
.- Since:
- 3.5
- See Also:
-
hideEditor
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 (
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.
- Parameters:
ref
- the editor reference to remove. It must be a current open editor belonging to this page, and must not benull
.- Since:
- 3.5
- See Also:
-
openEditors
IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, int matchFlags) throws MultiPartInitException 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] }.
- 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- Since:
- 3.5
- See Also:
-
openEditors
IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, IMemento[] mementos, int matchFlags, int activateIndex) throws MultiPartInitException 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.
- 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 togetheractivateIndex
- 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- Since:
- 3.8.2
- See Also:
-
getEditorState
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.- 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.
- Since:
- 3.8.2
-