org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts
Class DiagramDocumentEditor
java.lang.Object
DiagramEditorWithFlyOutPalette
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor
-
All Implemented Interfaces:
-
IAdaptable,
IDocumentEditor,
IEditorPart,
IReusableEditor,
ISaveablePart,
IWorkbenchPart
-
Direct Known Subclasses:
-
IDEDiagramDocumentEditor
-
public class DiagramDocumentEditor
- extends DiagramEditorWithFlyOutPalette
- implements
IDocumentEditor,
IReusableEditor
A Diagram Editor with optional flyout palette.
Constructor Summary
|
DiagramDocumentEditor
(boolean hasFlyoutPalette)
Constructs a diagram editor with optional flyout palette. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
statusLineLabelProvider
protected
ILabelProvider statusLineLabelProvider
- A label provider for the status line (one of the status line contributions).
-
Since:
- 1.2
statusLineContributions
protected java.util.List<
IContributionItem> statusLineContributions
- A list of contribution items for the status line.
-
Since:
- 1.2
fErrorLabel
protected final java.lang.String fErrorLabel
- The error message shown in the status line in case of failed information look up.
DiagramDocumentEditor
public DiagramDocumentEditor(boolean hasFlyoutPalette)
- Constructs a diagram editor with optional flyout palette.
-
Parameters:
-
hasFlyoutPalette
- creates a palette if true, else no palette
getAdapter
public java.lang.Object getAdapter(java.lang.Class type)
-
-
Specified by:
-
getAdapter
in interface
IAdaptable
-
init
public void init(
IEditorSite site,
IEditorInput input)
throws
PartInitException
-
-
Specified by:
-
init
in interface
IEditorPart
-
-
Throws:
-
PartInitException
setSite
protected final void setSite(
IWorkbenchPartSite site)
-
-
initializeGraphicalViewer
protected void initializeGraphicalViewer()
-
-
dispose
public void dispose()
-
-
Specified by:
-
dispose
in interface
IWorkbenchPart
-
getDiagram
public
Diagram getDiagram()
-
-
getDiagramDocument
public
IDiagramDocument getDiagramDocument()
-
-
askUserSaveOverwrite
public boolean askUserSaveOverwrite()
-
-
askUserSaveClose
public int askUserSaveClose()
-
-
askUserReload
public boolean askUserReload()
-
-
configureDiagramEditDomain
protected void configureDiagramEditDomain()
-
-
-
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#configureDiagramEditDomain()
createActionManager
protected ActionManager createActionManager()
-
-
createOperationHistory
protected
IOperationHistory createOperationHistory()
- Create my operation history.
-
-
-
Returns:
- my operation history
getDefaultPaletteContent
protected java.lang.Object getDefaultPaletteContent()
-
-
selectionChanged
public void selectionChanged(
IWorkbenchPart part,
ISelection selection)
-
-
getDocumentProvider
public
IDocumentProvider getDocumentProvider()
-
Description copied from interface:
IDocumentEditor
- Returns this text editor's document provider.
-
-
Specified by:
-
getDocumentProvider
in interface
IDocumentEditor
-
-
Returns:
- the document provider or
null
if none, e.g. after closing the editor
setDocumentProvider
protected void setDocumentProvider(
IDocumentProvider provider)
- Sets this editor's document provider. This method must be
called before the editor's control is created.
-
-
-
Parameters:
-
provider
- the document provider
isEditable
public boolean isEditable()
-
Description copied from interface:
IDocumentEditor
- Returns whether the text in this text editor can be changed by the user.
-
-
Specified by:
-
isEditable
in interface
IDocumentEditor
-
-
Returns:
-
true
if it can be edited, and false
if it is read-only
setDocumentProvider
protected void setDocumentProvider(
IEditorInput input)
- Hook method for setting the document provider for the given input.
This default implementation does nothing. Clients may
reimplement.
-
-
-
Parameters:
-
input
- the input of this editor.
getDocumentProvider
protected
IDocumentProvider getDocumentProvider(
IEditorInput input)
- Hook method for setting the document provider for the given input.
This default implementation does nothing. Clients may
reimplement.
-
-
-
Parameters:
-
input
- the input of this editor.
releaseInput
protected void releaseInput()
- refreshes the editor with the given file by: 0 - resets resource
modification stamp 1- Flushing the command stack 2- Clearing the
graphical viewer's contents 3- Setting the new File input 4- Setting the
new graphical viewer's contents 5- Clearing the graphical viewer's
selection
-
-
-
Parameters:
-
file
- The new file editor input
setInput
public void setInput(
IEditorInput input)
-
-
Specified by:
-
setInput
in interface
IReusableEditor
-
doSetInput
public void doSetInput(
IEditorInput input,
boolean releaseEditorContents)
throws
CoreException
-
-
-
Throws:
-
CoreException
close
public void close(boolean save)
-
Description copied from interface:
IDocumentEditor
- Closes this text editor after optionally saving changes.
-
-
Specified by:
-
close
in interface
IDocumentEditor
-
-
Parameters:
-
save
- true
if unsaved changed should be saved, and
false
if unsaved changed should be discarded
disposeDocumentProvider
protected void disposeDocumentProvider()
- Disposes of the connection with the document provider. Subclasses
may extend.
-
-
getProgressMonitor
protected
IProgressMonitor getProgressMonitor()
- Returns the progress monitor related to this editor. It should not be
necessary to extend this method.
-
-
-
Returns:
- the progress monitor related to this editor
handleEditorInputChanged
protected void handleEditorInputChanged()
- Handles an external change of the editor's input element. Subclasses may
extend.
-
-
doSaveAs
public void doSaveAs()
- The
AbstractDiagramEditor
implementation of this
IEditorPart
method calls performSaveAs
.
Subclasses may reimplement.
-
-
Specified by:
-
doSaveAs
in interface
ISaveablePart
-
performSaveAs
protected void performSaveAs(
IProgressMonitor progressMonitor)
- Performs a save as and reports the result state back to the
given progress monitor. This default implementation does nothing.
Subclasses may reimplement.
-
-
-
Parameters:
-
progressMonitor
- the progress monitor for communicating result state or null
doSave
public void doSave(
IProgressMonitor progressMonitor)
- The
AbstractDiagramEditor
implementation of this
IEditorPart
method may be extended by subclasses.
-
-
Specified by:
-
doSave
in interface
ISaveablePart
-
-
Parameters:
-
progressMonitor
- the progress monitor for communicating result state or null
enableSanityChecking
protected void enableSanityChecking(boolean enable)
- Enables/disables sanity checking.
-
-
-
Parameters:
-
enable
- true
if sanity checking should be enabled, false
otherwise
safelySanityCheckState
protected void safelySanityCheckState(
IEditorInput input)
- Checks the state of the given editor input if sanity checking is enabled.
-
-
-
Parameters:
-
input
- the editor input whose state is to be checked
sanityCheckState
protected void sanityCheckState(
IEditorInput input)
- Checks the state of the given editor input.
-
-
-
Parameters:
-
input
- the editor input whose state is to be checked
enableStateValidation
protected void enableStateValidation(boolean enable)
- Enables/disables state validation.
-
-
-
Parameters:
-
enable
- true
if state validation should be enabled, false
otherwise
validateState
protected void validateState(
IEditorInput input)
- Validates the state of the given editor input. The predominate intent
of this method is to take any action probably necessary to ensure that
the input can persistently be changed.
-
-
-
Parameters:
-
input
- the input to be validated
validateEditorInputState
public boolean validateEditorInputState()
-
Description copied from interface:
IDocumentEditor
- Validates the state of the given editor input. The predominate intent
of this method is to take any action probably necessary to ensure that
the input can persistently be changed.
-
-
Specified by:
-
validateEditorInputState
in interface
IDocumentEditor
-
-
Returns:
-
true
if the input was validated, false
otherwise
updateState
protected void updateState(
IEditorInput input)
- Updates the state of the given editor input such as read-only flag.
-
-
-
Parameters:
-
input
- the input to be validated
performSave
protected void performSave(boolean overwrite,
IProgressMonitor progressMonitor)
- Performs the save and handles errors appropriately.
-
-
-
Parameters:
-
overwrite
- indicates whether or not overwriting is allowed -
progressMonitor
- the monitor in which to run the operation
handleExceptionOnSave
protected void handleExceptionOnSave(
CoreException exception,
IProgressMonitor progressMonitor)
- Handles the given exception. If the exception reports an out-of-sync
situation, this is reported to the user. Otherwise, the exception
is generically reported.
-
-
-
Parameters:
-
exception
- the exception to handle -
progressMonitor
- the progress monitor
isSaveAsAllowed
public boolean isSaveAsAllowed()
- The
AbstractDiagramEditor
implementation of this
IEditorPart
method returns false
.
Subclasses may override.
-
-
Specified by:
-
isSaveAsAllowed
in interface
ISaveablePart
-
-
Returns:
-
false
isDirty
public boolean isDirty()
-
-
Specified by:
-
isDirty
in interface
ISaveablePart
-
handleElementContentReplaced
protected void handleElementContentReplaced()
- Performs any additional action necessary to perform after the input
document's content has been replaced.
Clients may extended this method.
-
-
handleElementContentAboutToBeReplaced
protected void handleElementContentAboutToBeReplaced()
- Performs any additional action necessary to perform after the input
document's content has been replaced.
Clients may extended this method.
-
-
editorSaved
protected void editorSaved()
- Hook which gets called when the editor has been saved.
Subclasses may extend.
-
-
firePropertyChange
protected void firePropertyChange(int property)
-
-
isEditorInputReadOnly
public boolean isEditorInputReadOnly()
-
Description copied from interface:
IDocumentEditor
- Returns whether the editor's input is read-only. The semantics of
this method is orthogonal to
isEditable
as it talks about the
editor input, i.e. the domain element, and not about the editor
document.
-
-
Specified by:
-
isEditorInputReadOnly
in interface
IDocumentEditor
-
-
Returns:
-
true
if the editor input is read-only
isEditorInputModifiable
public boolean isEditorInputModifiable()
-
Description copied from interface:
IDocumentEditor
- Returns whether the editor's input can be persistently be modified.
This is orthogonal to
ITextEditorExtension.isEditorInputReadOnly
as read-only elements may be modifiable and
writable elements may not be modifiable. If the given element is not connected to this document
provider, the result is undefined. Document providers are allowed to use a cache to answer this
question, i.e. there can be a difference between the "real" state of the element and the return
value.
-
-
Specified by:
-
isEditorInputModifiable
in interface
IDocumentEditor
-
-
Returns:
-
true
if the editor input is modifiable
getEditorDescriptor
protected final
IEditorDescriptor getEditorDescriptor()
- Retrieves the descriptor for this editor
-
-
-
Returns:
- the editor descriptor
createPartControl
public void createPartControl(
Composite parent)
-
-
Specified by:
-
createPartControl
in interface
IWorkbenchPart
-
getEditingDomain
public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
-
-
createEditingDomain
protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain()
- Gets an editing domain from the editing domain registry using the id
returned from
getEditingDomainID()
if an editing domain has been
registered already with this id. Use the
org.eclipse.emf.transaction.editingDomains
extension point
to register a shared editing domain.
If an editing domain is not found for the id, then a new editing domain
will be created per editor instance.
-
-
-
Returns:
- the editing domain
getEditingDomainID
protected java.lang.String getEditingDomainID()
- Returns an editing domain id used to retrive an editing domain from the
editing domain registry. Clients should override this if they wish to use
a shared editing domain for this editor. If null is returned then a new
editing domain will be created per editor instance.
-
-
-
Returns:
- the shared editing domain id if applicable
reuseDiagramOnMove
protected boolean reuseDiagramOnMove()
-
-
updateStatusLineMessageContribution
protected void updateStatusLineMessageContribution(java.lang.String message,
Image image)
- Update the status line message contribution. The default status line
manager provides the ability to display an icon and message.
-
-
-
Parameters:
-
message
- The message. -
image
- The icon image. -
Since:
- 1.2
addStatusLineContributions
protected void addStatusLineContributions()
- Add the status line contributions to this editor from the status line
service.
-
-
-
Since:
- 1.2
removeStatusLineContributions
protected void removeStatusLineContributions()
- Remove the status line contributions from this editor.
-
-
-
Since:
- 1.2
rebuildStatusLine
protected void rebuildStatusLine()
- Rebuild the status line contributions from this editor.
-
-
-
Since:
- 1.2
isStatusLineOn
protected boolean isStatusLineOn()
- Determine if the status line should be on based on the global
preference.
-
-
-
Since:
- 1.2
handleSelectionChanged
protected void handleSelectionChanged()
- If the status line is on and the editor has a status line label provider,
the update.
-
-
-
Since:
- 1.2
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.