Eclipse Platform
Release 3.0

org.eclipse.ui.part
Class MultiEditor

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended byorg.eclipse.ui.part.MultiEditor
All Implemented Interfaces:
IAdaptable, IEditorPart, IExecutableExtension, ISaveablePart, IWorkbenchPart, IWorkbenchPart2

public abstract class MultiEditor
extends EditorPart

A MultiEditor is a composite of editors. This class is intended to be subclassed.


Nested Class Summary
static class MultiEditor.Gradient
          The colors used to draw the title bar of the inner editors
 
Field Summary
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
MultiEditor()
          Constructor for TileEditor.
 
Method Summary
protected  void activateEditor(IEditorPart part)
          Activates the given nested editor.
 Composite createInnerPartControl(Composite parent, IEditorPart e)
          Create the control of the inner editor.
 void dispose()
          The MultiEditor implementation of this method extends the EditorPart implementation, and disposes any inner editors.
 void doSave(IProgressMonitor monitor)
          Saves the contents of this part.
 void doSaveAs()
          Saves the contents of this part to another object.
protected abstract  void drawGradient(IEditorPart innerEditor, MultiEditor.Gradient g)
          Draw the gradient in the title bar.
 IEditorPart getActiveEditor()
          Returns the active inner editor.
protected  int getIndex(IEditorPart editor)
          Returns the index of the given nested editor.
 IEditorPart[] getInnerEditors()
          Returns an array with all inner editors.
protected  boolean getShellActivated()
          Return true if the shell is activated.
 void init(IEditorSite site, IEditorInput input)
          Initializes this editor with the given editor site and input.
 void init(IEditorSite site, MultiEditorInput input)
           
 boolean isDirty()
          Returns whether the contents of this part have changed since the last save operation.
 boolean isSaveAsAllowed()
          Returns whether the "Save As" operation is supported by this part.
 void setChildren(IEditorPart[] children)
          Set the inner editors.
 void setFocus()
          Asks this part to take focus within the workbench.
 void updateGradient(IEditorPart editor)
          Updates the gradient in the title bar.
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, createPartControl, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, createPartControl, getSite, getTitle, getTitleImage, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

MultiEditor

public MultiEditor()
Constructor for TileEditor.

Method Detail

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

createInnerPartControl

public Composite createInnerPartControl(Composite parent,
                                        IEditorPart e)
Create the control of the inner editor. Must be called by subclass.


dispose

public void dispose()
The MultiEditor implementation of this method extends the EditorPart implementation, and disposes any inner editors. Subclasses may extend.

Specified by:
dispose in interface IWorkbenchPart
Overrides:
dispose in class WorkbenchPart
Since:
3.0

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
Throws:
PartInitException

init

public void init(IEditorSite site,
                 MultiEditorInput input)
          throws PartInitException
Throws:
PartInitException

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.

Specified by:
isDirty in interface ISaveablePart
Specified by:
isDirty in class EditorPart

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

setFocus

public void setFocus()
Description copied from interface: IWorkbenchPart
Asks this part to take focus within the workbench.

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.


getInnerEditors

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


setChildren

public final void setChildren(IEditorPart[] children)
Set the inner editors. Should not be called by clients.


activateEditor

protected 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

updateGradient

public void updateGradient(IEditorPart editor)
Updates the gradient in the title bar.


drawGradient

protected abstract void drawGradient(IEditorPart innerEditor,
                                     MultiEditor.Gradient g)
Draw the gradient in the title bar.


getShellActivated

protected boolean getShellActivated()
Return true if the shell is activated.


Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.