org.eclipse.emf.ecore.presentation
Class EcoreEditor

org.eclipse.emf.ecore.presentation.EcoreEditor
All Implemented Interfaces:
IEditingDomainProvider
Direct Known Subclasses:
EcoreEditor.XML

public class EcoreEditor
implements IEditingDomainProvider

This is an example of a Ecore model editor.


Inner Class Summary
 class EcoreEditor.ReverseAdapterFactoryContentProvider
          
static class EcoreEditor.XML
           
 
Field Summary
protected  ComposedAdapterFactory adapterFactory
          This is the one adapter factory used for providing views of the model.
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  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.jface.viewers.ListViewer listViewer
          This shows how a list view works.
protected  org.eclipse.jface.viewers.TreeViewer parentViewer
          This inverts the roll of parent and child in the content provider and show parents as a tree.
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  org.eclipse.core.resources.IResourceChangeListener resourceChangeListener
          This listens for workspace changes.
protected  org.eclipse.jface.viewers.ISelectionChangedListener selectionChangedListener
          This listens to which ever viewer is active.
protected  java.util.Collection selectionChangedListeners
          This keeps track of all the ISelectionChangedListeners 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.jface.viewers.TableTreeViewer tableTreeViewer
          This shows how a table view works.
protected  org.eclipse.jface.viewers.TableViewer tableViewer
          This shows how a table view works.
protected  org.eclipse.jface.viewers.TreeViewer treeViewer
          This shows how a tree view works.
 
Constructor Summary
EcoreEditor()
          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 viewer)
          This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 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 editor's input.
protected  void firePropertyChange(int action)
          This is here for the listener to be able to call it.
 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.
 AdapterFactory getAdapterFactory()
          
 org.eclipse.ui.views.contentoutline.IContentOutlinePage getContentOutlinePage()
          This accesses a cached version of the content outliner.
 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.
 org.eclipse.jface.viewers.ISelection getSelection()
          This implements ISelectionProvider to return this editor's overall selection.
 void gotoMarker(org.eclipse.core.resources.IMarker marker)
          
protected  void handleActivate()
          Handles activation of the editor or it's associated views.
protected  void handleChangedResources()
          Handles what to do with changed resources on activation.
 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 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)
          This is called during startup.
 boolean isDirty()
          This is for implementing IEditorPart and simply tests the command stack.
 boolean isSaveAsAllowed()
          This always returns true because it is not currently supported.
 void menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)
          This implements org.eclipse.jface.action.IMenuListener to help fill the context menus with contributions from the Edit menu.
protected  void pageChange(int pageIndex)
          This is used to track the active viewer.
 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 setFocus()
          
 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)
          
 

Field Detail

editingDomain

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

adapterFactory

protected ComposedAdapterFactory adapterFactory
This is the one adapter factory used for providing views of 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.

propertySheetPage

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

selectionViewer

protected org.eclipse.jface.viewers.TreeViewer selectionViewer
This 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 parentViewer
This inverts the roll of parent and child in the content provider and show parents as a tree.

treeViewer

protected org.eclipse.jface.viewers.TreeViewer treeViewer
This shows how a tree view works.

listViewer

protected org.eclipse.jface.viewers.ListViewer listViewer
This shows how a list view works. A list viewer doesn't support icons.

tableViewer

protected org.eclipse.jface.viewers.TableViewer tableViewer
This shows how a table view works. A table can be used as a list with icons.

tableTreeViewer

protected org.eclipse.jface.viewers.TableTreeViewer tableTreeViewer
This shows how a table view works. A table can be used as a list with icons.

currentViewerPane

protected org.eclipse.emf.common.ui.ViewerPane currentViewerPane
This keeps track of the active viewer pane, in the 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.

selectionChangedListener

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

selectionChangedListeners

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

resourceChangeListener

protected org.eclipse.core.resources.IResourceChangeListener resourceChangeListener
This listens for workspace changes.
Constructor Detail

EcoreEditor

public EcoreEditor()
This creates a model editor.
Method Detail

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.

handleDirtyConflict

protected boolean handleDirtyConflict()
Shows a dialog that asks if conflicting changes should be discarded.

firePropertyChange

protected void firePropertyChange(int action)
This is here for the listener to be able to call it.

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

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.

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.

pageChange

protected void pageChange(int pageIndex)
This is used to track the active viewer.

getAdapter

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

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 implementing IEditorPart and simply tests the command stack.

doSave

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

isSaveAsAllowed

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

doSaveAs

public void doSaveAs()
This also changes the editor's input.

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,
                 org.eclipse.ui.PartInitException
This is called during startup.

setFocus

public void setFocus()

addSelectionChangedListener

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

removeSelectionChangedListener

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

getSelection

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

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.

setStatusLineManager

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

menuAboutToShow

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

getActionBarContributor

public EditingDomainActionBarContributor getActionBarContributor()

getActionBars

public org.eclipse.ui.IActionBars getActionBars()

getAdapterFactory

public AdapterFactory getAdapterFactory()

dispose

public void dispose()

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