Class WorkbenchPage

java.lang.Object
org.eclipse.ui.internal.WorkbenchPage
All Implemented Interfaces:
IPartService, ISelectionService, IWorkbenchPage

public class WorkbenchPage extends Object implements IWorkbenchPage
A collection of views and editors in a workbench.
  • Field Details

  • Constructor Details

    • WorkbenchPage

      public WorkbenchPage(WorkbenchWindow w, IAdaptable input)
      Constructs a page. restoreState(IMemento) should be called to restore this page from data stored in a persistance file.
      Parameters:
      w - the parent window
      input - the page input
  • Method Details

    • updateShowInSources

      public void updateShowInSources(MPart part)
    • getWindowModel

      public MWindow getWindowModel()
      Allow access to the UI model that this page is managing
      Returns:
      the MWindow element for this page
    • activate

      public void activate(IWorkbenchPart part)
      Activates a part. The part will be brought to the front and given focus.
      Specified by:
      activate in interface IWorkbenchPage
      Parameters:
      part - the part to activate
    • addPartListener

      public void addPartListener(IPartListener l)
      Adds an IPartListener to the part service.
      Specified by:
      addPartListener in interface IPartService
      Parameters:
      l - a part listener
      See Also:
    • addPartListener

      public void addPartListener(IPartListener2 l)
      Adds an IPartListener to the part service.
      Specified by:
      addPartListener in interface IPartService
      Parameters:
      l - a part listener
      See Also:
    • addPropertyChangeListener

      @Deprecated public void addPropertyChangeListener(IPropertyChangeListener listener)
      Deprecated.
      individual views should store a working set if needed and register a property change listener directly with the working set manager to receive notification when the view working set is removed.
      Implements IWorkbenchPage
      Specified by:
      addPropertyChangeListener in interface IWorkbenchPage
      Parameters:
      listener - the property change listener to add
      Since:
      2.0
      See Also:
    • addSelectionListener

      public void addSelectionListener(ISelectionListener listener)
      Description copied from interface: ISelectionService
      Adds the given selection listener. Has no effect if an identical listener is already registered.

      Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

      Note: only update the UI when the UI is visible. See the SelectionListenerFactory for listeners that will only be called when the UI is visible to the user.

      Specified by:
      addSelectionListener in interface ISelectionService
      Parameters:
      listener - a selection listener
      See Also:
    • addSelectionListener

      public void addSelectionListener(String partId, ISelectionListener listener)
      Description copied from interface: ISelectionService
      Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.

      When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a null selection, but only if the listener implements INullSelectionListener.

      Note: this will not correctly track editor parts as each editor does not have a unique partId.

      Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

      Note: only update the UI when the UI is visible. See the SelectionListenerFactory for listeners that will only be called when the UI is visible to the user.

      Specified by:
      addSelectionListener in interface ISelectionService
      Parameters:
      partId - the id of the part to track
      listener - a selection listener
      See Also:
    • addPostSelectionListener

      public void addPostSelectionListener(ISelectionListener listener)
      Description copied from interface: ISelectionService
      Adds the given post selection listener.It is equivalent to selection changed if the selection was triggered by the mouse but it has a delay if the selection is triggered by the keyboard arrows. Has no effect if an identical listener is already registered. Note: Works only for StructuredViewer(s).

      Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

      Note: only update the UI when the UI is visible. See the SelectionListenerFactory for listeners that will only be called when the UI is visible to the user.

      Specified by:
      addPostSelectionListener in interface ISelectionService
      Parameters:
      listener - a selection listener
      See Also:
    • addPostSelectionListener

      public void addPostSelectionListener(String partId, ISelectionListener listener)
      Description copied from interface: ISelectionService
      Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.

      When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a null selection, but only if the listener implements INullSelectionListener.

      Note: this will not correctly track editor parts as each editor does not have a unique partId.

      Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

      Note: only update the UI when the UI is visible. See the SelectionListenerFactory for listeners that will only be called when the UI is visible to the user.

      Specified by:
      addPostSelectionListener in interface ISelectionService
      Parameters:
      partId - the id of the part to track
      listener - a selection listener
      See Also:
    • bringToTop

      public void bringToTop(IWorkbenchPart part)
      Moves a part forward in the Z order of a perspective so it is visible. If the part is in the same stack as the active part, the new part is activated.
      Specified by:
      bringToTop in interface IWorkbenchPage
      Parameters:
      part - the part to bring to move forward
    • findPart

      public MPart findPart(IWorkbenchPart part)
    • createEditorReferenceForPart

      public EditorReference createEditorReferenceForPart(MPart part, IEditorInput input, String editorId, IMemento memento)
    • getInternalEditorReferences

      public List<EditorReference> getInternalEditorReferences()
    • getEditorReference

      public EditorReference getEditorReference(MPart part)
    • getViewReference

      public ViewReference getViewReference(MPart part)
    • addViewReference

      public void addViewReference(ViewReference reference)
    • addEditorReference

      public void addEditorReference(EditorReference editorReference)
    • busyShowView

      protected IViewPart busyShowView(String viewId, int mode) throws PartInitException
      Shows a view. Assumes that a busy cursor is active.
      Throws:
      PartInitException
    • close

      public boolean close()
      Closes this page.
      Specified by:
      close in interface IWorkbenchPage
      Returns:
      true if the page was successfully closed, and false if it is still open
    • closeAllSavedEditors

      public boolean closeAllSavedEditors()
    • closeAllEditors

      public boolean closeAllEditors(boolean save)
      See IWorkbenchPage
      Specified by:
      closeAllEditors in interface IWorkbenchPage
      Parameters:
      save - true to save the editor contents if required (recommended), and false to discard any unsaved changes
      Returns:
      true if all editors were successfully closed, and false if at least one is still open
    • closeEditors

      public boolean closeEditors(IEditorReference[] refArray, boolean save)
      See IWorkbenchPage
      Specified by:
      closeEditors in interface IWorkbenchPage
      Parameters:
      refArray - the editors to close
      save - true to save the editor contents if required (recommended), and false to discard any unsaved changes
      Returns:
      true if the editors were successfully closed, and false if the editors are still open
    • closeEditor

      public boolean closeEditor(IEditorReference editor)
    • closeEditor

      public boolean closeEditor(IEditorReference editorRef, boolean save)
    • closeEditor

      public boolean closeEditor(IEditorPart editor, boolean save)
      See IWorkbenchPage#closeEditor
      Specified by:
      closeEditor in interface IWorkbenchPage
      Parameters:
      editor - the editor to close
      save - true to save the editor contents if required (recommended), and false to discard any unsaved changes
      Returns:
      true if the editor was successfully closed, and false if the editor is still open
    • closePerspective

      public void closePerspective(IPerspectiveDescriptor desc, boolean saveParts, boolean closePage)
      Description copied from interface: IWorkbenchPage
      Closes the specified perspective in this page. If the last perspective in this page is closed, then all editors are closed. Views that are not shown in other perspectives are closed as well. If 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.
      Specified by:
      closePerspective in interface IWorkbenchPage
      Parameters:
      desc - the descriptor of the perspective to be closed
      saveParts - whether the page's parts should be saved if closed
      closePage - whether the page itself should be closed if last perspective
    • closePerspective

      public void closePerspective(IPerspectiveDescriptor desc, String perspectiveId, boolean saveParts, boolean closePage)
    • closeAllPerspectives

      public void closeAllPerspectives(boolean saveEditors, boolean closePage)
      Description copied from interface: IWorkbenchPage
      Closes all perspectives in this page. All editors are closed, prompting to save any unsaved changes if saveEditors is true. The page itself is closed if closePage is true.
      Specified by:
      closeAllPerspectives in interface IWorkbenchPage
      Parameters:
      saveEditors - whether the page's editors should be saved
      closePage - 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.
    • getNavigationHistory

      public INavigationHistory getNavigationHistory()
      Description copied from interface: IWorkbenchPage
      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.
      Specified by:
      getNavigationHistory in interface IWorkbenchPage
      Returns:
      NavigationHistory
    • editActionSets

      public boolean editActionSets()
    • findView

      public IViewPart findView(String id)
      See IWorkbenchPage@findView.
      Specified by:
      findView in interface IWorkbenchPage
      Parameters:
      id - the id of the view extension to use
      Returns:
      the view, or null if none is found
    • findViewReference

      public IViewReference findViewReference(String viewId)
      Description copied from interface: IWorkbenchPage
      Returns the view reference with the specified id.
      Specified by:
      findViewReference in interface IWorkbenchPage
      Parameters:
      viewId - the id of the view extension to use
      Returns:
      the view reference, or null if none is found
    • findViewReference

      public IViewReference findViewReference(String viewId, String secondaryId)
      Description copied from interface: IWorkbenchPage
      Returns the view reference with the specified id and secondary id.
      Specified by:
      findViewReference in interface IWorkbenchPage
      Parameters:
      viewId - the id of the view extension to use
      secondaryId - the secondary id to use, or null for no secondary id
      Returns:
      the view reference, or null if none is found
    • createViewReferenceForPart

      public void createViewReferenceForPart(MPart part, String viewId)
    • getActionBars

      public IActionBars 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

      public IEditorPart getActiveEditor()
      Description copied from interface: IWorkbenchPage
      Returns the active editor open in this page.

      This is the visible editor on the page, or, if there is more than one visible editor, this is the one most recently brought to top.

      Specified by:
      getActiveEditor in interface IWorkbenchPage
      Returns:
      the active editor, or null if no editor is active
      See Also:
    • getActivePart

      public IWorkbenchPart getActivePart()
      Description copied from interface: IPartService
      Returns the active part.
      Specified by:
      getActivePart in interface IPartService
      Returns:
      the active part, or null if no part is currently active
    • getActivePartReference

      public IWorkbenchPartReference getActivePartReference()
      Description copied from interface: IPartService
      Returns the active part reference.
      Specified by:
      getActivePartReference in interface IPartService
      Returns:
      the active part reference, or null if no part is currently active
    • getClientComposite

      public Composite getClientComposite()
    • getDirtyEditors

      public IEditorPart[] getDirtyEditors()
      Description copied from interface: IWorkbenchPage
      Returns a list of dirty editors in this page.
      Specified by:
      getDirtyEditors in interface IWorkbenchPage
      Returns:
      a list of dirty editors
    • findEditor

      public IEditorPart findEditor(IEditorInput input)
      Description copied from interface: IWorkbenchPage
      Returns the editor with the specified input. Returns null if there is no opened editor with that input.
      Specified by:
      findEditor in interface IWorkbenchPage
      Parameters:
      input - the editor input
      Returns:
      an editor with input equals to input
    • findEditors

      public IEditorReference[] findEditors(IEditorInput input, String editorId, int matchFlags)
      Description copied from interface: IWorkbenchPage
      Returns an array of editor references that match the given input and/or editor id, as specified by the given match flags. Returns an empty array if there are no matching editors, or if matchFlags is MATCH_NONE.
      Specified by:
      findEditors in interface IWorkbenchPage
      Parameters:
      input - the editor input, or null if MATCH_INPUT is not specified in matchFlags
      editorId - the editor id, or null if MATCH_ID is not specified in matchFlags
      matchFlags - 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

      public IEditorPart[] getEditors()
      Description copied from interface: IWorkbenchPage
      Returns a list of the editors open in this page.

      Note that each page has its own editors; editors are never shared between pages.

      Specified by:
      getEditors in interface IWorkbenchPage
      Returns:
      a list of open editors
    • getEditorReferences

      public IEditorReference[] getEditorReferences()
      Description copied from interface: IWorkbenchPage
      Returns an array of references to open editors in this page.

      Note that each page has its own editors; editors are never shared between pages.

      Specified by:
      getEditorReferences in interface IWorkbenchPage
      Returns:
      a list of open editors
    • getSortedEditors

      public IEditorReference[] getSortedEditors()
    • getSortedParts

      public IWorkbenchPartReference[] getSortedParts()
    • getInput

      public IAdaptable getInput()
      Description copied from interface: IWorkbenchPage
      Returns the input for this page.
      Specified by:
      getInput in interface IWorkbenchPage
      Returns:
      the input for this page, or null if none
      See Also:
    • getLabel

      public String getLabel()
      Returns the page label. This is a combination of the page input and active perspective.
      Specified by:
      getLabel in interface IWorkbenchPage
      Returns:
      the page label
    • getPerspective

      public IPerspectiveDescriptor getPerspective()
      Returns the perspective.
      Specified by:
      getPerspective in interface IWorkbenchPage
      Returns:
      the current perspective descriptor or null
      See Also:
    • getPerspectiveDesc

      public IPerspectiveDescriptor getPerspectiveDesc(String id)
    • getSelection

      public ISelection getSelection()
      Description copied from interface: ISelectionService
      Returns the current selection in the active part. If the selection in the active part is undefined (the active part has no selection provider) the result will be null.
      Specified by:
      getSelection in interface ISelectionService
      Returns:
      the current selection, or null if undefined
    • getSelection

      public ISelection getSelection(String partId)
      Description copied from interface: ISelectionService
      Returns the current selection in the part with the given id. If the part is not open, or if the selection in the active part is undefined (the active part has no selection provider) the result will be null.
      Specified by:
      getSelection in interface ISelectionService
      Parameters:
      partId - the id of the part
      Returns:
      the current selection, or null if undefined
    • getShowInPartIds

      public List<String> 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

      public void performedShowIn(String partId)
      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

      public void sortShowInPartIds(ArrayList<?> partIds)
      Sorts the given collection of show in target part ids in MRU order.
      Parameters:
      partIds - the collection of part ids to rearrange
    • getViewReferences

      public IViewReference[] getViewReferences()
      See IWorkbenchPage.
      Specified by:
      getViewReferences in interface IWorkbenchPage
      Returns:
      a list of references to visible views
    • getViews

      public IViewPart[] getViews()
      See IWorkbenchPage.
      Specified by:
      getViews in interface IWorkbenchPage
      Returns:
      a list of visible views
    • getWorkbenchWindow

      public IWorkbenchWindow getWorkbenchWindow()
      See IWorkbenchPage.
      Specified by:
      getWorkbenchWindow in interface IWorkbenchPage
      Returns:
      the workbench window
    • getWorkingSet

      @Deprecated public IWorkingSet getWorkingSet()
      Deprecated.
      individual views should store a working set if needed
      Implements IWorkbenchPage
      Specified by:
      getWorkingSet in interface IWorkbenchPage
      Returns:
      the working set of this page.
      Since:
      2.0
      See Also:
    • hideActionSet

      public void hideActionSet(String actionSetID)
      Description copied from interface: IWorkbenchPage
      Hides an action set in this page.

      In most cases where this method is used the caller is tightly coupled to a particular action set. They define it in the registry and may make it visible in certain scenarios by calling showActionSet. A static variable is often used to identify the action set id in caller code.

      Specified by:
      hideActionSet in interface IWorkbenchPage
      Parameters:
      actionSetID - the action set to hide
      See Also:
    • hideView

      public void hideView(IViewReference view)
      Description copied from interface: IWorkbenchPage
      Hides the given view that belongs to the reference, if any.
      Specified by:
      hideView in interface IWorkbenchPage
      Parameters:
      view - the references whos view is to be hidden
    • hideView

      public void hideView(IViewPart view)
      Description copied from interface: IWorkbenchPage
      Hides the given view. The view must belong to this page.
      Specified by:
      hideView in interface IWorkbenchPage
      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

      public boolean isPartVisible(IWorkbenchPart part)
      See IWorkbenchPage.
      Specified by:
      isPartVisible in interface IWorkbenchPage
      Parameters:
      part - the part to test
      Returns:
      boolean true if part is visible
    • findSharedArea

      public MUIElement findSharedArea()
    • isEditorAreaVisible

      public boolean isEditorAreaVisible()
      See IWorkbenchPage.
      Specified by:
      isEditorAreaVisible in interface IWorkbenchPage
      Returns:
      true when editor area visible, false otherwise
    • isPageZoomed

      public boolean isPageZoomed()
      Description copied from interface: IWorkbenchPage
      Returns the page "zoomed" state.
      Specified by:
      isPageZoomed in interface IWorkbenchPage
      Returns:
      true if the page is zoomed in the workbench window, false otherwise.
    • reuseEditor

      public void reuseEditor(IReusableEditor editor, IEditorInput input)
      See IWorkbenchPage.
      Specified by:
      reuseEditor in interface IWorkbenchPage
      Parameters:
      editor - the editor to be reused
      input - the new input for the reusable editor
    • openEditor

      public IEditorPart openEditor(IEditorInput input, String editorID) throws PartInitException
      See IWorkbenchPage.
      Specified by:
      openEditor in interface IWorkbenchPage
      Parameters:
      input - the editor input
      editorID - the id of the editor extension to use
      Returns:
      an open and active editor, or null if an external editor was opened
      Throws:
      PartInitException - if the editor could not be created or initialized
    • openEditor

      public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException
      See IWorkbenchPage.
      Specified by:
      openEditor in interface IWorkbenchPage
      Parameters:
      input - the editor input
      editorID - the id of the editor extension to use
      activate - if true the editor will be activated
      Returns:
      an open editor, or null if an external editor was opened
      Throws:
      PartInitException - if the editor could not be created or initialized
    • openEditor

      public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate, int matchFlags) throws PartInitException
      See IWorkbenchPage.
      Specified by:
      openEditor in interface IWorkbenchPage
      Parameters:
      input - the editor input
      editorID - the id of the editor extension to use
      activate - if true the editor will be activated
      matchFlags - a bit mask consisting of zero or more of the MATCH_* constants OR-ed together
      Returns:
      an open editor, or null if an external editor was opened
      Throws:
      PartInitException - if the editor could not be created or initialized
      See Also:
    • openEditor

      public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate, int matchFlags, IMemento editorState, boolean notify) throws PartInitException
      This is not public API but for use internally. editorState can be null.
      Parameters:
      input - the input to open the editor with
      editorID - the id of the editor to open
      activate - true if the editor should be activated, false otherwise
      matchFlags - a bit mask consisting of zero or more of the MATCH_* constants OR-ed together
      editorState - the previously saved state of the editor as a memento, this may be null
      notify - true if the perspective should fire off events about the editors being opened, false otherwise
      Returns:
      the opened editor
      Throws:
      PartInitException - if the editor could not be created or initialized
    • isEditorPinned

      public boolean isEditorPinned(IEditorPart editor)
      See IWorkbenchPage.
      Specified by:
      isEditorPinned in interface IWorkbenchPage
      Parameters:
      editor - the editor to test
      Returns:
      boolean whether the editor is pinned
    • removePartListener

      public void removePartListener(IPartListener l)
      Removes an IPartListener from the part service.
      Specified by:
      removePartListener in interface IPartService
      Parameters:
      l - a part listener
    • removePartListener

      public void removePartListener(IPartListener2 l)
      Removes an IPartListener from the part service.
      Specified by:
      removePartListener in interface IPartService
      Parameters:
      l - a part listener
    • removePropertyChangeListener

      @Deprecated public void removePropertyChangeListener(IPropertyChangeListener listener)
      Deprecated.
      individual views should store a working set if needed and register a property change listener directly with the working set manager to receive notification when the view working set is removed.
      Implements IWorkbenchPage
      Specified by:
      removePropertyChangeListener in interface IWorkbenchPage
      Parameters:
      listener - the property change listener to remove
      Since:
      2.0
      See Also:
    • removeSelectionListener

      public void removeSelectionListener(ISelectionListener listener)
      Description copied from interface: ISelectionService
      Removes the given selection listener. Has no effect if an identical listener is not registered.
      Specified by:
      removeSelectionListener in interface ISelectionService
      Parameters:
      listener - a selection listener
    • removeSelectionListener

      public void removeSelectionListener(String partId, ISelectionListener listener)
      Description copied from interface: ISelectionService
      Removes the given part-specific selection listener. Has no effect if an identical listener is not registered for the given part id.
      Specified by:
      removeSelectionListener in interface ISelectionService
      Parameters:
      partId - the id of the part to track
      listener - a selection listener
    • removePostSelectionListener

      public void removePostSelectionListener(ISelectionListener listener)
      Description copied from interface: ISelectionService
      Removes the given post selection listener. Has no effect if an identical listener is not registered.
      Specified by:
      removePostSelectionListener in interface ISelectionService
      Parameters:
      listener - a selection listener
    • removePostSelectionListener

      public void removePostSelectionListener(String partId, ISelectionListener listener)
      Description copied from interface: ISelectionService
      Removes the given part-specific post selection listener. Has no effect if an identical listener is not registered for the given part id.
      Specified by:
      removePostSelectionListener in interface ISelectionService
      Parameters:
      partId - the id of the part to track
      listener - a selection listener
    • resetPerspective

      public void resetPerspective()
      Resets the layout for the perspective. The active part in the old layout is activated in the new layout for consistent user context.
      Specified by:
      resetPerspective in interface IWorkbenchPage
    • saveAllEditors

      public boolean saveAllEditors(boolean confirm)
      See IWorkbenchPage
      Specified by:
      saveAllEditors in interface IWorkbenchPage
      Parameters:
      confirm - true to ask the user before saving unsaved changes (recommended), and false to save unsaved changes without asking
      Returns:
      true if the command succeeded, and false if the operation was canceled by the user or an error occurred while saving
    • getDirtyParts

      public ISaveablePart[] getDirtyParts()
      Returns:
      ISaveablePart objects derived from IWorkbenchPart 's on this page
    • getDirtyWorkbenchParts

      public IWorkbenchPart[] 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 save
      confirm - whether the user should be prompted for confirmation of the save request
      closing - whether the part will be closed after the save operation has completed, this may determine whether whether the save operation will actually be invoked or not
      Returns:
      true if the saveable's contents has been persisted, false otherwise
      See Also:
    • saveEditor

      public boolean saveEditor(IEditorPart editor, boolean confirm)
      Saves an editors in the workbench. If confirm is true the user is prompted to confirm the command.
      Specified by:
      saveEditor in interface IWorkbenchPage
      Parameters:
      confirm - if user confirmation should be sought
      editor - the editor to close
      Returns:
      true if the command succeeded, or false if the user cancels the command
    • savePerspective

      public void savePerspective()
      Description copied from interface: IWorkbenchPage
      Saves the visible views, their layout, and the visible action sets for this page to the current perspective descriptor. The contents of the current perspective descriptor are overwritten.
      Specified by:
      savePerspective in interface IWorkbenchPage
    • savePerspectiveAs

      public void savePerspectiveAs(IPerspectiveDescriptor perspective)
      Description copied from interface: IWorkbenchPage
      Saves the visible views, their layout, and the visible action sets for this page to the given perspective descriptor. The contents of the given perspective descriptor are overwritten and it is made the current one for this page.
      Specified by:
      savePerspectiveAs in interface IWorkbenchPage
      Parameters:
      perspective - the perspective descriptor to save to
    • setEditorAreaVisible

      public void setEditorAreaVisible(boolean showEditorArea)
      Description copied from interface: IWorkbenchPage
      Show or hide the editor area for the page's active perspective.
      Specified by:
      setEditorAreaVisible in interface IWorkbenchPage
      Parameters:
      showEditorArea - true to show the editor area, false to hide the editor area
    • setPerspective

      public void setPerspective(IPerspectiveDescriptor perspective)
      Description copied from interface: IWorkbenchPage
      Changes the visible views, their layout, and the visible action sets within the page to match the given perspective descriptor. This is a rearrangement of components and not a replacement. The contents of the old perspective descriptor are unaffected.

      When a perspective change occurs the old perspective is deactivated (hidden) and cached for future reference. Then the new perspective is activated (shown). The views within the page are shared by all existing perspectives to make it easy for the user to switch between one perspective and another quickly without loss of context.

      During activation the action sets are modified. If an action set is specified in the new perspective which is not visible in the old one it will be created. If an old action set is not specified in the new perspective it will be disposed.

      The visible views and their layout within the page also change. If a view is specified in the new perspective which is not visible in the old one a new instance of the view will be created. If an old view is not specified in the new perspective it will be hidden. This view may reappear if the user selects it from the View menu or if they switch to a perspective (which may be the old one) where the view is visible.

      The open editors are not modified by this method.

      Specified by:
      setPerspective in interface IWorkbenchPage
      Parameters:
      perspective - the perspective descriptor
    • setWorkingSet

      @Deprecated public void setWorkingSet(IWorkingSet newWorkingSet)
      Deprecated.
      individual views should store a working set if needed
      Sets 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

      public void showActionSet(String actionSetID)
      Description copied from interface: IWorkbenchPage
      Shows an action set in this page.

      In most cases where this method is used the caller is tightly coupled to a particular action set. They define it in the registry and may make it visible in certain scenarios by calling showActionSet. A static variable is often used to identify the action set id in caller code.

      Specified by:
      showActionSet in interface IWorkbenchPage
      Parameters:
      actionSetID - the action set to show
      See Also:
    • showView

      public IViewPart showView(String viewID) throws PartInitException
      See IWorkbenchPage.
      Specified by:
      showView in interface IWorkbenchPage
      Parameters:
      viewID - the id of the view extension to use
      Returns:
      the shown view
      Throws:
      PartInitException - if the view could not be initialized
    • showView

      public IViewPart showView(String viewID, String secondaryID, int mode) throws PartInitException
      Description copied from interface: IWorkbenchPage
      Shows a view in this page with the given id and secondary id. The behaviour of this method varies based on the supplied mode. If 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.

      Specified by:
      showView in interface IWorkbenchPage
      Parameters:
      viewID - the id of the view extension to use
      secondaryID - the secondary id to use, or null for no secondary id
      mode - the activation mode. Must be IWorkbenchPage.VIEW_ACTIVATE, IWorkbenchPage.VIEW_VISIBLE or IWorkbenchPage.VIEW_CREATE
      Returns:
      a view
      Throws:
      PartInitException - if the view could not be initialized
    • getActiveElement

      public MUIElement getActiveElement(IWorkbenchPartReference ref)
    • setPartState

      public void setPartState(IWorkbenchPartReference ref, int iState)
      Description copied from interface: IWorkbenchPage
      Set the state of the given part reference. Setting the state of one part can effect the state of other parts.
      Specified by:
      setPartState in interface IWorkbenchPage
      Parameters:
      ref - the workbench part reference. Must not be null.
      iState - one of the STATE_* constants.
    • getPartState

      public int getPartState(IWorkbenchPartReference ref)
      Description copied from interface: IWorkbenchPage
      Returns the maximized/minimized/restored state of the given part reference.
      Specified by:
      getPartState in interface IWorkbenchPage
      Parameters:
      ref - the workbench part to query. Must not be null.
      Returns:
      one of the STATE_* contants.
    • updateActionBars

      public void updateActionBars()
      updateActionBars method comment.
    • zoomOut

      public void zoomOut()
      Description copied from interface: IWorkbenchPage
      Zooms out the zoomed-in part. If the page does not have a zoomed part, it does nothing.
      Specified by:
      zoomOut in interface IWorkbenchPage
    • toggleZoom

      public void toggleZoom(IWorkbenchPartReference ref)
      Description copied from interface: IWorkbenchPage
      Zoom the page in on a part. If the part is already in zoom then zoom out.
      Specified by:
      toggleZoom in interface IWorkbenchPage
      Parameters:
      ref - the workbench part to zoom in on. Must not be null.
    • getOpenPerspectives

      public IPerspectiveDescriptor[] getOpenPerspectives()
      Description copied from interface: IWorkbenchPage
      Returns the descriptors for the perspectives that are open in this page, in the order in which they were opened.
      Specified by:
      getOpenPerspectives in interface IWorkbenchPage
      Returns:
      the open perspective descriptors, in order of opening
    • getSortedPerspectives

      public IPerspectiveDescriptor[] getSortedPerspectives()
      Description copied from interface: IWorkbenchPage
      Returns the descriptors for the perspectives that are open in this page, in the order in which they were activated (oldest first).
      Specified by:
      getSortedPerspectives in interface IWorkbenchPage
      Returns:
      the open perspective descriptors, in order of activation
    • getReference

      public IWorkbenchPartReference getReference(IWorkbenchPart part)
      Returns the reference to the given part, or null if it has no reference (i.e. it is not a top-level part in this workbench page).
      Specified by:
      getReference in interface IWorkbenchPage
      Parameters:
      part - the part
      Returns:
      the part's reference or null if the given part does not belong to this workbench page
    • getCurrentPerspective

      public MPerspective getCurrentPerspective()
    • getViewStack

      public IViewPart[] getViewStack(IViewPart part)
      Description copied from interface: IWorkbenchPage
      Returns an array of IViewParts that are stacked with the given part in the currently active perspective.
      Specified by:
      getViewStack in interface IWorkbenchPage
      Parameters:
      part - the part to test
      Returns:
      the parts that are stacked with this part, including the part in question. null is returned if the part does not belong to this page or the part is not contained in the active perspective. The parts are in LRU order.
    • getExtensionTracker

      public IExtensionTracker getExtensionTracker()
      Description copied from interface: IWorkbenchPage

      Return the extension tracker for the workbench. This tracker may be used by plug-ins to ensure responsiveness to changes to the plug-in registry.

      The tracker at this level of the workbench is typically used to track elements that only exist over the lifespan of a page. For example, ViewPart objects fall into this category.

      Specified by:
      getExtensionTracker in interface IWorkbenchPage
      Returns:
      the extension tracker
      See Also:
    • getNewWizardShortcuts

      public String[] getNewWizardShortcuts()
      Description copied from interface: IWorkbenchPage
      Returns the new wizard shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.
      Specified by:
      getNewWizardShortcuts in interface IWorkbenchPage
      Returns:
      an array of wizard identifiers
      See Also:
    • getPerspectiveShortcuts

      public String[] getPerspectiveShortcuts()
      Description copied from interface: IWorkbenchPage
      Returns the perspective shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.
      Specified by:
      getPerspectiveShortcuts in interface IWorkbenchPage
      Returns:
      an array of perspective identifiers
      See Also:
    • getShowViewShortcuts

      public String[] getShowViewShortcuts()
      Description copied from interface: IWorkbenchPage
      Returns the show view shortcuts associated with the current perspective. Returns an empty array if there is no current perspective.
      Specified by:
      getShowViewShortcuts in interface IWorkbenchPage
      Returns:
      an array of view identifiers
      See Also:
    • isPartVisible

      public boolean isPartVisible(IWorkbenchPartReference reference)
    • getWorkingSets

      public IWorkingSet[] getWorkingSets()
      Description copied from interface: IWorkbenchPage
      Return the visible working sets for this page. Please note that this array is not filtered by activities. Clients should attempt to ensure that any use of this method is consistant with the currently enabled activity set.
      Specified by:
      getWorkingSets in interface IWorkbenchPage
      Returns:
      the visible working sets for this page
      See Also:
    • setWorkingSets

      public void setWorkingSets(IWorkingSet[] newWorkingSets)
      Description copied from interface: IWorkbenchPage
      Set the working sets for this page. Any duplicate entries will be removed from the array by this method.
      Specified by:
      setWorkingSets in interface IWorkbenchPage
      Parameters:
      newWorkingSets - the new working sets for this page. The array may be empty, but no element in the array may be null.
    • getAggregateWorkingSet

      public IWorkingSet getAggregateWorkingSet()
      Description copied from interface: IWorkbenchPage
      Return a working set that contains all of the elements contained in the array of working sets provided by IWorkbenchPage.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 IWorkbenchPage.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 pseudocode showing how some workingset utilizing component could react to changes in aggregate working sets:

       
       private IWorkingSet myWorkingSet;
      
       IPropertyChangeListener workingSetListener = new IPropertyChangeListener() {
              void propertyChange(PropertyChangeEvent event) {
                      if (isMyCurrentWorkingSet(event)) {
                              if (isEmptyAggregate(myWorkingSet)) {
                                      showNoSet();
                              }
                              else {
                                      showSet();
                              }
                      }
              }
       };
      
       void setWorkingSet(IWorkingSet newSet) {
                      myWorkingSet = newSet;
                      if (myWorkingSet == null || isEmptyAggregate(myWorkingSet)){
                              showNoSet();
                      }
                      else {
                              showSet();
                      }
       }
       
       
      Specified by:
      getAggregateWorkingSet in interface IWorkbenchPage
      Returns:
      the aggregate working set for this page, this implements IAggregateWorkingSet
      See Also:
    • showEditor

      public void showEditor(IEditorReference ref)
      Description copied from interface: IWorkbenchPage
      Add back an open but non-participating editor
      Specified by:
      showEditor in interface IWorkbenchPage
      Parameters:
      ref - the editor to re-add. Must be an editor removed using #hideEditor(IEditorReference), must not have been closed, and must not be null.
      See Also:
    • hideEditor

      public void hideEditor(IEditorReference ref)
      Description copied from interface: IWorkbenchPage
      Remove an open editor, turn it into a non-participating editor.

      A non-participating editor will not be returned in the list of open editors (IWorkbenchPage.getEditorReferences()) and will not be visible in the editor area. However, it will continue to participate in the save lifecycle and may still be closed by some workbench close events.

      Behaviour for hiding and showing editors from multiple stacks is not defined (and unsupported) at this time.

      Specified by:
      hideEditor in interface IWorkbenchPage
      Parameters:
      ref - the editor reference to remove. It must be a current open editor belonging to this page, and must not be null.
      See Also:
    • getEditorState

      public IMemento[] getEditorState(IEditorReference[] editorRefs, boolean includeInputState)
      Description copied from interface: IWorkbenchPage
      Return an IMemento containing the current state of the editor for each of the given references. These mementos may be used to determine the initial state of an editor on a subsequent open.
      Specified by:
      getEditorState in interface IWorkbenchPage
      Parameters:
      editorRefs - The array of editor references to get the state for
      includeInputState - If true then the resulting memento will be contain the editor input's state as well as the editor's state.
      Returns:
      The array of mementos. The length of the array will match that of the refs array.
    • openEditors

      public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, int matchFlags) throws MultiPartInitException
      Description copied from interface: IWorkbenchPage
      Opens editors for the given inputs. Only the editor constructed for the first input gets activated.

      The editor type is determined by mapping editorIDs to an editor extension registered with the workbench. An editor id is passed rather than an editor object to prevent the accidental creation of more than one editor for the same input. It also guarantees a consistent lifecycle for editors, regardless of whether they are created by the user or restored from saved data.

      The length of the input array and editor ID arrays must be the same. The editors are opened using pairs of { input[i], editorIDs[i] }.

      Specified by:
      openEditors in interface IWorkbenchPage
      Parameters:
      inputs - the editor inputs
      editorIDs - the IDs of the editor extensions to use, in the order of inputs
      matchFlags - a bit mask consisting of zero or more of the MATCH_* constants OR-ed together
      Returns:
      references to the editors constructed for the inputs. The editors corresponding to those reference might not be materialized.
      Throws:
      MultiPartInitException - if at least one editor could not be created or initialized
      See Also:
    • openEditors

      public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, IMemento[] mementos, int matchFlags, int activationIndex) throws MultiPartInitException
      Description copied from interface: IWorkbenchPage
      Opens editors for the given inputs. Only the editor constructed for the given index will be activated.

      There are effectively two different ways to use this method based on what information the supplied mementos contain @see org.eclipse.ui.IWorkbenchPage #getEditorState(org.eclipse.ui.IEditorReference []):

      1. 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.
      2. If the supplied memento only contains the editor state then both the input and editorID must be non-null.

      The editor type is determined by mapping editorIDs to an editor extension registered with the workbench. An editor id is passed rather than an editor object to prevent the accidental creation of more than one editor for the same input. It also guarantees a consistent lifecycle for editors, regardless of whether they are created by the user or restored from saved data.

      The length of the input array and editor ID arrays must be the same. The editors are opened using pairs of { input[i], editorIDs[i] }.

      The mementos array mat be null but if not must match the input array in length. Entries in the mementos array may also be null if no state is desired for that particular editor.

      Specified by:
      openEditors in interface IWorkbenchPage
      Parameters:
      inputs - the editor inputs
      editorIDs - the IDs of the editor extensions to use, in the order of inputs
      mementos - 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 together
      activationIndex - 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

      public void firePartHidden(MPart part)
    • firePartInputChanged

      public void firePartInputChanged(IWorkbenchPartReference partReference)
    • getEditorReuseThreshold

      public int getEditorReuseThreshold()
      Description copied from interface: IWorkbenchPage
      Returns the number of open editors before reusing editors.
      Specified by:
      getEditorReuseThreshold in interface IWorkbenchPage
      Returns:
      a int
    • setEditorReuseThreshold

      public void setEditorReuseThreshold(int openEditors)
      Description copied from interface: IWorkbenchPage
      Set the number of open editors before reusing editors. If < 0 the user preference settings will be used.
      Specified by:
      setEditorReuseThreshold in interface IWorkbenchPage
      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 open
      editorDescriptor - the descriptor of the editor to open
      activate - true if the editor should be activated, false otherwise
      editorState - the previously saved state of the editor as a memento, this may be null
      Returns:
      the opened editor
      Throws:
      PartInitException - if the editor could not be created or initialized
    • getHiddenItems

      public String getHiddenItems()
    • addHiddenItems

      public void addHiddenItems(MPerspective perspective, String id)
    • addHiddenItems

      public void addHiddenItems(String id)
    • removeHiddenItems

      public void removeHiddenItems(MPerspective perspective, String id)
    • removeHiddenItems

      public void removeHiddenItems(String id)
    • setNewShortcuts

      public void setNewShortcuts(List<String> wizards, String tagPrefix)
    • resetToolBarLayout

      public void resetToolBarLayout()
    • firePartDeactivatedIfActive

      public void firePartDeactivatedIfActive(MPart part)
      Fires IPartListener2.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.