public class GenericEditor
extends org.eclipse.ui.part.EditorPart
implements org.eclipse.emf.edit.domain.IEditingDomainProvider, org.eclipse.ui.ide.IGotoMarker
Constructor and Description |
---|
GenericEditor() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
adjustErrorMarker(org.eclipse.core.resources.IMarker marker,
org.eclipse.emf.common.util.Diagnostic diagnostic)
Override this method to set additional attributes on the given
IMarker , e.g. |
protected DiagnosticCache |
createDiangosticCache(org.eclipse.emf.common.notify.Notifier input)
Creates the diagnostic cache.
|
void |
createPartControl(org.eclipse.swt.widgets.Composite parent) |
protected TreeMasterDetailComposite |
createRootView(org.eclipse.swt.widgets.Composite parent,
String editorTitle,
Object editorInput,
List<org.eclipse.jface.action.Action> toolbarActions,
CreateElementCallback createElementCallback)
Creates the top area of the editor.
|
protected TreeMasterDetailComposite |
createTreeMasterDetail(org.eclipse.swt.widgets.Composite composite,
Object editorInput,
CreateElementCallback createElementCallback)
This method creates a tree master detail.
|
protected TreeViewerBuilder |
createTreeViewerBuilder()
Create the
TreeViewerBuilder customization which creates the tree for the editor's tree master detail. |
protected void |
deleteMarkers()
Deletes the problem markers created by this Editor.
|
void |
dispose() |
void |
doSave(org.eclipse.core.runtime.IProgressMonitor monitor) |
void |
doSaveAs() |
protected boolean |
enableValidation() |
protected org.eclipse.emf.common.command.BasicCommandStack |
getCommandStack() |
protected String |
getContextId()
Returns the context id set for this editor.
|
protected CreateElementCallback |
getCreateElementCallback()
Returns the createElementCallback for this editor.
|
protected DiagnosticCache |
getDiagnosticCache() |
org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain() |
protected String |
getEditorTitle()
Returns the title for the currently displayed editor.
|
protected org.eclipse.emf.common.notify.Notifier |
getNotifierFromEditorInput(Object editorInput)
Get the Notifier from the tree input.
|
protected Map<Object,Object> |
getResourceLoadOptions()
The options to be used when loading the editor's resource.
|
protected Map<Object,Object> |
getResourceSaveOptions()
The options to be used when saving the editor's resource.
|
org.eclipse.emf.ecore.resource.ResourceSet |
getResourceSet()
Returns the ResouceSet of this Editor.
|
protected TreeMasterDetailComposite |
getRootView()
Returns the root composite containing the tree and the detail view.
|
protected List<org.eclipse.jface.action.Action> |
getToolbarActions()
Returns the toolbar actions for this editor.
|
void |
gotoMarker(org.eclipse.core.resources.IMarker marker) |
protected void |
handleResourceChange(Collection<org.eclipse.emf.ecore.resource.Resource> changedResources,
Collection<org.eclipse.emf.ecore.resource.Resource> removedResources)
Handles filesystem changes.
|
protected boolean |
hasShortcuts()
Returns true, if the editor should have shortcuts.
|
void |
init(org.eclipse.ui.IEditorSite site,
org.eclipse.ui.IEditorInput input) |
protected boolean |
isClosing()
Returns whether this editor is currently in the process of shutting down.
|
boolean |
isDirty() |
protected boolean |
isEditable(org.eclipse.ui.IEditorInput editorInput)
Returns whether the editor input allows editing of its contents.
|
boolean |
isSaveAsAllowed() |
protected org.eclipse.emf.ecore.resource.ResourceSet |
loadResource(org.eclipse.ui.IEditorInput editorInput)
Creates a resource set and loads all required resources for the editor input.
|
protected Object |
modifyEditorInput(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Allows to modify the input object for the editor.
|
protected void |
postSave()
Executes the code which needs to be executed after a save, e.g.
|
protected void |
preSave()
Executes the code which needs to be executed before a save, e.g.
|
protected List<org.eclipse.jface.action.Action> |
readToolbarActions()
Read toolbar actions from all extensions.
|
protected void |
refreshTreeAfterResourceChange()
Called after a resource change to refresh the tree master detail of the editor.
|
protected void |
reloadResources(Collection<org.eclipse.emf.ecore.resource.Resource> resources)
Reloads the given resources and refreshes the tree accordingly.
|
protected void |
removeResources(Collection<org.eclipse.emf.ecore.resource.Resource> resources)
Removes the given Resources from this editor's ResourceSet.
|
void |
reveal(org.eclipse.emf.ecore.EObject objectToReveal)
The given element will be revealed in the tree of the editor.
|
void |
reveal(UniqueSetting setting)
Reveal the control that edits a
setting of some object. |
protected void |
setClosing(boolean closing)
Set whether this editor is currently in the process of shutting down.
|
void |
setFocus() |
protected void |
verifyEditorResource(org.eclipse.emf.common.util.URI resourceURI,
org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Check that the resource was loaded correctly and show any warnings to the user.
|
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
addPartPropertyListener, addPropertyListener, 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
protected DiagnosticCache getDiagnosticCache()
DiagnosticCache
. may be null
public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
doSave
in interface org.eclipse.ui.ISaveablePart
doSave
in class org.eclipse.ui.part.EditorPart
protected void preSave()
protected void postSave()
protected void handleResourceChange(Collection<org.eclipse.emf.ecore.resource.Resource> changedResources, Collection<org.eclipse.emf.ecore.resource.Resource> removedResources)
changedResources
- A List of changed ResourcesremovedResources
- A List of removed Resourcesprotected void reloadResources(Collection<org.eclipse.emf.ecore.resource.Resource> resources)
resources
- The Resources
to reloadprotected void refreshTreeAfterResourceChange()
public void doSaveAs()
doSaveAs
in interface org.eclipse.ui.ISaveablePart
doSaveAs
in class org.eclipse.ui.part.EditorPart
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
init
in interface org.eclipse.ui.IEditorPart
init
in class org.eclipse.ui.part.EditorPart
org.eclipse.ui.PartInitException
protected String getContextId()
public boolean isDirty()
isDirty
in interface org.eclipse.ui.ISaveablePart
isDirty
in class org.eclipse.ui.part.EditorPart
public boolean isSaveAsAllowed()
isSaveAsAllowed
in interface org.eclipse.ui.ISaveablePart
isSaveAsAllowed
in class org.eclipse.ui.part.EditorPart
public void createPartControl(org.eclipse.swt.widgets.Composite parent)
createPartControl
in interface org.eclipse.ui.IWorkbenchPart
createPartControl
in class org.eclipse.ui.part.WorkbenchPart
protected void deleteMarkers() throws org.eclipse.core.runtime.CoreException
Job
to avoid problems with a locked index.org.eclipse.core.runtime.CoreException
- if the method failsprotected org.eclipse.emf.common.notify.Notifier getNotifierFromEditorInput(Object editorInput)
editorInput
- The editor input to transformNotifier
IllegalStateException
- if the editor input is not a Notifierprotected DiagnosticCache createDiangosticCache(org.eclipse.emf.common.notify.Notifier input)
input
- the inputprotected boolean enableValidation()
protected TreeMasterDetailComposite createRootView(org.eclipse.swt.widgets.Composite parent, String editorTitle, Object editorInput, List<org.eclipse.jface.action.Action> toolbarActions, CreateElementCallback createElementCallback)
parent
- The parent Composite
editorTitle
- The title of the editoreditorInput
- the editor inputtoolbarActions
- The actions shown on the top areacreateElementCallback
- a call back if elements are createdTreeMasterDetailComposite
protected TreeMasterDetailComposite getRootView()
TreeMasterDetailComposite
of this editorprotected TreeMasterDetailComposite createTreeMasterDetail(org.eclipse.swt.widgets.Composite composite, Object editorInput, CreateElementCallback createElementCallback)
composite
- the parent compositeeditorInput
- the editor inputcreateElementCallback
- the create element callback to addTreeMasterDetailComposite
protected TreeViewerBuilder createTreeViewerBuilder()
TreeViewerBuilder
customization which creates the tree for the editor's tree master detail.
Clients can override this to customize the tree viewer.
TreeViewerBuilder
which creates the tree viewer for the editor's tree master detailprotected Object modifyEditorInput(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
resourceSet
- the resourceSet which is the default editor inputprotected org.eclipse.emf.ecore.resource.ResourceSet loadResource(org.eclipse.ui.IEditorInput editorInput) throws org.eclipse.ui.PartInitException
editorInput
- the editor inputorg.eclipse.ui.PartInitException
- if the resource could not be loadedprotected boolean isEditable(org.eclipse.ui.IEditorInput editorInput)
editorInput
- the editor's IEditorInput
true
if the input source allows editing, false
otherwiseprotected void verifyEditorResource(org.eclipse.emf.common.util.URI resourceURI, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
resourceSet
- the resource setresourceURI
- the URI of the resourceprotected Map<Object,Object> getResourceLoadOptions()
protected Map<Object,Object> getResourceSaveOptions()
public void setFocus()
setFocus
in interface org.eclipse.ui.IWorkbenchPart
setFocus
in class org.eclipse.ui.part.WorkbenchPart
protected boolean hasShortcuts()
protected String getEditorTitle()
protected CreateElementCallback getCreateElementCallback()
public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
getEditingDomain
in interface org.eclipse.emf.edit.domain.IEditingDomainProvider
protected List<org.eclipse.jface.action.Action> getToolbarActions()
protected List<org.eclipse.jface.action.Action> readToolbarActions()
public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
public void dispose()
dispose
in interface org.eclipse.ui.IWorkbenchPart
dispose
in class org.eclipse.ui.part.WorkbenchPart
public void gotoMarker(org.eclipse.core.resources.IMarker marker)
gotoMarker
in interface org.eclipse.ui.ide.IGotoMarker
IGotoMarker.gotoMarker(org.eclipse.core.resources.IMarker)
public void reveal(org.eclipse.emf.ecore.EObject objectToReveal)
objectToReveal
- the object to revealpublic void reveal(UniqueSetting setting)
setting
of some object.setting
- the feature setting to reveal of objectprotected org.eclipse.emf.common.command.BasicCommandStack getCommandStack()
org.eclipse.emf.common.command.CommandStack;
protected boolean adjustErrorMarker(org.eclipse.core.resources.IMarker marker, org.eclipse.emf.common.util.Diagnostic diagnostic) throws org.eclipse.core.runtime.CoreException
IMarker
, e.g. location information.marker
- the IMarker
to adjustdiagnostic
- the Diagnostic
true
if the marker was changed, false
otherwiseorg.eclipse.core.runtime.CoreException
- in case of an errorprotected boolean isClosing()
true
if the editor is currently closing, false
otherwiseprotected void setClosing(boolean closing)
closing
- Whether the editor is currently closing (shutting down)protected void removeResources(Collection<org.eclipse.emf.ecore.resource.Resource> resources)
resources
- The Resources to remove from this editor's ResourceSet.Copyright © 2019. All rights reserved.