public interface IWorkbenchPage extends IPartService, ISelectionService
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:
This interface is not intended to be implemented by clients.
IPerspectiveDescriptor
,
IEditorPart
,
IViewPart
Modifier and Type | Field and Description |
---|---|
static String |
CHANGE_ACTION_SET_HIDE
Change event id when an action set is hidden in a perspective.
|
static String |
CHANGE_ACTION_SET_SHOW
Change event id when an action set is shown in a perspective.
|
static String |
CHANGE_EDITOR_AREA_HIDE
Change event id when the editor area is hidden in a perspective.
|
static String |
CHANGE_EDITOR_AREA_SHOW
Change event id when the editor area is shown in a perspective.
|
static String |
CHANGE_EDITOR_CLOSE
Change event id when one or more editors are closed in a perspective.
|
static String |
CHANGE_EDITOR_OPEN
Change event id when one or more editors are opened in a perspective.
|
static String |
CHANGE_FAST_VIEW_ADD
Change event id when a fast view is added in a perspective.
|
static String |
CHANGE_FAST_VIEW_REMOVE
Change event id when a fast view is removed in a perspective.
|
static String |
CHANGE_RESET
Change event id when the perspective is reset to its original state.
|
static String |
CHANGE_RESET_COMPLETE
Change event id when the perspective has completed a reset to its
original state.
|
static String |
CHANGE_VIEW_HIDE
Change event id when one or more views are hidden in a perspective.
|
static String |
CHANGE_VIEW_SHOW
Change event id when one or more views are shown in a perspective.
|
static String |
CHANGE_WORKING_SET_REPLACE
Change event id when the page working set was replaced
|
static String |
CHANGE_WORKING_SETS_REPLACE
Change event id when the page working set list was replaced
|
static String |
EDITOR_ID_ATTR
Deprecated.
in 3.0 since the notion of markers this is not generally
applicable. Use the IDE-specific constant
IDE.EDITOR_ID_ATTR . |
static int |
MATCH_ID
Editor opening match mode specifying that the editor id should be
considered when matching against existing editors.
|
static int |
MATCH_INPUT
Editor opening match mode specifying that the editor input should be
considered when matching against existing editors.
|
static int |
MATCH_NONE
Editor opening match mode specifying that no matching against existing
editors should be done.
|
static int |
STATE_MAXIMIZED
State of a view in a given page when the page is zoomed in on the view
stack.
|
static int |
STATE_MINIMIZED
State of a view in a given page when the view stack is minimized.
|
static int |
STATE_RESTORED
State of a view in a given page when the view stack is in it's normal
state.
|
static int |
VIEW_ACTIVATE
Show view mode that indicates the view should be made visible and
activated.
|
static int |
VIEW_CREATE
Show view mode that indicates the view should be made created but not
necessarily be made visible.
|
static int |
VIEW_VISIBLE
Show view mode that indicates the view should be made visible.
|
Modifier and Type | Method and Description |
---|---|
void |
activate(IWorkbenchPart part)
Activates the given part.
|
void |
addPropertyChangeListener(IPropertyChangeListener listener)
Deprecated.
client should register listeners on the instance of
IWorkingSetManager returned by
IWorkbench.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 given
Array of editor references. |
void |
closePerspective(IPerspectiveDescriptor desc,
boolean saveParts,
boolean closePage)
Closes the specified perspective in this page.
|
IEditorPart |
findEditor(IEditorInput input)
Returns the editor with the specified input.
|
IEditorReference[] |
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.
|
IViewPart |
findView(String viewId)
Returns the view in this page with the specified id.
|
IViewReference |
findViewReference(String viewId)
Returns the view reference with the specified id.
|
IViewReference |
findViewReference(String viewId,
String secondaryId)
Returns the view reference with the specified id and secondary id.
|
IEditorPart |
getActiveEditor()
Returns the active editor open in this page.
|
IWorkingSet |
getAggregateWorkingSet()
Return a working set that contains all of the elements contained in the
array of working sets provided by
getWorkingSets() . |
IEditorPart[] |
getDirtyEditors()
Returns a list of dirty editors in this page.
|
IEditorReference[] |
getEditorReferences()
Returns an array of references to open editors in this page.
|
int |
getEditorReuseThreshold()
Deprecated.
|
IEditorPart[] |
getEditors()
Deprecated.
Clients are encouraged to use
getEditorReferences()
instead. Calling this method has the side effect of restoring
all the editors in the page which can cause plug-in
activation. |
IMemento[] |
getEditorState(IEditorReference[] editorRefs,
boolean includeInputState)
Return an IMemento containing the current state of the editor for each of
the given references.
|
IExtensionTracker |
getExtensionTracker()
Return the extension tracker for the workbench.
|
IAdaptable |
getInput()
Returns the input for this page.
|
String |
getLabel()
Returns the page label.
|
INavigationHistory |
getNavigationHistory()
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[] |
getNewWizardShortcuts()
Returns the new wizard shortcuts associated with the current perspective.
|
IPerspectiveDescriptor[] |
getOpenPerspectives()
Returns the descriptors for the perspectives that are open in this page,
in the order in which they were opened.
|
int |
getPartState(IWorkbenchPartReference ref)
Returns the maximized/minimized/restored state of the given part
reference.
|
IPerspectiveDescriptor |
getPerspective()
Returns the current perspective descriptor for this page, or
null if there is no current perspective. |
String[] |
getPerspectiveShortcuts()
Returns the perspective shortcuts associated with the current
perspective.
|
IWorkbenchPartReference |
getReference(IWorkbenchPart part)
Find the part reference for the given part.
|
String[] |
getShowViewShortcuts()
Returns the show view shortcuts associated with the current perspective.
|
IPerspectiveDescriptor[] |
getSortedPerspectives()
Returns the descriptors for the perspectives that are open in this page,
in the order in which they were activated (oldest first).
|
IViewReference[] |
getViewReferences()
Returns a list of the reference to views visible on this page.
|
IViewPart[] |
getViews()
Deprecated.
Clients are encouraged to use
getViewReferences()
instead. Calling this method has the side effect of restoring
all the views in the page which can cause plug-in activation. |
IViewPart[] |
getViewStack(IViewPart part)
Returns an array of IViewParts that are stacked with the given part.
|
IWorkbenchWindow |
getWorkbenchWindow()
Returns the workbench window of this page.
|
IWorkingSet |
getWorkingSet()
Deprecated.
individual views should store a working set if needed
|
IWorkingSet[] |
getWorkingSets()
Return the visible working sets for this page.
|
void |
hideActionSet(String actionSetID)
Hides an action set in this page.
|
void |
hideEditor(IEditorReference ref)
Remove an open editor, turn it into a non-participating editor.
|
void |
hideView(IViewPart view)
Hides the given view.
|
void |
hideView(IViewReference view)
Hides the given view that belongs to the reference, if any.
|
boolean |
isEditorAreaVisible()
Returns whether the page's current perspective is showing the editor
area.
|
boolean |
isEditorPinned(IEditorPart editor)
Returns
true if the editor is pinned and should not be
reused. |
boolean |
isPageZoomed()
Returns the page "zoomed" state.
|
boolean |
isPartVisible(IWorkbenchPart part)
Returns whether the specified part is visible.
|
IEditorPart |
openEditor(IEditorInput input,
String editorId)
Opens an editor on the given input.
|
IEditorPart |
openEditor(IEditorInput input,
String editorId,
boolean activate)
Opens an editor on the given input.
|
IEditorPart |
openEditor(IEditorInput input,
String editorId,
boolean activate,
int matchFlags)
Opens an editor on the given input.
|
IEditorReference[] |
openEditors(IEditorInput[] inputs,
String[] editorIDs,
IMemento[] mementos,
int matchFlags,
int activateIndex)
Opens editors for the given inputs.
|
IEditorReference[] |
openEditors(IEditorInput[] inputs,
String[] editorIDs,
int matchFlags)
Opens editors for the given inputs.
|
void |
removePropertyChangeListener(IPropertyChangeListener listener)
Removes the property change listener.
|
void |
resetPerspective()
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 |
savePerspective()
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 |
showEditor(IEditorReference ref)
Add back an open but non-participating editor
|
IViewPart |
showView(String viewId)
Shows the view identified by the given view id in this page and gives it
focus.
|
IViewPart |
showView(String viewId,
String secondaryId,
int mode)
Shows a view in this page with the given id and secondary id.
|
void |
toggleZoom(IWorkbenchPartReference ref)
Zoom the page in on a part.
|
void |
zoomOut()
Zooms out the zoomed-in part.
|
addPartListener, addPartListener, getActivePart, getActivePartReference, removePartListener, removePartListener
addPostSelectionListener, addPostSelectionListener, addSelectionListener, addSelectionListener, getSelection, getSelection, removePostSelectionListener, removePostSelectionListener, removeSelectionListener, removeSelectionListener
@Deprecated static final String EDITOR_ID_ATTR
IDE.EDITOR_ID_ATTR
.IMarker
)
which identifies the preferred editor type to be opened when
openEditor
is called.static final String CHANGE_RESET
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_RESET_COMPLETE
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_VIEW_SHOW
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_VIEW_HIDE
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_EDITOR_OPEN
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_EDITOR_CLOSE
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_EDITOR_AREA_SHOW
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_EDITOR_AREA_HIDE
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_ACTION_SET_SHOW
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_ACTION_SET_HIDE
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_FAST_VIEW_ADD
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_FAST_VIEW_REMOVE
IPerspectiveListener
,
Constant Field Valuesstatic final String CHANGE_WORKING_SET_REPLACE
IPropertyChangeListener
,
Constant Field Valuesstatic final String CHANGE_WORKING_SETS_REPLACE
IPropertyChangeListener
,
Constant Field Valuesstatic final int VIEW_ACTIVATE
showView(String)
.static final int VIEW_VISIBLE
VIEW_CREATE
.static final int VIEW_CREATE
static final int MATCH_NONE
static final int MATCH_INPUT
static final int MATCH_ID
static final int STATE_MINIMIZED
static final int STATE_MAXIMIZED
static final int STATE_RESTORED
void activate(IWorkbenchPart part)
part
- the part to activate@Deprecated void addPropertyChangeListener(IPropertyChangeListener listener)
IWorkingSetManager
returned by
IWorkbench.getWorkingSetManager()
instead.listener
- the property change listener to addvoid bringToTop(IWorkbenchPart part)
part
- the part to bring forwardboolean close()
If the page has an open editor with unsaved content, the user will be given the opportunity to save it.
true
if the page was successfully closed, and
false
if it is still openboolean closeAllEditors(boolean save)
If the page has open editors with unsaved content and save
is true
, the user will be given the opportunity to save
them.
save
- true
if all editors were successfully closed, and
false
if at least one is still openboolean closeEditors(IEditorReference[] editorRefs, boolean save)
Array
of editor references. The editors
must belong to this workbench page.
If any of the editors have unsaved content and save
is
true
, the user will be given the opportunity to save
them.
editorRefs
- the editors to closesave
- true
to save the editor contents if required
(recommended), and false
to discard any unsaved
changestrue
if the editors were successfully closed, and
false
if the editors are still openboolean closeEditor(IEditorPart editor, boolean save)
If the editor has unsaved content and save
is
true
, the user will be given the opportunity to save it.
editor
- the editor to closesave
- true
to save the editor contents if required
(recommended), and false
to discard any unsaved
changestrue
if the editor was successfully closed, and
false
if the editor is still openIViewPart findView(String viewId)
viewId
- the id of the view extension to usenull
if none is foundIViewReference findViewReference(String viewId)
viewId
- the id of the view extension to usenull
if none is foundIViewReference findViewReference(String viewId, String secondaryId)
viewId
- the id of the view extension to usesecondaryId
- the secondary id to use, or null
for no
secondary idnull
if none is foundIEditorPart getActiveEditor()
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.
null
if no editor is activeIEditorPart findEditor(IEditorInput input)
input
- the editor inputinput
IEditorReference[] findEditors(IEditorInput input, String editorId, int matchFlags)
input
- the editor input, or null
if MATCH_INPUT is not
specified in matchFlagseditorId
- the editor id, or null
if MATCH_ID is not
specified in matchFlagsmatchFlags
- a bit mask consisting of zero or more of the MATCH_* constants
OR-ed togetherMATCH_NONE
,
MATCH_INPUT
,
MATCH_ID
@Deprecated IEditorPart[] getEditors()
getEditorReferences()
instead. Calling this method has the side effect of restoring
all the editors in the page which can cause plug-in
activation.Note that each page has its own editors; editors are never shared between pages.
IEditorReference[] getEditorReferences()
Note that each page has its own editors; editors are never shared between pages.
IEditorPart[] getDirtyEditors()
IAdaptable getInput()
null
if noneString getLabel()
IPerspectiveDescriptor getPerspective()
null
if there is no current perspective.null
setPerspective(org.eclipse.ui.IPerspectiveDescriptor)
,
savePerspective()
IViewReference[] getViewReferences()
Note that each page has its own views; views are never shared between pages.
@Deprecated IViewPart[] getViews()
getViewReferences()
instead. Calling this method has the side effect of restoring
all the views in the page which can cause plug-in activation.Note that each page has its own views; views are never shared between pages.
IWorkbenchWindow getWorkbenchWindow()
@Deprecated IWorkingSet getWorkingSet()
void hideActionSet(String actionSetID)
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.
actionSetID
- the action set to hidevoid hideView(IViewPart view)
view
- the view to hidevoid hideView(IViewReference view)
view
- the references whos view is to be hiddenboolean isPartVisible(IWorkbenchPart part)
part
- the part to testtrue
if part is visibleboolean isEditorAreaVisible()
true
when editor area visible, false
otherwisevoid reuseEditor(IReusableEditor editor, IEditorInput input)
editor
- the editor to be reusedinput
- the new input for the reusable editorIEditorPart openEditor(IEditorInput input, String editorId) throws PartInitException
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.
input
- the editor inputeditorId
- the id of the editor extension to usenull
if an external
editor was openedPartInitException
- if the editor could not be created or initializedIEditorPart openEditor(IEditorInput input, String editorId, boolean activate) throws PartInitException
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)
and
IEditorInput
. If activate == 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.
input
- the editor inputeditorId
- the id of the editor extension to useactivate
- if true
the editor will be activatednull
if an external editor was openedPartInitException
- if the editor could not be created or initializedIEditorPart openEditor(IEditorInput input, String editorId, boolean activate, int matchFlags) throws PartInitException
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)
and
IEditorInput
. If activate == 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.
input
- the editor inputeditorId
- the id of the editor extension to useactivate
- if true
the editor will be activatedmatchFlags
- a bit mask consisting of zero or more of the MATCH_* constants OR-ed togethernull
if an external editor was openedPartInitException
- if the editor could not be created or initializedMATCH_NONE
,
MATCH_INPUT
,
MATCH_ID
void removePropertyChangeListener(IPropertyChangeListener listener)
listener
- the property change listener to removevoid resetPerspective()
For more information on perspective change see
setPerspective()
.
boolean saveAllEditors(boolean confirm)
If confirm
is true
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.
confirm
- true
to ask the user before saving unsaved
changes (recommended), and false
to save
unsaved changes without askingtrue
if the command succeeded, and
false
if the operation was canceled by the user or
an error occurred while savingboolean saveEditor(IEditorPart editor, boolean confirm)
If confirm
is true
the user is prompted to
confirm the command. Otherwise, the save happens without prompt.
The editor must belong to this workbench page.
editor
- the editor to closeconfirm
- true
to ask the user before saving unsaved
changes (recommended), and false
to save
unsaved changes without askingtrue
if the command succeeded, and
false
if the editor was not savedvoid savePerspective()
void savePerspectiveAs(IPerspectiveDescriptor perspective)
perspective
- the perspective descriptor to save tovoid setEditorAreaVisible(boolean showEditorArea)
showEditorArea
- true
to show the editor area,
false
to hide the editor areavoid setPerspective(IPerspectiveDescriptor perspective)
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.
perspective
- the perspective descriptorvoid showActionSet(String actionSetID)
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.
actionSetID
- the action set to showIViewPart showView(String viewId) throws PartInitException
viewId
- the id of the view extension to usePartInitException
- if the view could not be initializedIViewPart showView(String viewId, String secondaryId, int mode) throws PartInitException
VIEW_ACTIVATE
is supplied, the view is given focus. If
VIEW_VISIBLE
is supplied, then it is made visible but not
given focus. Finally, if VIEW_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.
viewId
- the id of the view extension to usesecondaryId
- the secondary id to use, or null
for no secondary
idmode
- the activation mode. Must be VIEW_ACTIVATE
,
VIEW_VISIBLE
or VIEW_CREATE
PartInitException
- if the view could not be initializedIllegalArgumentException
- if the supplied mode is not validboolean isEditorPinned(IEditorPart editor)
true
if the editor is pinned and should not be
reused.editor
- the editor to test@Deprecated int getEditorReuseThreshold()
@Deprecated void setEditorReuseThreshold(int openEditors)
openEditors
- the thresholdINavigationHistory getNavigationHistory()
IViewPart[] getViewStack(IViewPart part)
part
- the part to testnull
is returned if the part does not
belong to this page. The parts are in LRU order.String[] getNewWizardShortcuts()
IPageLayout.addNewWizardShortcut(String)
String[] getPerspectiveShortcuts()
IPageLayout.addPerspectiveShortcut(String)
String[] getShowViewShortcuts()
IPageLayout.addShowViewShortcut(String)
IPerspectiveDescriptor[] getOpenPerspectives()
IPerspectiveDescriptor[] getSortedPerspectives()
void closePerspective(IPerspectiveDescriptor desc, boolean saveParts, boolean closePage)
saveParts
is true
, the user will be prompted to save any unsaved
changes for parts that are being closed. The page itself is closed if
closePage
is true
.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 perspectivevoid closeAllPerspectives(boolean saveEditors, boolean closePage)
saveEditors
is
true
. The page itself is closed if closePage
is true
.saveEditors
- whether the page's editors should be savedclosePage
- whether the page itself should be closedIExtensionTracker 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.
IWorkbench.getExtensionTracker()
,
IWorkbenchWindow.getExtensionTracker()
IWorkingSet[] getWorkingSets()
IWorkbench.getActivitySupport()
void setWorkingSets(IWorkingSet[] sets)
sets
- the new working sets for this page. The array may be empty,
but no element in the array may be null
.IWorkingSet getAggregateWorkingSet()
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 via
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 whose IWorkingSet.isAggregateWorkingSet()
returns true
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:
Here we have pseudocode showing how some workingset
utilizing component could react to changes in aggregate working sets.
private IWorkingSet myWorkingSet;
IPropertyChangeListener workingSetListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (isMyCurrentWorkingSet(event)) {
if (isEmptyAggregate(myWorkingSet)) {
showNoSet();
}
else {
showSet();
}
}
}
};
public void setWorkingSet(IWorkingSet newSet) {
myWorkingSet = newSet;
if (myWorkingSet == null || isEmptyAggregate(myWorkingSet)){
showNoSet();
}
else {
showSet();
}
}
IAggregateWorkingSet
IAggregateWorkingSet
boolean isPageZoomed()
true
if the page is zoomed in the workbench
window, false
otherwise.void zoomOut()
void toggleZoom(IWorkbenchPartReference ref)
ref
- the workbench part to zoom in on. Must not be
null
.int getPartState(IWorkbenchPartReference ref)
ref
- the workbench part to query. Must not be null
.void setPartState(IWorkbenchPartReference ref, int state)
ref
- the workbench part reference. Must not be null
.state
- one of the STATE_* constants.IWorkbenchPartReference getReference(IWorkbenchPart part)
part
- The part to search for. It can be null
.null
if no
reference can be found.void showEditor(IEditorReference ref)
ref
- the editor to re-add. Must be an editor removed using
#hideEditor(IEditorReference), must not have been closed,
and must not be null
.hideEditor(IEditorReference)
void hideEditor(IEditorReference ref)
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.
ref
- the editor reference to remove. It must be a current open
editor belonging to this page, and must not be
null
.showEditor(IEditorReference)
IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, int matchFlags) throws MultiPartInitException
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] }.
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 togetherMultiPartInitException
- if at least one editor could not be created or initializedMATCH_NONE
,
MATCH_INPUT
,
MATCH_ID
IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, IMemento[] mementos, int matchFlags, int activateIndex) throws MultiPartInitException
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 []):
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.
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 be null
(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.MultiPartInitException
- if at least one editor could not be created or initializedMATCH_NONE
,
MATCH_INPUT
,
MATCH_ID
IMemento[] getEditorState(IEditorReference[] editorRefs, boolean includeInputState)
editorRefs
- The array of editor references to get the state forincludeInputState
- If true
then the resulting memento will be
contain the editor input's state as well as the editor's
state.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.