public abstract class ModelMultiPageEditorPart
extends org.eclipse.ui.part.MultiPageEditorPart
implements org.eclipse.emf.edit.domain.IEditingDomainProvider, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.jface.action.IMenuListener, org.eclipse.emf.common.ui.viewer.IViewerProvider, org.eclipse.ui.ide.IGotoMarker
transactional editing domain
ResourceSetListener
is statically registered on this editing
domain that automatically creates editors for any resource loaded (e.g., by
proxy resolution)IOperationHistory
. It provides its IUndoContext
to
specialized implementations of the undo/redo actions that operate on the
operation history. Execution of commands is also delegated to the operation
historyTransactionalEditingDomain.runExclusive(Runnable)
APIWorkspaceSynchronizer
utility API instead of a
resource-change listenerModifier and Type | Class and Description |
---|---|
class |
ModelMultiPageEditorPart.ReverseAdapterFactoryContentProvider
.CUSTOM: EMF-generated class extends AdapterFactoryContentProvider
|
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.emf.edit.provider.ComposedAdapterFactory |
adapterFactory
This is the one adapter factory used for providing views of the model.
|
protected java.util.Collection<org.eclipse.emf.ecore.resource.Resource> |
changedResources
Resources that have been changed since last activation.
|
protected org.eclipse.ui.views.contentoutline.IContentOutlinePage |
contentOutlinePage
This is the content outline page.
|
protected org.eclipse.jface.action.IStatusLineManager |
contentOutlineStatusLineManager
This is a kludge...
|
protected org.eclipse.jface.viewers.TreeViewer |
contentOutlineViewer
This is the content outline page's viewer.
|
protected org.eclipse.jface.viewers.Viewer |
currentViewer
This keeps track of the active content viewer, which may be either one of
the viewers in the pages or the content outline viewer.
|
protected org.eclipse.emf.common.ui.ViewerPane |
currentViewerPane
This keeps track of the active viewer pane, in the book.
|
protected org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain |
editingDomain
This keeps track of the editing domain that is used to track all changes
to the model.
|
protected org.eclipse.jface.viewers.ISelection |
editorSelection
This keeps track of the selection of the editor as a whole.
|
protected org.eclipse.emf.common.ui.MarkerHelper |
markerHelper
The MarkerHelper is responsible for creating workspace resource markers
presented in Eclipse's Problems View.
|
protected java.util.Map<org.eclipse.emf.ecore.resource.Resource,org.eclipse.emf.common.util.URI> |
movedResources
Resources that have been moved since last activation.
|
protected org.eclipse.ui.IPartListener |
partListener
This listens for when the outline becomes active
|
protected org.eclipse.emf.ecore.util.EContentAdapter |
problemIndicationAdapter
Adapter used to update the problem indication when resources are demanded
loaded.
|
protected org.eclipse.ui.views.properties.PropertySheetPage |
propertySheetPage
This is the property sheet page.
|
protected java.util.Collection<org.eclipse.emf.ecore.resource.Resource> |
removedResources
Resources that have been removed since last activation.
|
protected org.eclipse.emf.ecore.resource.Resource |
resource
.CUSTOM: The (one and only) resource that we are editing.
|
protected java.util.Map<org.eclipse.emf.ecore.resource.Resource,org.eclipse.emf.common.util.Diagnostic> |
resourceToDiagnosticMap
Map to store the diagnostic associated with a resource.
|
protected java.util.Collection<org.eclipse.emf.ecore.resource.Resource> |
savedResources
Resources that have been saved.
|
protected org.eclipse.jface.viewers.ISelectionChangedListener |
selectionChangedListener
This listens to which ever viewer is active.
|
protected java.util.Collection<org.eclipse.jface.viewers.ISelectionChangedListener> |
selectionChangedListeners
This keeps track of all the
ISelectionChangedListener s that are
listening to this editor. |
protected org.eclipse.jface.viewers.TreeViewer |
selectionViewer
This is the viewer that shadows the selection in the content outline.
|
protected org.eclipse.core.commands.operations.IUndoContext |
undoContext
.CUSTOM: The undo context for this editor's Undo and Redo menus
|
protected boolean |
updateProblemIndication
Controls whether the problem indication should be updated.
|
protected org.eclipse.emf.workspace.util.WorkspaceSynchronizer |
workspaceSynchronizer
Synchronizes workspace changes with the editing domain .CUSTOM: Replaces
the resourceChangeListener field generated by EMF
|
Constructor and Description |
---|
ModelMultiPageEditorPart()
This creates a model editor.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
This implements
ISelectionProvider . |
org.eclipse.emf.common.util.Diagnostic |
analyzeResourceProblems(org.eclipse.emf.ecore.resource.Resource aResource,
java.lang.Exception aException)
Returns a diagnostic describing the errors and warnings listed in the
resource and the specified exception (if any).
|
protected void |
createContextMenuFor(org.eclipse.jface.viewers.StructuredViewer viewer)
This creates a context menu for the viewer and adds a listener as well
registering the menu for extension.
|
void |
createModel()
This is the method called to load a resource into the editing domain's
resource set based on the editor's input.
|
void |
createPages()
This is the method used by the framework to install your own controls.
.CUSTOM: We only have the one tree editor in this example.
|
void |
dispose() |
void |
doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
This is for implementing
IEditorPart and simply saves the model
file. |
void |
doSaveAs()
This also changes the editor's input.
|
protected void |
doSaveAs(org.eclipse.emf.common.util.URI aUri,
org.eclipse.ui.IEditorInput aEditorInput) |
protected void |
firePropertyChange(int action)
This is here for the listener to be able to call it.
|
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor |
getActionBarContributor() |
org.eclipse.ui.IActionBars |
getActionBars() |
java.lang.Object |
getAdapter(java.lang.Class key)
This is how the framework determines which interfaces we implement.
|
org.eclipse.emf.common.notify.AdapterFactory |
getAdapterFactory() |
org.eclipse.ui.views.contentoutline.IContentOutlinePage |
getContentOutlinePage()
This accesses a cached version of the content outliner.
|
org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain()
This returns the editing domain as required by the
IEditingDomainProvider interface. |
org.eclipse.ui.views.properties.IPropertySheetPage |
getPropertySheetPage()
This accesses a cached version of the property sheet.
|
protected org.eclipse.emf.ecore.resource.Resource |
getResource()
Obtains the single resource that I edit. .CUSTOM: This editor edits only
one resource.
|
org.eclipse.jface.viewers.ISelection |
getSelection()
This implements
ISelectionProvider to
return this editor's overall selection. |
protected abstract java.lang.String |
getString(java.lang.String key)
This looks up a string in the plugin's plugin.properties file.
|
protected abstract java.lang.String |
getString(java.lang.String key,
java.lang.Object s1)
This looks up a string in plugin.properties, making a substitution.
|
org.eclipse.core.commands.operations.IUndoContext |
getUndoContext()
Obtains my undo context for populating the Undo and Redo menus from the
operation history. .CUSTOM: Operation-history-integrated editors have
undo contexts.
|
org.eclipse.jface.viewers.Viewer |
getViewer()
This returns the viewer as required by the
IViewerProvider
interface. |
void |
gotoMarker(org.eclipse.core.resources.IMarker marker) |
protected void |
handleActivate()
Handles activation of the editor or it's associated views. .CUSTOM: This
editor edits only a single resource and uses a WorkspaceSynchronizer to
detect external changes
|
protected void |
handleChangedResource()
Handles what to do with changed resource on activation. .CUSTOM: Replaces
EMF-generated handleChangedResources() method
|
void |
handleContentOutlineSelection(org.eclipse.jface.viewers.ISelection selection)
This deals with how we want selection in the outliner to affect the other
views.
|
protected boolean |
handleDirtyConflict()
Shows a dialog that asks if conflicting changes should be discarded.
|
protected void |
handleMovedResource()
Handles what to do with moved resource on activation. .CUSTOM:
EMF-generated editor does not handle moves
|
protected void |
handleResourcesChanged(org.eclipse.emf.common.command.Command command) |
protected void |
hideTabs()
If there is just one page in the multi-page editor part, this hides the
single tab at the bottom.
|
protected abstract void |
historyNotificationPropertyChange()
Notification method is called when properties have changed.
|
protected void |
hookDoubleClickAction()
Handle double click actions on the selection viewer.
|
void |
init(org.eclipse.ui.IEditorSite aSite,
org.eclipse.ui.IEditorInput aEditorInput) |
protected void |
initializeEditingDomain()
This sets up the editing domain for the model editor. .CUSTOM: Instead of
the command-stack listener, we create an operation-history listener.
|
boolean |
isDirty()
This is for implementing
IEditorPart and simply tests the command
stack. |
protected boolean |
isPersisted(org.eclipse.emf.ecore.resource.Resource resource)
This returns whether something has been persisted to the URI of the
specified resource.
|
boolean |
isSaveAsAllowed()
This always returns true because it is not currently supported.
|
abstract void |
log(java.lang.Object logEntry)
Log the entry
|
void |
menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)
This implements
IMenuListener to help
fill the context menus with contributions from the Edit menu |
void |
removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
This implements
ISelectionProvider . |
void |
setCurrentViewer(org.eclipse.jface.viewers.Viewer viewer)
This makes sure that one content viewer, either for the current page or
the outline view, if it has focus, is the current one.
|
void |
setCurrentViewerPane(org.eclipse.emf.common.ui.ViewerPane viewerPane) |
void |
setSelection(org.eclipse.jface.viewers.ISelection selection)
This implements
ISelectionProvider to
set this editor's overall selection. |
void |
setSelectionToViewer(java.util.Collection<?> collection)
This sets the selection into whichever viewer is active.
|
void |
setStatusLineManager(org.eclipse.jface.viewers.ISelection selection) |
protected boolean |
showOutlineView()
Returns whether the outline view should be presented to the user.
|
protected void |
showTabs()
If there is more than one page in the multi-page editor part, this shows
the tabs at the bottom.
|
protected void |
updateProblemIndication()
Updates the problems indication with the information described in the
specified diagnostic.
|
activateSite, addPage, addPage, addPage, addPage, addPageChangedListener, createPageContainer, createPartControl, createSite, deactivateSite, findEditors, getActiveEditor, getActivePage, getContainer, getControl, getEditor, getPageCount, getPageImage, getPageSite, getPageText, getSelectedPage, handlePropertyChange, initializePageSwitching, pageChange, removePage, removePageChangedListener, setActiveEditor, setActivePage, setControl, setFocus, setPageImage, setPageText
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
protected org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain editingDomain
protected org.eclipse.core.commands.operations.IUndoContext undoContext
protected org.eclipse.emf.ecore.resource.Resource resource
protected org.eclipse.emf.edit.provider.ComposedAdapterFactory adapterFactory
protected org.eclipse.ui.views.contentoutline.IContentOutlinePage contentOutlinePage
protected org.eclipse.jface.action.IStatusLineManager contentOutlineStatusLineManager
protected org.eclipse.jface.viewers.TreeViewer contentOutlineViewer
protected org.eclipse.ui.views.properties.PropertySheetPage propertySheetPage
protected org.eclipse.jface.viewers.TreeViewer selectionViewer
protected org.eclipse.emf.common.ui.ViewerPane currentViewerPane
protected org.eclipse.jface.viewers.Viewer currentViewer
protected org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListener
protected java.util.Collection<org.eclipse.jface.viewers.ISelectionChangedListener> selectionChangedListeners
ISelectionChangedListener
s that are
listening to this editor.protected org.eclipse.jface.viewers.ISelection editorSelection
protected org.eclipse.emf.common.ui.MarkerHelper markerHelper
protected org.eclipse.ui.IPartListener partListener
protected java.util.Collection<org.eclipse.emf.ecore.resource.Resource> removedResources
protected java.util.Collection<org.eclipse.emf.ecore.resource.Resource> changedResources
protected java.util.Map<org.eclipse.emf.ecore.resource.Resource,org.eclipse.emf.common.util.URI> movedResources
protected java.util.Collection<org.eclipse.emf.ecore.resource.Resource> savedResources
protected java.util.Map<org.eclipse.emf.ecore.resource.Resource,org.eclipse.emf.common.util.Diagnostic> resourceToDiagnosticMap
protected boolean updateProblemIndication
protected org.eclipse.emf.ecore.util.EContentAdapter problemIndicationAdapter
protected org.eclipse.emf.workspace.util.WorkspaceSynchronizer workspaceSynchronizer
public ModelMultiPageEditorPart()
protected abstract void historyNotificationPropertyChange()
protected void handleResourcesChanged(org.eclipse.emf.common.command.Command command)
protected void handleActivate()
protected void handleChangedResource()
public abstract void log(java.lang.Object logEntry)
logEntry
- protected void handleMovedResource()
protected void updateProblemIndication()
protected boolean handleDirtyConflict()
protected void initializeEditingDomain()
protected void firePropertyChange(int action)
firePropertyChange
in class org.eclipse.ui.part.WorkbenchPart
public void setSelectionToViewer(java.util.Collection<?> collection)
public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
IEditingDomainProvider
interface. This is important for
implementing the static methods of AdapterFactoryEditingDomain
and for supporting CommandAction
.getEditingDomain
in interface org.eclipse.emf.edit.domain.IEditingDomainProvider
public void setCurrentViewerPane(org.eclipse.emf.common.ui.ViewerPane viewerPane)
public void setCurrentViewer(org.eclipse.jface.viewers.Viewer viewer)
public org.eclipse.jface.viewers.Viewer getViewer()
IViewerProvider
interface.getViewer
in interface org.eclipse.emf.common.ui.viewer.IViewerProvider
protected void createContextMenuFor(org.eclipse.jface.viewers.StructuredViewer viewer)
public void createModel()
public org.eclipse.emf.common.util.Diagnostic analyzeResourceProblems(org.eclipse.emf.ecore.resource.Resource aResource, java.lang.Exception aException)
protected org.eclipse.emf.ecore.resource.Resource getResource()
public org.eclipse.core.commands.operations.IUndoContext getUndoContext()
public void createPages()
createPages
in class org.eclipse.ui.part.MultiPageEditorPart
protected void hookDoubleClickAction()
protected void hideTabs()
protected void showTabs()
public java.lang.Object getAdapter(java.lang.Class key)
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
getAdapter
in class org.eclipse.ui.part.MultiPageEditorPart
public org.eclipse.ui.views.contentoutline.IContentOutlinePage getContentOutlinePage()
public org.eclipse.ui.views.properties.IPropertySheetPage getPropertySheetPage()
public void handleContentOutlineSelection(org.eclipse.jface.viewers.ISelection selection)
public boolean isDirty()
IEditorPart
and simply tests the command
stack.isDirty
in interface org.eclipse.ui.ISaveablePart
isDirty
in class org.eclipse.ui.part.MultiPageEditorPart
public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
IEditorPart
and simply saves the model
file.doSave
in interface org.eclipse.ui.ISaveablePart
doSave
in class org.eclipse.ui.part.EditorPart
protected boolean isPersisted(org.eclipse.emf.ecore.resource.Resource resource)
public boolean isSaveAsAllowed()
isSaveAsAllowed
in interface org.eclipse.ui.ISaveablePart
isSaveAsAllowed
in class org.eclipse.ui.part.EditorPart
public void doSaveAs()
doSaveAs
in interface org.eclipse.ui.ISaveablePart
doSaveAs
in class org.eclipse.ui.part.EditorPart
protected void doSaveAs(org.eclipse.emf.common.util.URI aUri, org.eclipse.ui.IEditorInput aEditorInput)
public void gotoMarker(org.eclipse.core.resources.IMarker marker)
gotoMarker
in interface org.eclipse.ui.ide.IGotoMarker
public void init(org.eclipse.ui.IEditorSite aSite, org.eclipse.ui.IEditorInput aEditorInput)
init
in interface org.eclipse.ui.IEditorPart
init
in class org.eclipse.ui.part.MultiPageEditorPart
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
ISelectionProvider
.addSelectionChangedListener
in interface org.eclipse.jface.viewers.ISelectionProvider
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
ISelectionProvider
.removeSelectionChangedListener
in interface org.eclipse.jface.viewers.ISelectionProvider
public org.eclipse.jface.viewers.ISelection getSelection()
ISelectionProvider
to
return this editor's overall selection.getSelection
in interface org.eclipse.jface.viewers.ISelectionProvider
public void setSelection(org.eclipse.jface.viewers.ISelection selection)
ISelectionProvider
to
set this editor's overall selection. Calling this result will notify the
listeners.setSelection
in interface org.eclipse.jface.viewers.ISelectionProvider
public void setStatusLineManager(org.eclipse.jface.viewers.ISelection selection)
protected abstract java.lang.String getString(java.lang.String key)
protected abstract java.lang.String getString(java.lang.String key, java.lang.Object s1)
public void menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)
IMenuListener
to help
fill the context menus with contributions from the Edit menu. <menuAboutToShow
in interface org.eclipse.jface.action.IMenuListener
public org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor getActionBarContributor()
public org.eclipse.ui.IActionBars getActionBars()
public org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory()
public void dispose()
dispose
in interface org.eclipse.ui.IWorkbenchPart
dispose
in class org.eclipse.ui.part.MultiPageEditorPart
protected boolean showOutlineView()