public abstract class GraphicalEditor extends EditorPart implements CommandStackListener, ISelectionListener
IMPORTANTThis class should only be used as a reference for creating your own EditorPart implementation. This class will not suit everyone's needs, and may change in the future. Clients may copy the implementation.
PROP_DIRTY, PROP_INPUTPROP_TITLE| Constructor and Description |
|---|
GraphicalEditor()
Constructs the editor part
|
| Modifier and Type | Method and Description |
|---|---|
void |
commandStackChanged(java.util.EventObject event)
When the command stack changes, the actions interested in the command
stack are updated.
|
protected void |
configureGraphicalViewer()
Called to configure the graphical viewer before it receives its contents.
|
protected void |
createActions()
Creates actions for this editor.
|
protected void |
createGraphicalViewer(Composite parent)
Creates the GraphicalViewer on the specified
Composite. |
void |
createPartControl(Composite parent)
Realizes the Editor by creating it's Control.
|
void |
dispose() |
void |
doSaveAs()
Does nothing be default.
|
protected void |
firePropertyChange(int property) |
protected ActionRegistry |
getActionRegistry()
Lazily creates and returns the action registry.
|
java.lang.Object |
getAdapter(java.lang.Class type)
Returns the adapter for the specified key.
|
protected CommandStack |
getCommandStack()
Returns the command stack.
|
protected DefaultEditDomain |
getEditDomain()
Returns the edit domain.
|
protected GraphicalViewer |
getGraphicalViewer()
Returns the graphical viewer.
|
protected java.util.List |
getPropertyActions()
Returns the list of
IActions dependant on property
changes in the Editor. |
protected java.util.List |
getSelectionActions()
Returns the list of IDs of Actions that are dependant on changes
in the workbench's
ISelectionService. |
protected SelectionSynchronizer |
getSelectionSynchronizer()
Returns the selection syncronizer object.
|
protected java.util.List |
getStackActions()
Returns the list of IDs of Actions that are dependant on the
CommmandStack's state.
|
protected void |
hookGraphicalViewer()
Hooks the GraphicalViewer to the rest of the Editor.
|
void |
init(IEditorSite site,
IEditorInput input)
Sets the site and input for this editor then creates and initializes the
actions.
|
protected void |
initializeActionRegistry()
Initializes the ActionRegistry.
|
protected abstract void |
initializeGraphicalViewer()
Override to set the contents of the GraphicalViewer after it has been
created.
|
boolean |
isDirty()
Returns
true if the command stack is dirty |
boolean |
isSaveAsAllowed()
Returns
false by default. |
void |
selectionChanged(IWorkbenchPart part,
ISelection selection) |
protected void |
setActionRegistry(ActionRegistry registry)
Sets the ActionRegistry for this EditorPart.
|
protected void |
setEditDomain(DefaultEditDomain ed)
Sets the EditDomain for this EditorPart.
|
void |
setFocus() |
protected void |
setGraphicalViewer(GraphicalViewer viewer)
Sets the graphicalViewer for this EditorPart.
|
protected void |
updateActions(java.util.List actionIds)
A convenience method for updating a set of actions defined by the given
List of action IDs.
|
checkSite, doSave, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartNameaddPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusyaddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyListener, getSite, getTitle, getTitleImage, removePropertyListenerpublic void commandStackChanged(java.util.EventObject event)
commandStackChanged in interface CommandStackListenerevent - the change eventprotected void configureGraphicalViewer()
protected void createActions()
ActionRegistry.protected void createGraphicalViewer(Composite parent)
Composite.parent - the parent compositepublic void createPartControl(Composite parent)
WARNING: This method may or may not be called by the workbench prior to
dispose().
createPartControl in interface IWorkbenchPartcreatePartControl in class WorkbenchPartparent - the parent compositepublic void dispose()
dispose in interface IWorkbenchPartdispose in class WorkbenchPartIWorkbenchPart.dispose()public void doSaveAs()
isSaveAsAllowed() has been overridden to return
true.doSaveAs in interface ISaveablePartdoSaveAs in class EditorPartISaveablePart.doSaveAs()protected void firePropertyChange(int property)
firePropertyChange in class WorkbenchPartWorkbenchPart.firePropertyChange(int)protected ActionRegistry getActionRegistry()
public java.lang.Object getAdapter(java.lang.Class type)
IMPORTANT certain requests, such as the property sheet, may be
made before or after createPartControl(Composite) is called. The
order is unspecified by the Workbench.
getAdapter in interface IAdaptablegetAdapter in class WorkbenchPartIAdaptable.getAdapter(java.lang.Class)protected CommandStack getCommandStack()
protected DefaultEditDomain getEditDomain()
protected GraphicalViewer getGraphicalViewer()
protected java.util.List getPropertyActions()
IActions dependant on property
changes in the Editor. These actions should implement the
UpdateAction interface so that they can be updated in response to
property changes. An example is the "Save" action.protected java.util.List getSelectionActions()
ISelectionService. The associated Actions can
be found in the action registry. Such actions should implement the
UpdateAction interface so that they can be updated in response to
selection changes.updateActions(List)protected SelectionSynchronizer getSelectionSynchronizer()
protected java.util.List getStackActions()
UpdateAction
interface so that they can be updated in response to command stack
changes. An example is the "undo" action.protected void hookGraphicalViewer()
public void init(IEditorSite site, IEditorInput input) throws PartInitException
super.init(site, input)
.init in interface IEditorPartinit in class EditorPartPartInitExceptionIEditorPart.init(IEditorSite, IEditorInput)protected void initializeActionRegistry()
ActionBarContributors and/or
ContextMenuProviders.
This method may be called on Editor creation, or lazily the first time
getActionRegistry() is called.
protected abstract void initializeGraphicalViewer()
createGraphicalViewer(Composite)public boolean isDirty()
true if the command stack is dirtyisDirty in interface ISaveablePartisDirty in class EditorPartISaveablePart.isDirty()public boolean isSaveAsAllowed()
isSaveAsAllowed in interface ISaveablePartisSaveAsAllowed in class EditorPartISaveablePart.isSaveAsAllowed()public void selectionChanged(IWorkbenchPart part, ISelection selection)
selectionChanged in interface ISelectionListenerISelectionListener.selectionChanged(IWorkbenchPart,
ISelection)protected void setActionRegistry(ActionRegistry registry)
registry - the registryprotected void setEditDomain(DefaultEditDomain ed)
ed - the domainpublic void setFocus()
setFocus in interface IWorkbenchPartsetFocus in class WorkbenchPartIWorkbenchPart.setFocus()protected void setGraphicalViewer(GraphicalViewer viewer)
viewer - the graphical viewerprotected void updateActions(java.util.List actionIds)
action registry. If the corresponding action
is an UpdateAction, it will have its update() method
called.actionIds - the list of IDs to updateCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.