Class AbstractMultiEditor

All Implemented Interfaces:
IAdaptable, IExecutableExtension, IEditorPart, ISaveablePart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation
Direct Known Subclasses:
MultiEditor

public abstract class AbstractMultiEditor extends EditorPart
A AbstractMultiEditor is a composite of editors. This class is intended to be subclassed.
Since:
3.5
  • Constructor Details

    • AbstractMultiEditor

      public AbstractMultiEditor()
      Constructs an editor to contain other editors.
  • Method Details

    • handlePropertyChange

      protected void handlePropertyChange(int propId)
      Handles a property change notification from a nested editor. The default implementation simply forwards the change to listeners on this multi editor by calling firePropertyChange with the same property id. For example, if the dirty state of a nested editor changes (property id ISaveablePart.PROP_DIRTY), this method handles it by firing a property change event for ISaveablePart.PROP_DIRTY to property listeners on this multi editor.

      Subclasses may extend or reimplement this method.

      Parameters:
      propId - the id of the property that changed
      Since:
      3.6
    • doSave

      public void doSave(IProgressMonitor monitor)
      Description copied from interface: ISaveablePart
      Saves the contents of this part.

      If the save is successful, the part should fire a property changed event reflecting the new dirty state (PROP_DIRTY property).

      If the save is cancelled through user action, or for any other reason, the part should invoke setCancelled on the IProgressMonitor to inform the caller.

      This method is long-running; progress and cancellation are provided by the given progress monitor.

      Specified by:
      doSave in interface ISaveablePart
      Specified by:
      doSave in class EditorPart
      Parameters:
      monitor - the progress monitor
    • doSaveAs

      public void doSaveAs()
      Description copied from interface: ISaveablePart
      Saves the contents of this part to another object.

      Implementors are expected to open a "Save As" dialog where the user will be able to select a new name for the contents. After the selection is made, the contents should be saved to that new name. During this operation a IProgressMonitor should be used to indicate progress.

      If the save is successful, the part fires a property changed event reflecting the new dirty state (PROP_DIRTY property).

      Specified by:
      doSaveAs in interface ISaveablePart
      Specified by:
      doSaveAs in class EditorPart
    • init

      public void init(IEditorSite site, IEditorInput input) throws PartInitException
      Description copied from interface: IEditorPart
      Initializes this editor with the given editor site and input.

      This method is automatically called shortly after the part is instantiated. It marks the start of the part's lifecycle. The IWorkbenchPart.dispose method will be called automically at the end of the lifecycle. Clients must not call this method.

      Implementors of this method must examine the editor input object type to determine if it is understood. If not, the implementor must throw a PartInitException

      Specified by:
      init in interface IEditorPart
      Specified by:
      init in class EditorPart
      Parameters:
      site - the editor site
      input - the editor input
      Throws:
      PartInitException - if this editor was not initialized successfully
    • init

      public void init(IEditorSite site, MultiEditorInput input) throws PartInitException
      Parameters:
      site - the editor site
      input - the editor input
      Throws:
      PartInitException - if this editor was not initialized successfully
      See Also:
    • isDirty

      public boolean isDirty()
      Description copied from interface: ISaveablePart
      Returns whether the contents of this part have changed since the last save operation. If this value changes the part must fire a property listener event with PROP_DIRTY.

      Note: this method is called often on a part open or part activation switch, for example by actions to determine their enabled status.

      Specified by:
      isDirty in interface ISaveablePart
      Specified by:
      isDirty in class EditorPart
      Returns:
      true if the contents have been modified and need saving, and false if they have not changed since the last save
    • isSaveAsAllowed

      public boolean isSaveAsAllowed()
      Description copied from interface: ISaveablePart
      Returns whether the "Save As" operation is supported by this part.
      Specified by:
      isSaveAsAllowed in interface ISaveablePart
      Specified by:
      isSaveAsAllowed in class EditorPart
      Returns:
      true if "Save As" is supported, and false if not supported
    • setFocus

      public void setFocus()
      Description copied from interface: IWorkbenchPart
      Asks this part to take focus within the workbench. Parts must assign focus to one of the controls contained in the part's parent composite.

      Clients should not call this method (the workbench calls this method at appropriate times). To have the workbench activate a part, use IWorkbenchPage.activate(IWorkbenchPart) instead.

      Specified by:
      setFocus in interface IWorkbenchPart
      Specified by:
      setFocus in class WorkbenchPart
    • getActiveEditor

      public final IEditorPart getActiveEditor()
      Returns the active inner editor.
      Returns:
      the active editor
    • getInnerEditors

      public final IEditorPart[] getInnerEditors()
      Returns an array with all inner editors.
      Returns:
      the inner editors
    • setChildren

      public final void setChildren(IEditorPart[] children)
      Set the inner editors. Should not be called by clients.
      Parameters:
      children - the inner editors of this multi editor
      Restriction:
      This method is not intended to be referenced by clients.
    • innerEditorsCreated

      protected abstract void innerEditorsCreated()
      Called as soon as the inner editors have been created and are available.
    • activateEditor

      public void activateEditor(IEditorPart part)
      Activates the given nested editor.
      Parameters:
      part - the nested editor
      Since:
      3.0
    • getIndex

      protected int getIndex(IEditorPart editor)
      Returns the index of the given nested editor.
      Returns:
      the index of the nested editor
      Since:
      3.0
    • dispose

      public void dispose()
      Release the added listener.
      Specified by:
      dispose in interface IWorkbenchPart
      Overrides:
      dispose in class WorkbenchPart
      Since:
      3.2
    • getInnerEditorContainer

      public abstract Composite getInnerEditorContainer(IEditorReference innerEditorReference)
      This method is called after createPartControl has been executed and should return the container for the given inner editor.
      Parameters:
      innerEditorReference - a reference to the inner editor that is being created.
      Returns:
      the container in which the inner editor's pane and part controls are to be created.