Class TraceEditor
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
org.eclipse.ui.part.MultiPageEditorPart
org.eclipse.m2m.atl.emftvm.trace.presentation.TraceEditor
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,org.eclipse.core.runtime.IExecutableExtension,org.eclipse.emf.common.ui.viewer.IViewerProvider,org.eclipse.emf.edit.domain.IEditingDomainProvider,org.eclipse.jface.action.IMenuListener,org.eclipse.jface.dialogs.IPageChangeProvider,org.eclipse.jface.viewers.ISelectionProvider,org.eclipse.ui.ide.IGotoMarker,org.eclipse.ui.IEditorPart,org.eclipse.ui.ISaveablePart,org.eclipse.ui.IWorkbenchPart,org.eclipse.ui.IWorkbenchPart2,org.eclipse.ui.IWorkbenchPart3,org.eclipse.ui.part.IWorkbenchPartOrientation
public class TraceEditor
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
This is an example of a Trace model editor.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.emf.edit.provider.ComposedAdapterFactoryThis is the one adapter factory used for providing views of the model.protected Collection<org.eclipse.emf.ecore.resource.Resource> Resources that have been changed since last activation.protected org.eclipse.ui.views.contentoutline.IContentOutlinePageThis is the content outline page.protected org.eclipse.jface.action.IStatusLineManagerThis is a kludge...protected org.eclipse.jface.viewers.TreeViewerThis is the content outline page's viewer.protected org.eclipse.jface.viewers.ViewerThis 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.ViewerPaneThis keeps track of the active viewer pane, in the book.protected org.eclipse.emf.edit.domain.AdapterFactoryEditingDomainThis keeps track of the editing domain that is used to track all changes to the model.protected org.eclipse.jface.viewers.ISelectionThis keeps track of the selection of the editor as a whole.protected org.eclipse.jface.viewers.ListViewerThis shows how a list view works.protected org.eclipse.emf.common.ui.MarkerHelperThe MarkerHelper is responsible for creating workspace resource markers presented in Eclipse's Problems View.protected org.eclipse.jface.viewers.TreeViewerThis inverts the roll of parent and child in the content provider and show parents as a tree.protected org.eclipse.ui.IPartListenerThis listens for when the outline becomes activeprotected org.eclipse.emf.ecore.util.EContentAdapterAdapter used to update the problem indication when resources are demanded loaded.protected List<org.eclipse.ui.views.properties.PropertySheetPage> This is the property sheet page.protected Collection<org.eclipse.emf.ecore.resource.Resource> Resources that have been removed since last activation.protected org.eclipse.core.resources.IResourceChangeListenerThis listens for workspace changes.protected Map<org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.common.util.Diagnostic> Map to store the diagnostic associated with a resource.protected Collection<org.eclipse.emf.ecore.resource.Resource> Resources that have been saved.protected org.eclipse.jface.viewers.ISelectionChangedListenerThis listens to which ever viewer is active.protected Collection<org.eclipse.jface.viewers.ISelectionChangedListener> This keeps track of all theISelectionChangedListeners that are listening to this editor.protected org.eclipse.jface.viewers.TreeViewerThis is the viewer that shadows the selection in the content outline.protected org.eclipse.jface.viewers.TableViewerThis shows how a table view works.protected org.eclipse.jface.viewers.TreeViewerThis shows how a tree view works.protected org.eclipse.jface.viewers.TreeViewerThis shows how a tree view with columns works.protected booleanControls whether the problem indication should be updated.Fields inherited from class org.eclipse.ui.part.MultiPageEditorPart
PAGE_CONTAINER_SITEFields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUTFields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) This implementsISelectionProvider.org.eclipse.emf.common.util.DiagnosticanalyzeResourceProblems(org.eclipse.emf.ecore.resource.Resource resource, Exception exception) Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if any).protected voidcreateContextMenuFor(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.voidThis is the method called to load a resource into the editing domain's resource set based on the editor's input.voidThis is the method used by the framework to install your own controls.voiddispose()voiddoSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) This is for implementingIEditorPartand simply saves the model file.voiddoSaveAs()This also changes the editor's input.protected voiddoSaveAs(org.eclipse.emf.common.util.URI uri, org.eclipse.ui.IEditorInput editorInput) protected voidfirePropertyChange(int action) This is here for the listener to be able to call it.org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributororg.eclipse.ui.IActionBarsgetAdapter(Class key) This is how the framework determines which interfaces we implement.org.eclipse.emf.common.notify.AdapterFactoryorg.eclipse.ui.views.contentoutline.IContentOutlinePageThis accesses a cached version of the content outliner.org.eclipse.emf.edit.domain.EditingDomainThis returns the editing domain as required by theIEditingDomainProviderinterface.org.eclipse.ui.views.properties.IPropertySheetPageThis accesses a cached version of the property sheet.org.eclipse.jface.viewers.ISelectionThis implementsISelectionProviderto return this editor's overall selection.org.eclipse.jface.viewers.ViewerThis returns the viewer as required by theIViewerProviderinterface.voidgotoMarker(org.eclipse.core.resources.IMarker marker) protected voidHandles activation of the editor or it's associated views.protected voidHandles what to do with changed resources on activation.voidhandleContentOutlineSelection(org.eclipse.jface.viewers.ISelection selection) This deals with how we want selection in the outliner to affect the other views.protected booleanShows a dialog that asks if conflicting changes should be discarded.protected voidhideTabs()If there is just one page in the multi-page editor part, this hides the single tab at the bottom.voidinit(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput editorInput) This is called during startup.protected voidThis sets up the editing domain for the model editor.booleanisDirty()This is for implementingIEditorPartand simply tests the command stack.protected booleanisPersisted(org.eclipse.emf.ecore.resource.Resource resource) This returns whether something has been persisted to the URI of the specified resource.booleanThis always returns true because it is not currently supported.voidmenuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager) This implementsIMenuListenerto help fill the context menus with contributions from the Edit menu.protected voidpageChange(int pageIndex) This is used to track the active viewer.voidremoveSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) This implementsISelectionProvider.voidsetCurrentViewer(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.voidsetCurrentViewerPane(org.eclipse.emf.common.ui.ViewerPane viewerPane) voidsetFocus()voidsetSelection(org.eclipse.jface.viewers.ISelection selection) This implementsISelectionProviderto set this editor's overall selection.voidsetSelectionToViewer(Collection<?> collection) This sets the selection into whichever viewer is active.voidsetStatusLineManager(org.eclipse.jface.viewers.ISelection selection) protected booleanReturns whether the outline view should be presented to the user.protected voidshowTabs()If there is more than one page in the multi-page editor part, this shows the tabs at the bottom.protected voidUpdates the problems indication with the information described in the specified diagnostic.Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
activateSite, addPage, addPage, addPage, addPage, addPageChangedListener, createContainer, createItem, createPageContainer, createPartControl, createSite, deactivateSite, findEditors, getActiveEditor, getActivePage, getAPIPreferenceStore, getContainer, getControl, getEditor, getPageCount, getPageImage, getPageSite, getPageText, getSelectedPage, getTabStyle, handlePropertyChange, initializePageSwitching, isUpdateRequired, removePage, removePageChangedListener, setActiveEditor, setActivePage, setControl, setPageImage, setPageText, updateContainerMethods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartNameMethods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusyMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener
-
Field Details
-
editingDomain
protected org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain editingDomainThis keeps track of the editing domain that is used to track all changes to the model. -
adapterFactory
protected org.eclipse.emf.edit.provider.ComposedAdapterFactory adapterFactoryThis is the one adapter factory used for providing views of the model. -
contentOutlinePage
protected org.eclipse.ui.views.contentoutline.IContentOutlinePage contentOutlinePageThis is the content outline page. -
contentOutlineStatusLineManager
protected org.eclipse.jface.action.IStatusLineManager contentOutlineStatusLineManagerThis is a kludge... -
contentOutlineViewer
protected org.eclipse.jface.viewers.TreeViewer contentOutlineViewerThis is the content outline page's viewer. -
propertySheetPages
This is the property sheet page. -
selectionViewer
protected org.eclipse.jface.viewers.TreeViewer selectionViewerThis is the viewer that shadows the selection in the content outline. The parent relation must be correctly defined for this to work. -
parentViewer
protected org.eclipse.jface.viewers.TreeViewer parentViewerThis inverts the roll of parent and child in the content provider and show parents as a tree. -
treeViewer
protected org.eclipse.jface.viewers.TreeViewer treeViewerThis shows how a tree view works. -
listViewer
protected org.eclipse.jface.viewers.ListViewer listViewerThis shows how a list view works. A list viewer doesn't support icons. -
tableViewer
protected org.eclipse.jface.viewers.TableViewer tableViewerThis shows how a table view works. A table can be used as a list with icons. -
treeViewerWithColumns
protected org.eclipse.jface.viewers.TreeViewer treeViewerWithColumnsThis shows how a tree view with columns works. -
currentViewerPane
protected org.eclipse.emf.common.ui.ViewerPane currentViewerPaneThis keeps track of the active viewer pane, in the book. -
currentViewer
protected org.eclipse.jface.viewers.Viewer currentViewerThis keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. -
selectionChangedListener
protected org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListenerThis listens to which ever viewer is active. -
selectionChangedListeners
This keeps track of all theISelectionChangedListeners that are listening to this editor. -
editorSelection
protected org.eclipse.jface.viewers.ISelection editorSelectionThis keeps track of the selection of the editor as a whole. -
markerHelper
protected org.eclipse.emf.common.ui.MarkerHelper markerHelperThe MarkerHelper is responsible for creating workspace resource markers presented in Eclipse's Problems View. -
partListener
protected org.eclipse.ui.IPartListener partListenerThis listens for when the outline becomes active -
removedResources
Resources that have been removed since last activation. -
changedResources
Resources that have been changed since last activation. -
savedResources
Resources that have been saved. -
resourceToDiagnosticMap
protected Map<org.eclipse.emf.ecore.resource.Resource,org.eclipse.emf.common.util.Diagnostic> resourceToDiagnosticMapMap to store the diagnostic associated with a resource. -
updateProblemIndication
protected boolean updateProblemIndicationControls whether the problem indication should be updated. -
problemIndicationAdapter
protected org.eclipse.emf.ecore.util.EContentAdapter problemIndicationAdapterAdapter used to update the problem indication when resources are demanded loaded. -
resourceChangeListener
protected org.eclipse.core.resources.IResourceChangeListener resourceChangeListenerThis listens for workspace changes.
-
-
Constructor Details
-
TraceEditor
public TraceEditor()This creates a model editor.
-
-
Method Details
-
handleActivate
protected void handleActivate()Handles activation of the editor or it's associated views. -
handleChangedResources
protected void handleChangedResources()Handles what to do with changed resources on activation. -
updateProblemIndication
protected void updateProblemIndication()Updates the problems indication with the information described in the specified diagnostic. -
handleDirtyConflict
protected boolean handleDirtyConflict()Shows a dialog that asks if conflicting changes should be discarded. -
initializeEditingDomain
protected void initializeEditingDomain()This sets up the editing domain for the model editor. -
firePropertyChange
protected void firePropertyChange(int action) This is here for the listener to be able to call it.- Overrides:
firePropertyChangein classorg.eclipse.ui.part.WorkbenchPart
-
setSelectionToViewer
This sets the selection into whichever viewer is active. -
getEditingDomain
public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()This returns the editing domain as required by theIEditingDomainProviderinterface. This is important for implementing the static methods ofAdapterFactoryEditingDomainand for supportingCommandAction.- Specified by:
getEditingDomainin interfaceorg.eclipse.emf.edit.domain.IEditingDomainProvider
-
setCurrentViewerPane
public void setCurrentViewerPane(org.eclipse.emf.common.ui.ViewerPane viewerPane) -
setCurrentViewer
public 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. -
getViewer
public org.eclipse.jface.viewers.Viewer getViewer()This returns the viewer as required by theIViewerProviderinterface.- Specified by:
getViewerin interfaceorg.eclipse.emf.common.ui.viewer.IViewerProvider
-
createContextMenuFor
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. -
createModel
public void createModel()This is the method called to load a resource into the editing domain's resource set based on the editor's input. -
analyzeResourceProblems
public org.eclipse.emf.common.util.Diagnostic analyzeResourceProblems(org.eclipse.emf.ecore.resource.Resource resource, Exception exception) Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if any). -
createPages
public void createPages()This is the method used by the framework to install your own controls.- Specified by:
createPagesin classorg.eclipse.ui.part.MultiPageEditorPart
-
hideTabs
protected void hideTabs()If there is just one page in the multi-page editor part, this hides the single tab at the bottom. -
showTabs
protected void showTabs()If there is more than one page in the multi-page editor part, this shows the tabs at the bottom. -
pageChange
protected void pageChange(int pageIndex) This is used to track the active viewer.- Overrides:
pageChangein classorg.eclipse.ui.part.MultiPageEditorPart
-
getAdapter
This is how the framework determines which interfaces we implement.- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Overrides:
getAdapterin classorg.eclipse.ui.part.MultiPageEditorPart
-
getContentOutlinePage
public org.eclipse.ui.views.contentoutline.IContentOutlinePage getContentOutlinePage()This accesses a cached version of the content outliner. -
getPropertySheetPage
public org.eclipse.ui.views.properties.IPropertySheetPage getPropertySheetPage()This accesses a cached version of the property sheet. -
handleContentOutlineSelection
public void handleContentOutlineSelection(org.eclipse.jface.viewers.ISelection selection) This deals with how we want selection in the outliner to affect the other views. -
isDirty
public boolean isDirty()This is for implementingIEditorPartand simply tests the command stack.- Specified by:
isDirtyin interfaceorg.eclipse.ui.ISaveablePart- Overrides:
isDirtyin classorg.eclipse.ui.part.MultiPageEditorPart
-
doSave
public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) This is for implementingIEditorPartand simply saves the model file.- Specified by:
doSavein interfaceorg.eclipse.ui.ISaveablePart- Specified by:
doSavein classorg.eclipse.ui.part.EditorPart
-
isPersisted
protected boolean isPersisted(org.eclipse.emf.ecore.resource.Resource resource) This returns whether something has been persisted to the URI of the specified resource. The implementation uses the URI converter from the editor's resource set to try to open an input stream. -
isSaveAsAllowed
public boolean isSaveAsAllowed()This always returns true because it is not currently supported.- Specified by:
isSaveAsAllowedin interfaceorg.eclipse.ui.ISaveablePart- Specified by:
isSaveAsAllowedin classorg.eclipse.ui.part.EditorPart
-
doSaveAs
public void doSaveAs()This also changes the editor's input.- Specified by:
doSaveAsin interfaceorg.eclipse.ui.ISaveablePart- Specified by:
doSaveAsin classorg.eclipse.ui.part.EditorPart
-
doSaveAs
protected void doSaveAs(org.eclipse.emf.common.util.URI uri, org.eclipse.ui.IEditorInput editorInput) -
gotoMarker
public void gotoMarker(org.eclipse.core.resources.IMarker marker) - Specified by:
gotoMarkerin interfaceorg.eclipse.ui.ide.IGotoMarker
-
init
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput editorInput) This is called during startup.- Specified by:
initin interfaceorg.eclipse.ui.IEditorPart- Overrides:
initin classorg.eclipse.ui.part.MultiPageEditorPart
-
setFocus
public void setFocus()- Specified by:
setFocusin interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
setFocusin classorg.eclipse.ui.part.MultiPageEditorPart
-
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) This implementsISelectionProvider.- Specified by:
addSelectionChangedListenerin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
removeSelectionChangedListener
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) This implementsISelectionProvider.- Specified by:
removeSelectionChangedListenerin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()This implementsISelectionProviderto return this editor's overall selection.- Specified by:
getSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection selection) This implementsISelectionProviderto set this editor's overall selection. Calling this result will notify the listeners.- Specified by:
setSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
setStatusLineManager
public void setStatusLineManager(org.eclipse.jface.viewers.ISelection selection) -
getActionBarContributor
public org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor getActionBarContributor() -
getActionBars
public org.eclipse.ui.IActionBars getActionBars() -
getAdapterFactory
public org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory() -
dispose
public void dispose()- Specified by:
disposein interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
disposein classorg.eclipse.ui.part.MultiPageEditorPart
-
showOutlineView
protected boolean showOutlineView()Returns whether the outline view should be presented to the user.
-