public abstract class AbstractMultiEditor extends EditorPart
PROP_DIRTY, PROP_INPUT
PROP_TITLE
Constructor and Description |
---|
AbstractMultiEditor()
Constructs an editor to contain other editors.
|
Modifier and Type | Method and Description |
---|---|
void |
activateEditor(IEditorPart part)
Activates the given nested editor.
|
void |
dispose()
Release the added listener.
|
void |
doSave(IProgressMonitor monitor)
Saves the contents of this part.
|
void |
doSaveAs()
Saves the contents of this part to another object.
|
IEditorPart |
getActiveEditor()
Returns the active inner editor.
|
protected int |
getIndex(IEditorPart editor)
Returns the index of the given nested editor.
|
abstract Composite |
getInnerEditorContainer(IEditorReference innerEditorReference)
This method is called after createPartControl has been executed and
should return the container for the given inner editor.
|
IEditorPart[] |
getInnerEditors()
Returns an array with all inner editors.
|
protected void |
handlePropertyChange(int propId)
Handles a property change notification from a nested editor.
|
void |
init(IEditorSite site,
IEditorInput input)
Initializes this editor with the given editor site and input.
|
void |
init(IEditorSite site,
MultiEditorInput input) |
protected abstract void |
innerEditorsCreated()
Called as soon as the inner editors have been created and are available.
|
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.
|
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
addPartPropertyListener, addPropertyListener, createPartControl, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyListener, createPartControl, getSite, getTitle, getTitleImage, removePropertyListener
getAdapter
public AbstractMultiEditor()
protected void handlePropertyChange(int propId)
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.
propId
- the id of the property that changedpublic void doSave(IProgressMonitor monitor)
ISaveablePart
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.
doSave
in interface ISaveablePart
doSave
in class EditorPart
monitor
- the progress monitorpublic void doSaveAs()
ISaveablePart
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).
doSaveAs
in interface ISaveablePart
doSaveAs
in class EditorPart
public void init(IEditorSite site, IEditorInput input) throws PartInitException
IEditorPart
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
init
in interface IEditorPart
init
in class EditorPart
site
- the editor siteinput
- the editor inputPartInitException
- if this editor was not initialized successfullypublic void init(IEditorSite site, MultiEditorInput input) throws PartInitException
site
- input
- PartInitException
IEditorPart.init(IEditorSite, IEditorInput)
public boolean isDirty()
ISaveablePart
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.
isDirty
in interface ISaveablePart
isDirty
in class EditorPart
true
if the contents have been modified and need
saving, and false
if they have not changed since the last
savepublic boolean isSaveAsAllowed()
ISaveablePart
isSaveAsAllowed
in interface ISaveablePart
isSaveAsAllowed
in class EditorPart
true
if "Save As" is supported, and false
if not supportedpublic void setFocus()
IWorkbenchPart
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
.
setFocus
in interface IWorkbenchPart
setFocus
in class WorkbenchPart
public final IEditorPart getActiveEditor()
public final IEditorPart[] getInnerEditors()
public final void setChildren(IEditorPart[] children)
children
- the inner editors of this multi editorprotected abstract void innerEditorsCreated()
public void activateEditor(IEditorPart part)
part
- the nested editorprotected int getIndex(IEditorPart editor)
public void dispose()
dispose
in interface IWorkbenchPart
dispose
in class WorkbenchPart
public abstract Composite getInnerEditorContainer(IEditorReference innerEditorReference)
innerEditorReference
- a reference to the inner editor that is being created.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.