org.eclipse.emf.mapping.presentation
Class MappingEditor

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended byorg.eclipse.ui.part.MultiPageEditorPart
              extended byorg.eclipse.emf.mapping.presentation.MappingEditor
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IEditingDomainProvider, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.jface.action.IMenuListener, org.eclipse.ui.ISaveablePart, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2
Direct Known Subclasses:
Ecore2EcoreEditor

public abstract class MappingEditor
extends org.eclipse.ui.part.MultiPageEditorPart
implements IEditingDomainProvider, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.jface.action.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  class MappingEditor.MyDecoratorAdapterFactory
           
protected  class MappingEditor.OverviewDecoratorAdapterFactory
           
static class MappingEditor.OverviewViewer
           
 
Field Summary
protected  org.eclipse.swt.graphics.Image bottomImage
           
protected  String bottomLabel
           
protected  org.eclipse.jface.action.Action contentOutlineFilterAction
           
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  ViewerPane currentViewerPane
          This keeps track of the current viewer pane of the page book.
protected static String DIVIDER
           
protected  org.eclipse.jface.viewers.Viewer dropViewer
          This keeps track of the content viewer, which had something dropped on it.
protected  org.eclipse.jface.viewers.ISelection editorSelection
          This keeps track of the selection of the editor as a whole.
protected  boolean isNotificationEnabled
           
protected  MappingEditor.MyDecoratorAdapterFactory leftSelectionFactory
           
protected  org.eclipse.emf.mapping.presentation.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  org.eclipse.ui.IFileEditorInput modelFile
          This keeps track of the file that stores the model.
protected  MappingEditor.OverviewDecoratorAdapterFactory overviewFactory
           
protected  String overviewSummaryColumnLabel
           
protected  MappingEditor.OverviewViewer overviewViewer
           
protected  ViewerPane overviewViewerPane
           
protected  org.eclipse.ui.IPartListener partListener
          This listens for when the outline becomes active
protected  org.eclipse.ui.views.properties.PropertySheetPage propertySheetPage
          This is the property sheet page.
protected  MappingEditor.MyDecoratorAdapterFactory rightSelectionFactory
           
protected  org.eclipse.emf.mapping.presentation.SimpleMappedObjectViewer rightSelectionViewer
           
protected static String SELECTED_MAPPED_OBJECT_PREFIX
           
protected static String SELECTED_MAPPING_PREFIX
           
protected  org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListener
          This listens to which ever viewer is active.
protected  Collection selectionChangedListeners
          This keeps track of all the ISelectionChangedListeners that are listening to this editor.
protected static String SEPARATOR
           
protected  org.eclipse.swt.graphics.Image topImage
           
protected  String topLabel
           
 
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(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          This implements ISelectionProvider.
protected  void createContextMenuFor(org.eclipse.jface.viewers.StructuredViewer structuredViewer)
          This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 void createLaunchedOverviewSummaryColumnEditor(org.eclipse.swt.widgets.Composite parent, Object object)
           
protected abstract  AdapterFactoryMappingDomain createMappingDomain()
           
protected  MappingEditor.OverviewDecoratorAdapterFactory createOverviewDecoratorAdapterFactory()
           
protected  MappingEditor.OverviewViewer createOverviewViewer(org.eclipse.swt.widgets.Composite composite)
           
 void createPages()
          This is the method used by the framework to install your own controls.
 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 model.
protected  void doSaveHelper(org.eclipse.core.resources.IFile file)
           
protected  void firePropertyChange(int type)
          This simply calls super; it is here only so that inner classes can call it.
 EditingDomainActionBarContributor getActionBarContributor()
           
 org.eclipse.ui.IActionBars getActionBars()
           
 Object getAdapter(Class key)
          This is how the framework determines which interfaces we implement.
 org.eclipse.swt.graphics.Image getBottomImage()
           
 String getBottomLabel()
           
 org.eclipse.ui.views.contentoutline.IContentOutlinePage getContentOutlinePage()
          This accesses a cached version of the content outliner.
 org.eclipse.jface.viewers.Viewer getCurrentViewer()
           
 boolean getDefaultCheckedShowTopFirst()
           
 boolean getDefaultFilterUnmappedObjects()
           
 boolean getDefaultShowMultipleColumns()
           
 EditingDomain getEditingDomain()
          This returns the editing domain as required by the IEditingDomainProvider interface.
 Collection getMappedObjects(org.eclipse.jface.viewers.ISelection selection)
          This turns the selection into the set of RefObjects involved in the mapping.
 AdapterFactoryMappingDomain getMappingDomain()
           
 Collection getMappings(org.eclipse.jface.viewers.ISelection selection)
          This turns the selection into the set of mappings, but only if all the objects are mappings.
 Object getOverviewSummaryColumnImage(Object o)
           
 String getOverviewSummaryColumnLabel()
           
 String getOverviewSummaryColumnText(Object o)
           
 org.eclipse.ui.views.properties.IPropertySheetPage getPropertySheetPage()
          This accesses a cached version of the property sheet.
 org.eclipse.jface.viewers.ISelection getSelection()
          This implements ISelectionProvider to return this editor's overall selection.
 org.eclipse.swt.graphics.Image getTopImage()
           
 String getTopLabel()
           
 String getURIFromFile(org.eclipse.core.resources.IFile file)
           
 void gotoMarker(org.eclipse.core.resources.IMarker marker)
           
protected  void handleCreation()
          This creates the model based on the modelFile.
protected  void handleCreationException(Exception exception)
           
protected abstract  void handleMissingModelFile()
           
 boolean hasLaunchedOverviewSummaryColumnEditor(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(org.eclipse.ui.IEditorSite site, org.eclipse.ui.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(org.eclipse.jface.action.IMenuManager menuManager)
          This implements IMenuListener to help fill the context 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(ViewerPane viewerPane)
           
 void setFocus()
           
protected  void setMappingRoot(MappingRoot mappingRoot)
           
 void setNotificationEnabled(boolean isNotificationEnabled)
           
 void setSelection(org.eclipse.jface.viewers.ISelection selection)
          This implements ISelectionProvider to set this editor's overall selection.
 void setSelectionToViewer(Collection collection)
          This sets the selection into whichever viewer is active.
 void setStatusLineManager(org.eclipse.jface.viewers.ISelection selection)
           
 
Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
addPage, addPage, createPartControl, createSite, getActiveEditor, getActivePage, getContainer, getControl, getEditor, getPageCount, getPageImage, getPageText, handlePropertyChange, pageChange, removePage, setActivePage, setControl, setPageImage, setPageText
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
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 String DIVIDER

SEPARATOR

protected static final String SEPARATOR

topLabel

protected String topLabel

bottomLabel

protected String bottomLabel

topImage

protected org.eclipse.swt.graphics.Image topImage

bottomImage

protected org.eclipse.swt.graphics.Image bottomImage

isNotificationEnabled

protected boolean isNotificationEnabled

modelFile

protected org.eclipse.ui.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 org.eclipse.ui.views.contentoutline.IContentOutlinePage contentOutlinePage
This is the content outline page.


contentOutlineStatusLineManager

protected org.eclipse.jface.action.IStatusLineManager contentOutlineStatusLineManager
This is a kludge...


contentOutlineViewer

protected org.eclipse.jface.viewers.TreeViewer contentOutlineViewer
This is the content outline page's viewer.


contentOutlineFilterAction

protected org.eclipse.jface.action.Action contentOutlineFilterAction

propertySheetPage

protected org.eclipse.ui.views.properties.PropertySheetPage propertySheetPage
This is the property sheet page.


leftSelectionViewer

protected org.eclipse.emf.mapping.presentation.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 org.eclipse.emf.mapping.presentation.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 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.


dropViewer

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


selectionChangedListener

protected org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListener
This listens to which ever viewer is active.


selectionChangedListeners

protected Collection selectionChangedListeners
This keeps track of all the ISelectionChangedListeners that are listening to this editor.


editorSelection

protected org.eclipse.jface.viewers.ISelection editorSelection
This keeps track of the selection of the editor as a whole.


partListener

protected org.eclipse.ui.IPartListener partListener
This listens for when the outline becomes active


SELECTED_MAPPING_PREFIX

protected static final String SELECTED_MAPPING_PREFIX

SELECTED_MAPPED_OBJECT_PREFIX

protected static final String SELECTED_MAPPED_OBJECT_PREFIX

overviewSummaryColumnLabel

protected String overviewSummaryColumnLabel
Constructor Detail

MappingEditor

public MappingEditor()
This creates a model editor.

Method Detail

getTopLabel

public String getTopLabel()

getBottomLabel

public String getBottomLabel()

getTopImage

public org.eclipse.swt.graphics.Image getTopImage()

getBottomImage

public org.eclipse.swt.graphics.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.


createMappingDomain

protected abstract AdapterFactoryMappingDomain createMappingDomain()

setSelectionToViewer

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


createContextMenuFor

protected void createContextMenuFor(org.eclipse.jface.viewers.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.


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 String getURIFromFile(org.eclipse.core.resources.IFile file)

handleCreation

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


handleMissingModelFile

protected abstract void handleMissingModelFile()

handleCreationException

protected void handleCreationException(Exception exception)

setMappingRoot

protected void setMappingRoot(MappingRoot mappingRoot)

getAdapter

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

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

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.


isDirty

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

Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart

doSave

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

Specified by:
doSave in interface org.eclipse.ui.ISaveablePart

doSaveHelper

protected void doSaveHelper(org.eclipse.core.resources.IFile file)

isSaveAsAllowed

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

Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart

doSaveAs

public void doSaveAs()
This also changes the model.

Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart

gotoMarker

public void gotoMarker(org.eclipse.core.resources.IMarker marker)

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput editorInput)
          throws org.eclipse.ui.PartInitException
Specified by:
init in interface org.eclipse.ui.IEditorPart
Throws:
org.eclipse.ui.PartInitException

setFocus

public void setFocus()
Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
This implements ISelectionProvider.

Specified by:
addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
This implements ISelectionProvider.

Specified by:
removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

getSelection

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

Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider

setSelection

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

Specified by:
setSelection in interface org.eclipse.jface.viewers.ISelectionProvider

setStatusLineManager

public void setStatusLineManager(org.eclipse.jface.viewers.ISelection selection)

menuAboutToShow

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

Specified by:
menuAboutToShow in interface org.eclipse.jface.action.IMenuListener

getMappedObjects

public Collection getMappedObjects(org.eclipse.jface.viewers.ISelection selection)
This turns the selection into the set of RefObjects involved in the mapping.


getMappings

public Collection getMappings(org.eclipse.jface.viewers.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 org.eclipse.jface.viewers.Viewer getCurrentViewer()

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart

getActionBarContributor

public EditingDomainActionBarContributor getActionBarContributor()

getActionBars

public org.eclipse.ui.IActionBars getActionBars()

getOverviewSummaryColumnLabel

public String getOverviewSummaryColumnLabel()

getOverviewSummaryColumnImage

public Object getOverviewSummaryColumnImage(Object o)

getOverviewSummaryColumnText

public String getOverviewSummaryColumnText(Object o)

hasLaunchedOverviewSummaryColumnEditor

public boolean hasLaunchedOverviewSummaryColumnEditor(Object object)

createLaunchedOverviewSummaryColumnEditor

public void createLaunchedOverviewSummaryColumnEditor(org.eclipse.swt.widgets.Composite parent,
                                                      Object object)

getDefaultCheckedShowTopFirst

public boolean getDefaultCheckedShowTopFirst()

getDefaultShowMultipleColumns

public boolean getDefaultShowMultipleColumns()

getDefaultFilterUnmappedObjects

public boolean getDefaultFilterUnmappedObjects()

createOverviewViewer

protected MappingEditor.OverviewViewer createOverviewViewer(org.eclipse.swt.widgets.Composite composite)

createOverviewDecoratorAdapterFactory

protected MappingEditor.OverviewDecoratorAdapterFactory createOverviewDecoratorAdapterFactory()

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