org.eclipse.emf.mapping.presentation
Class MappingEditor

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by org.eclipse.ui.part.MultiPageEditorPart
                  extended by org.eclipse.emf.mapping.presentation.MappingEditor
All Implemented Interfaces:
IAdaptable, IExecutableExtension, IEditingDomainProvider, IMenuListener, ISelectionProvider, IEditorPart, ISaveablePart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation
Direct Known Subclasses:
Ecore2EcoreEditor

public abstract class MappingEditor
extends MultiPageEditorPart
implements IEditingDomainProvider, ISelectionProvider, IMenuListener

This is an example of a model editor.


Nested Class Summary
static class MappingEditor.ActionBarContributor
          This is the contributor for the mapping editor.
protected static class MappingEditor.DelayedColumnFitter
           
protected  class MappingEditor.MyDecoratorAdapterFactory
           
protected  class MappingEditor.MyViewerPane
           
protected  class MappingEditor.OverviewDecoratorAdapterFactory
           
static class MappingEditor.OverviewViewer
          Deprecated. 
 
Field Summary
protected  Image bottomImage
           
protected  java.lang.String bottomLabel
           
protected  CommandStackListener commandStackListener
           
protected  Action contentOutlineFilterAction
           
protected  IContentOutlinePage contentOutlinePage
          This is the content outline page.
protected  IStatusLineManager contentOutlineStatusLineManager
          This is a kludge...
protected  TreeViewer contentOutlineViewer
          This is the content outline page's viewer.
protected  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  ViewerPane currentViewerPane
          This keeps track of the current viewer pane of the page book.
protected static java.lang.String DIVIDER
           
protected  Viewer dropViewer
          This keeps track of the content viewer, which had something dropped on it.
protected  ISelection editorSelection
          This keeps track of the selection of the editor as a whole.
protected  boolean isNotificationEnabled
           
protected  MappingEditor.MyDecoratorAdapterFactory leftSelectionFactory
           
protected  SimpleMappedObjectViewer leftSelectionViewer
          This is the viewer that shadows the selection in the content outline.
protected  AdapterFactoryMappingDomain mappingDomain
          This keeps track of the editing domain that is used to track all changes to the model.
protected  MappingRoot mappingRoot
          This keeps track of the root object of the model.
protected  IFileEditorInput modelFile
          This keeps track of the file that stores the model.
protected  MappingEditor.OverviewDecoratorAdapterFactory overviewFactory
           
protected  java.lang.String overviewSummaryColumnLabel
           
protected  MappingEditor.OverviewViewer overviewViewer
           
protected  ViewerPane overviewViewerPane
           
protected  IPartListener partListener
          This listens for when the outline becomes active
protected  PropertySheetPage propertySheetPage
          This is the property sheet page.
protected  MappingEditor.MyDecoratorAdapterFactory rightSelectionFactory
           
protected  SimpleMappedObjectViewer rightSelectionViewer
           
protected static java.lang.String SELECTED_MAPPED_OBJECT_PREFIX
           
protected static java.lang.String SELECTED_MAPPING_PREFIX
           
protected  ISelectionChangedListener selectionChangedListener
          This listens to which ever viewer is active.
protected  java.util.Collection<ISelectionChangedListener> selectionChangedListeners
          This keeps track of all the ISelectionChangedListeners that are listening to this editor.
protected static java.lang.String SEPARATOR
           
protected  Image topImage
           
protected  java.lang.String topLabel
           
 
Fields inherited from class org.eclipse.ui.part.MultiPageEditorPart
PAGE_CONTAINER_SITE
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
MappingEditor()
          This creates a model editor.
 
Method Summary
 void addSelectionChangedListener(ISelectionChangedListener listener)
          This implements ISelectionProvider.
protected  void createContextMenuFor(StructuredViewer structuredViewer)
          This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 void createLaunchedOverviewSummaryColumnEditor(Composite parent, java.lang.Object object)
           
protected abstract  AdapterFactoryMappingDomain createMappingDomain()
           
protected  MappingEditor.OverviewDecoratorAdapterFactory createOverviewDecoratorAdapterFactory()
           
protected  MappingEditor.OverviewViewer createOverviewViewer(Composite composite)
           
 void createPages()
          This is the method used by the framework to install your own controls.
 void dispose()
           
 void doSave(IProgressMonitor progressMonitor)
          This is for implementing IEditorPart and simply saves the model file.
 void doSaveAs()
          This also changes the model.
protected  void doSaveHelper(IFile file)
           
protected  void firePropertyChange(int type)
          This simply calls super; it is here only so that inner classes can call it.
 EditingDomainActionBarContributor getActionBarContributor()
           
 IActionBars getActionBars()
           
 java.lang.Object getAdapter(java.lang.Class key)
          This is how the framework determines which interfaces we implement.
 Image getBottomImage()
           
 java.lang.String getBottomLabel()
           
 IContentOutlinePage getContentOutlinePage()
          This accesses a cached version of the content outliner.
 Viewer getCurrentViewer()
           
 boolean getDefaultCheckedShowTopFirst()
           
 boolean getDefaultFilterUnmappedObjects()
           
 boolean getDefaultShowMultipleColumns()
           
 EditingDomain getEditingDomain()
          This returns the editing domain as required by the IEditingDomainProvider interface.
 java.util.Collection<?> getMappedObjects(ISelection selection)
          This turns the selection into the set of RefObjects involved in the mapping.
 AdapterFactoryMappingDomain getMappingDomain()
           
 java.util.Collection<? extends Mapping> getMappings(ISelection selection)
          This turns the selection into the set of mappings, but only if all the objects are mappings.
 java.lang.Object getOverviewSummaryColumnImage(java.lang.Object o)
           
 java.lang.String getOverviewSummaryColumnLabel()
           
 java.lang.String getOverviewSummaryColumnText(java.lang.Object o)
           
 IPropertySheetPage getPropertySheetPage()
          This accesses a cached version of the property sheet.
 ISelection getSelection()
          This implements ISelectionProvider to return this editor's overall selection.
 Image getTopImage()
           
 java.lang.String getTopLabel()
           
 java.lang.String getURIFromFile(IFile file)
           
 void gotoMarker(IMarker marker)
           
protected  void handleCreation()
          This creates the model based on the modelFile.
protected  void handleCreationException(java.lang.Exception exception)
           
protected abstract  void handleMissingModelFile()
           
 boolean hasLaunchedOverviewSummaryColumnEditor(java.lang.Object object)
           
protected  void hideTabs()
          If there is just one page in the multi-page editor part, this hides the single tab at the bottom
 void init(IEditorSite site, IEditorInput editorInput)
           
 boolean isDirty()
          This is for implementing IEditorPart and simply tests the command stack.
 boolean isNotificationEnabled()
           
 boolean isSaveAsAllowed()
          This always returns false because it is not currently supported.
 void menuAboutToShow(IMenuManager menuManager)
          This implements IMenuListener to help fill the context menu.
 void removeSelectionChangedListener(ISelectionChangedListener listener)
          This implements ISelectionProvider.
 void setCurrentViewer(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(ViewerPane viewerPane)
           
 void setFocus()
           
protected  void setMappingRoot(MappingRoot mappingRoot)
           
 void setNotificationEnabled(boolean isNotificationEnabled)
           
 void setSelection(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(ISelection selection)
           
 
Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
activateSite, addPage, addPage, addPage, addPage, createPageContainer, createPartControl, createSite, deactivateSite, findEditors, getActiveEditor, getActivePage, getContainer, getControl, getEditor, getPageCount, getPageImage, getPageSite, getPageText, handlePropertyChange, initializePageSwitching, pageChange, removePage, setActiveEditor, setActivePage, setControl, setPageImage, setPageText
 
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
 
Methods 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, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener
 

Field Detail

DIVIDER

protected static final java.lang.String DIVIDER

SEPARATOR

protected static final java.lang.String SEPARATOR

topLabel

protected java.lang.String topLabel

bottomLabel

protected java.lang.String bottomLabel

topImage

protected Image topImage

bottomImage

protected Image bottomImage

isNotificationEnabled

protected boolean isNotificationEnabled

modelFile

protected IFileEditorInput modelFile
This keeps track of the file that stores the model.


mappingRoot

protected MappingRoot mappingRoot
This keeps track of the root object of the model.


mappingDomain

protected AdapterFactoryMappingDomain mappingDomain
This keeps track of the editing domain that is used to track all changes to the model.


contentOutlinePage

protected IContentOutlinePage contentOutlinePage
This is the content outline page.


contentOutlineStatusLineManager

protected IStatusLineManager contentOutlineStatusLineManager
This is a kludge...


contentOutlineViewer

protected TreeViewer contentOutlineViewer
This is the content outline page's viewer.


contentOutlineFilterAction

protected Action contentOutlineFilterAction

propertySheetPage

protected PropertySheetPage propertySheetPage
This is the property sheet page.


leftSelectionViewer

protected SimpleMappedObjectViewer leftSelectionViewer
This is the viewer that shadows the selection in the content outline. The parent relation must be correctly defined for this to work.


leftSelectionFactory

protected MappingEditor.MyDecoratorAdapterFactory leftSelectionFactory

rightSelectionViewer

protected SimpleMappedObjectViewer rightSelectionViewer

rightSelectionFactory

protected MappingEditor.MyDecoratorAdapterFactory rightSelectionFactory

overviewViewerPane

protected ViewerPane overviewViewerPane

overviewViewer

protected MappingEditor.OverviewViewer overviewViewer

overviewFactory

protected MappingEditor.OverviewDecoratorAdapterFactory overviewFactory

currentViewerPane

protected ViewerPane currentViewerPane
This keeps track of the current viewer pane of the page book.


currentViewer

protected 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.


dropViewer

protected Viewer dropViewer
This keeps track of the content viewer, which had something dropped on it.


selectionChangedListener

protected ISelectionChangedListener selectionChangedListener
This listens to which ever viewer is active.


selectionChangedListeners

protected java.util.Collection<ISelectionChangedListener> selectionChangedListeners
This keeps track of all the ISelectionChangedListeners that are listening to this editor.


editorSelection

protected ISelection editorSelection
This keeps track of the selection of the editor as a whole.


partListener

protected IPartListener partListener
This listens for when the outline becomes active


commandStackListener

protected CommandStackListener commandStackListener

SELECTED_MAPPING_PREFIX

protected static final java.lang.String SELECTED_MAPPING_PREFIX

SELECTED_MAPPED_OBJECT_PREFIX

protected static final java.lang.String SELECTED_MAPPED_OBJECT_PREFIX

overviewSummaryColumnLabel

protected java.lang.String overviewSummaryColumnLabel
Constructor Detail

MappingEditor

public MappingEditor()
This creates a model editor.

Method Detail

getTopLabel

public java.lang.String getTopLabel()

getBottomLabel

public java.lang.String getBottomLabel()

getTopImage

public Image getTopImage()

getBottomImage

public Image getBottomImage()

isNotificationEnabled

public boolean isNotificationEnabled()

setNotificationEnabled

public void setNotificationEnabled(boolean isNotificationEnabled)

firePropertyChange

protected void firePropertyChange(int type)
This simply calls super; it is here only so that inner classes can call it.

Overrides:
firePropertyChange in class WorkbenchPart

createMappingDomain

protected abstract AdapterFactoryMappingDomain createMappingDomain()

setSelectionToViewer

public void setSelectionToViewer(java.util.Collection<?> collection)
This sets the selection into whichever viewer is active.


getEditingDomain

public EditingDomain getEditingDomain()
This returns the editing domain as required by the IEditingDomainProvider interface. This is important for implementing the static methods of AdapterFactoryEditingDomain and for supporting CommandAction.

Specified by:
getEditingDomain in interface IEditingDomainProvider

setCurrentViewerPane

public void setCurrentViewerPane(ViewerPane viewerPane)

setCurrentViewer

public void setCurrentViewer(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.


createContextMenuFor

protected void createContextMenuFor(StructuredViewer structuredViewer)
This creates a context menu for the viewer and adds a listener as well registering the menu for extension.


createPages

public void createPages()
This is the method used by the framework to install your own controls.

Specified by:
createPages in class 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.


getURIFromFile

public java.lang.String getURIFromFile(IFile file)

handleCreation

protected void handleCreation()
This creates the model based on the modelFile.


handleMissingModelFile

protected abstract void handleMissingModelFile()

handleCreationException

protected void handleCreationException(java.lang.Exception exception)

setMappingRoot

protected void setMappingRoot(MappingRoot mappingRoot)

getAdapter

public java.lang.Object getAdapter(java.lang.Class key)
This is how the framework determines which interfaces we implement.

Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class MultiPageEditorPart

getContentOutlinePage

public IContentOutlinePage getContentOutlinePage()
This accesses a cached version of the content outliner.


getPropertySheetPage

public IPropertySheetPage getPropertySheetPage()
This accesses a cached version of the property sheet.


isDirty

public boolean isDirty()
This is for implementing IEditorPart and simply tests the command stack.

Specified by:
isDirty in interface ISaveablePart
Overrides:
isDirty in class MultiPageEditorPart

doSave

public void doSave(IProgressMonitor progressMonitor)
This is for implementing IEditorPart and simply saves the model file.

Specified by:
doSave in interface ISaveablePart
Specified by:
doSave in class EditorPart

doSaveHelper

protected void doSaveHelper(IFile file)

isSaveAsAllowed

public boolean isSaveAsAllowed()
This always returns false because it is not currently supported.

Specified by:
isSaveAsAllowed in interface ISaveablePart
Specified by:
isSaveAsAllowed in class EditorPart

doSaveAs

public void doSaveAs()
This also changes the model.

Specified by:
doSaveAs in interface ISaveablePart
Specified by:
doSaveAs in class EditorPart

gotoMarker

public void gotoMarker(IMarker marker)

init

public void init(IEditorSite site,
                 IEditorInput editorInput)
          throws PartInitException
Specified by:
init in interface IEditorPart
Overrides:
init in class MultiPageEditorPart
Throws:
PartInitException

setFocus

public void setFocus()
Specified by:
setFocus in interface IWorkbenchPart
Overrides:
setFocus in class MultiPageEditorPart

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)
This implements ISelectionProvider.

Specified by:
addSelectionChangedListener in interface ISelectionProvider

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)
This implements ISelectionProvider.

Specified by:
removeSelectionChangedListener in interface ISelectionProvider

getSelection

public ISelection getSelection()
This implements ISelectionProvider to return this editor's overall selection.

Specified by:
getSelection in interface ISelectionProvider

setSelection

public void setSelection(ISelection selection)
This implements ISelectionProvider to set this editor's overall selection. Calling this result will notify the listeners.

Specified by:
setSelection in interface ISelectionProvider

setStatusLineManager

public void setStatusLineManager(ISelection selection)

menuAboutToShow

public void menuAboutToShow(IMenuManager menuManager)
This implements IMenuListener to help fill the context menu.

Specified by:
menuAboutToShow in interface IMenuListener

getMappedObjects

public java.util.Collection<?> getMappedObjects(ISelection selection)
This turns the selection into the set of RefObjects involved in the mapping.


getMappings

public java.util.Collection<? extends Mapping> getMappings(ISelection selection)
This turns the selection into the set of mappings, but only if all the objects are mappings.


getMappingDomain

public AdapterFactoryMappingDomain getMappingDomain()

getCurrentViewer

public Viewer getCurrentViewer()

dispose

public void dispose()
Specified by:
dispose in interface IWorkbenchPart
Overrides:
dispose in class MultiPageEditorPart

getActionBarContributor

public EditingDomainActionBarContributor getActionBarContributor()

getActionBars

public IActionBars getActionBars()

getOverviewSummaryColumnLabel

public java.lang.String getOverviewSummaryColumnLabel()

getOverviewSummaryColumnImage

public java.lang.Object getOverviewSummaryColumnImage(java.lang.Object o)

getOverviewSummaryColumnText

public java.lang.String getOverviewSummaryColumnText(java.lang.Object o)

hasLaunchedOverviewSummaryColumnEditor

public boolean hasLaunchedOverviewSummaryColumnEditor(java.lang.Object object)

createLaunchedOverviewSummaryColumnEditor

public void createLaunchedOverviewSummaryColumnEditor(Composite parent,
                                                      java.lang.Object object)

getDefaultCheckedShowTopFirst

public boolean getDefaultCheckedShowTopFirst()

getDefaultShowMultipleColumns

public boolean getDefaultShowMultipleColumns()

getDefaultFilterUnmappedObjects

public boolean getDefaultFilterUnmappedObjects()

createOverviewViewer

protected MappingEditor.OverviewViewer createOverviewViewer(Composite composite)

createOverviewDecoratorAdapterFactory

protected MappingEditor.OverviewDecoratorAdapterFactory createOverviewDecoratorAdapterFactory()

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.