public class BasicTransactionalFormEditor extends org.eclipse.ui.forms.editor.FormEditor implements IModelEditorInputChangeAnalyzer, 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, org.eclipse.ui.IPersistableEditor, org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor, org.eclipse.ui.ISaveablesSource, org.eclipse.ui.ISaveablePart2
Modifier and Type | Class and Description |
---|---|
class |
BasicTransactionalFormEditor.BasicTransactionalFormEditorInputChangeHandler |
Modifier and Type | Field and Description |
---|---|
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.ISelectionProvider |
currentSelectionProvider
This keeps track of the active selection provider, which may be either one of the viewers in the pages or the
content outline viewer.
|
protected ModelEditorInputSynchronizer |
editorInputSynchronizer
The model editor input synchronizer.
|
protected org.eclipse.jface.viewers.ISelection |
editorSelection
This keeps track of the selection of the editor as a whole.
|
protected boolean |
finishCreatePagesOnActivation
Indicated if the page creation of this editor needs finished upon activation due to editor input object change
while editor has been inactive.
|
protected org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator |
itemDelegator |
protected org.eclipse.ui.forms.editor.IFormPage |
messagePage |
protected org.eclipse.ui.navigator.SaveablesProvider |
modelSaveablesProvider |
protected org.eclipse.ui.IPartListener |
partListener
This listens for when Outline and Properties view become active/inactive
|
protected java.util.Set<org.eclipse.ui.views.properties.IPropertySheetPage> |
propertySheetPages
This is collection of the property sheet pages.
|
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.ISelectionProvider |
selectionProvider
This is the selection provider that shadows the selection in the content outline.
|
protected ModelEditorUndoContextManager |
undoContextManager
The model editor undo context manager.
|
Constructor and Description |
---|
BasicTransactionalFormEditor()
This creates a model editor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPages()
This is the method used by the framework to install your own pages.
|
void |
addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
This implements
ISelectionProvider . |
boolean |
containsEditorInputObject(org.eclipse.ui.IEditorInput editorInput,
java.util.Set<org.eclipse.emf.ecore.EObject> objects) |
boolean |
containsEditorInputResourceURI(org.eclipse.ui.IEditorInput editorInput,
java.util.Set<org.eclipse.emf.common.util.URI> resourceURIs) |
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.
|
protected org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator |
createItemDelegator() |
protected org.eclipse.ui.forms.editor.IFormPage |
createLoadingEditorInputPage() |
protected ModelEditorUndoContextManager |
createModelEditorUndoContextManager() |
protected org.eclipse.ui.ISaveablesLifecycleListener |
createModelSaveablesLifecycleListener()
Creates an ISaveablesLifecycleListener
|
protected org.eclipse.ui.navigator.SaveablesProvider |
createModelSaveablesProvider() |
protected org.eclipse.ui.forms.editor.IFormPage |
createNoEditorInputPage() |
protected void |
createPages()
Creates the common toolkit for this editor and adds pages to the editor.
|
void |
dispose() |
void |
doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
This is for implementing
IEditorPart and simply saves the model file. |
void |
doSaveAs()
This also changes the editor's input.
|
protected void |
finishCreatePages() |
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor |
getActionBarContributor() |
org.eclipse.ui.IActionBars |
getActionBars() |
org.eclipse.ui.forms.editor.IFormPage |
getActivePageInstance() |
org.eclipse.ui.Saveable[] |
getActiveSaveables() |
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()
Returns the
adapter factory to be used by this form
editor for creating item provider s which control the way how model
element s from given editingDomain are displayed and can be edited. |
org.eclipse.ui.views.contentoutline.IContentOutlinePage |
getContentOutlinePage()
This accesses a cached version of the content outliner.
|
java.lang.String |
getContributorId() |
protected org.eclipse.emf.common.notify.AdapterFactory |
getCustomAdapterFactory()
Returns a custom
adapter factory to be used by this form editor for creating item provider s which control the way how model element s from given editingDomain are displayed and can be edited. |
org.eclipse.jface.viewers.ISelection |
getDefaultSelection() |
org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain()
This returns the editing domain as required by the
IEditingDomainProvider interface. |
protected org.eclipse.emf.transaction.TransactionalEditingDomain |
getEditingDomain(org.eclipse.emf.common.util.URI uri) |
protected org.eclipse.ui.IEditorPart |
getEditor(int pageIndex) |
protected org.eclipse.swt.graphics.Image |
getEditorInputImage() |
protected java.lang.String |
getEditorInputName() |
java.lang.Object |
getEditorInputObject() |
org.eclipse.emf.ecore.resource.Resource |
getEditorInputResource() |
org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator |
getItemDelegator() |
protected java.util.Map<?,?> |
getLoadOptions() |
protected ModelEditorUndoContextManager |
getModelEditorUndoContextManager() |
java.lang.Object |
getModelRoot()
Deprecated.
Use
getEditorInputObject() instead. |
org.eclipse.emf.ecore.resource.Resource |
getModelRootResource()
Deprecated.
Use
getEditorInputResource() instead. |
java.lang.Object |
getOldEditorInputObject() |
java.lang.Object |
getOldModelRoot()
Deprecated.
Use
getOldEditorInputObject() instead. |
org.eclipse.core.commands.operations.IOperationHistory |
getOperationHistory() |
org.eclipse.ui.views.properties.IPropertySheetPage |
getPropertySheetPage()
This creates a new property sheet page instance and manages it in the cache.
|
org.eclipse.ui.Saveable[] |
getSaveables() |
protected java.util.Map<?,?> |
getSaveOptions() |
org.eclipse.jface.viewers.ISelection |
getSelection()
This implements
ISelectionProvider to return this editor's overall selection. |
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.
|
void |
handleContentOutlineSelection(org.eclipse.jface.viewers.ISelection selection)
This deals with how we want selection in the outliner to affect the other views.
|
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.
|
protected boolean |
isActivePart() |
protected boolean |
isActivePropertySheetPage() |
boolean |
isDirty() |
protected boolean |
isDisposed()
Tests if this editor has already been disposed.
|
protected boolean |
isEditorInputObjectStale()
Returns whether the object behind the
editor input is something that likely represents a
stale object, e.g., an EObject that has become a proxy object or a
Resource that has been unloaded . |
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() |
boolean |
isSaveOnCloseNeeded() |
void |
menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)
This implements
IMenuListener to help fill the context menus with contributions
from the Edit menu. |
int |
promptToSaveOnClose() |
void |
removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
This implements
ISelectionProvider . |
protected void |
reset() |
void |
restoreState(org.eclipse.ui.IMemento memento) |
protected void |
saveResource()
Saves the resource on which the editor is opened.
|
void |
saveState(org.eclipse.ui.IMemento memento) |
protected void |
setActivePage(int pageIndex) |
protected void |
setCurrentSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider selectionProvider)
This makes sure that one selection provider, either for the current page or the outline view, if it has focus, is
the current one.
|
void |
setFocus() |
protected void |
setMessagePage(org.eclipse.ui.forms.editor.IFormPage messagePage) |
void |
setSelection(org.eclipse.jface.viewers.ISelection selection)
This implements
ISelectionProvider to set this editor's overall selection. |
void |
setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider selectionProvider)
This is to make sure that one of the selection providers in one of the pages can shadows the selection in the
content outline.
|
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 |
showProblemsView() |
protected void |
showTabs()
If there is more than one page in the multi-page editor part, this shows the tabs at the bottom.
|
java.lang.String |
toString() |
protected void |
updateEditorInput(org.eclipse.emf.common.util.URI newURI) |
addPage, addPage, addPage, addPage, addPage, addPage, close, commitPages, configurePage, createPageContainer, createToolkit, editorDirtyStateChanged, findPage, getActiveEditor, getCurrentPage, getSelectedPage, getToolkit, pageChange, removePage, selectReveal, setActivePage, setActivePage, updateActionBarContributor
activateSite, addPageChangedListener, createPartControl, createSite, deactivateSite, findEditors, getActivePage, getContainer, getControl, getPageCount, getPageImage, getPageSite, getPageText, handlePropertyChange, initializePageSwitching, removePageChangedListener, setActiveEditor, setControl, setPageImage, setPageText
checkSite, getEditorInput, getEditorSite, getTitleToolTip, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, 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.ui.views.contentoutline.IContentOutlinePage contentOutlinePage
protected org.eclipse.jface.action.IStatusLineManager contentOutlineStatusLineManager
protected org.eclipse.jface.viewers.TreeViewer contentOutlineViewer
protected java.util.Set<org.eclipse.ui.views.properties.IPropertySheetPage> propertySheetPages
protected org.eclipse.jface.viewers.ISelectionProvider selectionProvider
protected org.eclipse.jface.viewers.ISelectionProvider currentSelectionProvider
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 boolean finishCreatePagesOnActivation
protected org.eclipse.ui.forms.editor.IFormPage messagePage
protected org.eclipse.ui.navigator.SaveablesProvider modelSaveablesProvider
protected org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator itemDelegator
protected ModelEditorUndoContextManager undoContextManager
protected ModelEditorInputSynchronizer editorInputSynchronizer
protected org.eclipse.ui.IPartListener partListener
public BasicTransactionalFormEditor()
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput editorInput)
init
in interface org.eclipse.ui.IEditorPart
init
in class org.eclipse.ui.forms.editor.FormEditor
public void setSelectionToViewer(java.util.Collection<?> collection)
protected java.util.Map<?,?> getLoadOptions()
protected java.util.Map<?,?> getSaveOptions()
protected void handleActivate()
public void setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider selectionProvider)
protected void setCurrentSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider selectionProvider)
public org.eclipse.jface.viewers.Viewer getViewer()
IViewerProvider
interface.getViewer
in interface org.eclipse.emf.common.ui.viewer.IViewerProvider
public void createContextMenuFor(org.eclipse.jface.viewers.StructuredViewer viewer)
protected void updateEditorInput(org.eclipse.emf.common.util.URI newURI)
@Deprecated public java.lang.Object getModelRoot()
getEditorInputObject()
instead.@Deprecated public java.lang.Object getOldModelRoot()
getOldEditorInputObject()
instead.@Deprecated public org.eclipse.emf.ecore.resource.Resource getModelRootResource()
getEditorInputResource()
instead.protected boolean isEditorInputObjectStale()
editor input
is something that likely represents a
stale object, e.g., an EObject
that has become a proxy object
or a
Resource
that has been unloaded
.public java.lang.Object getEditorInputObject()
editor input
that is currently being edited in this editor or
null
if no such is available.getOldEditorInputObject()
public java.lang.Object getOldEditorInputObject()
editor input
that has been edited before in case that actual
editor input object has become unavailable, or null
if actual editor input object is still
available.getEditorInputObject()
public org.eclipse.emf.ecore.resource.Resource getEditorInputResource()
protected java.lang.String getEditorInputName()
protected org.eclipse.swt.graphics.Image getEditorInputImage()
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 java.lang.String getContributorId()
getContributorId
in interface org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor
public void handleContentOutlineSelection(org.eclipse.jface.viewers.ISelection selection)
public boolean isDirty()
isDirty
in interface org.eclipse.ui.ISaveablePart
isDirty
in class org.eclipse.ui.forms.editor.FormEditor
public boolean isSaveOnCloseNeeded()
isSaveOnCloseNeeded
in interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeeded
in class org.eclipse.ui.part.EditorPart
public int promptToSaveOnClose()
promptToSaveOnClose
in interface org.eclipse.ui.ISaveablePart2
public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
IEditorPart
and simply saves the model file.doSave
in interface org.eclipse.ui.ISaveablePart
doSave
in class org.eclipse.ui.part.EditorPart
protected void saveResource()
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
public void gotoMarker(org.eclipse.core.resources.IMarker marker)
gotoMarker
in interface org.eclipse.ui.ide.IGotoMarker
protected void reset()
public void setFocus()
setFocus
in interface org.eclipse.ui.IWorkbenchPart
setFocus
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 org.eclipse.jface.viewers.ISelection getDefaultSelection()
public void setStatusLineManager(org.eclipse.jface.viewers.ISelection selection)
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.core.commands.operations.IOperationHistory getOperationHistory()
public void dispose()
dispose
in interface org.eclipse.ui.IWorkbenchPart
dispose
in class org.eclipse.ui.forms.editor.FormEditor
protected boolean isDisposed()
This implementation determines the disposed state of the editor by checking if the FormEditor.pages
field
is null
or not. When the editor has been disposed, it is an error to invoke any other method using
the editor.
true
when the editor is disposed and false
otherwise.protected boolean showOutlineView()
protected ModelEditorUndoContextManager getModelEditorUndoContextManager()
protected ModelEditorUndoContextManager createModelEditorUndoContextManager()
protected boolean isActivePart()
protected boolean isActivePropertySheetPage()
protected org.eclipse.ui.navigator.SaveablesProvider createModelSaveablesProvider()
protected org.eclipse.ui.ISaveablesLifecycleListener createModelSaveablesLifecycleListener()
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
protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain(org.eclipse.emf.common.util.URI uri)
public org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory()
adapter factory
to be used by this form
editor
for creating item provider
s which control the way how model
element
s from given editingDomain
are displayed and can be edited.
This implementation returns the adapter factory
which is embedded in the given
editingDomain
by default. Clients which want to use an alternative adapter
factory
(e.g., an adapter factory
that creates item provider
s
which are specifically designed for the editor
in which this
form editor
is used) may override getCustomAdapterFactory()
and
return any adapter factory
of their choice. This custom adapter
factory
will then be returned as result by this method.
editingDomain
- The editing domain
whose embedded adapter
factory
is to be returned as default. May be left null
if
getCustomAdapterFactory()
has been overridden and returns a non-null
result.adapter factory
that will be used by this form editor
. null
if no custom adapter factory
is provided through
getCustomAdapterFactory()
and no editingDomain
has been specified.getCustomAdapterFactory()
protected org.eclipse.emf.common.notify.AdapterFactory getCustomAdapterFactory()
adapter factory
to be used by this form editor
for creating item provider
s which control the way how model element
s from given editingDomain
are displayed and can be edited.
This implementation returns null
as default. Clients which want to use their own
adapter factory
(e.g., an adapter factory
that creates
item provider
s which are specifically designed for the editor
in
which this form editor
is used) may override this method and return any
adapter factory
of their choice. This custom adapter factory
will
then be returned as result by #getAdapterFactory(TransactionalEditingDomain)
.
adapter factory
that is to be used by this
form editor
. null
the default adapter factory
returned by #getAdapterFactory(TransactionalEditingDomain)
should be used
instead.#getAdapterFactory(TransactionalEditingDomain)
public org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator getItemDelegator()
protected org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator createItemDelegator()
protected void createPages()
createPages
in class org.eclipse.ui.forms.editor.FormEditor
protected void setMessagePage(org.eclipse.ui.forms.editor.IFormPage messagePage)
protected void showProblemsView()
protected org.eclipse.ui.forms.editor.IFormPage createLoadingEditorInputPage()
protected org.eclipse.ui.forms.editor.IFormPage createNoEditorInputPage()
protected void finishCreatePages()
protected void addPages()
This implementation add a single page
that displays the editor input object and
its contents in a tree viewer.
addPages
in class org.eclipse.ui.forms.editor.FormEditor
public org.eclipse.ui.forms.editor.IFormPage getActivePageInstance()
getActivePageInstance
in class org.eclipse.ui.forms.editor.FormEditor
protected void setActivePage(int pageIndex)
setActivePage
in class org.eclipse.ui.forms.editor.FormEditor
protected org.eclipse.ui.IEditorPart getEditor(int pageIndex)
getEditor
in class org.eclipse.ui.part.MultiPageEditorPart
public void saveState(org.eclipse.ui.IMemento memento)
saveState
in interface org.eclipse.ui.IPersistable
public void restoreState(org.eclipse.ui.IMemento memento)
restoreState
in interface org.eclipse.ui.IPersistableEditor
public org.eclipse.ui.Saveable[] getActiveSaveables()
getActiveSaveables
in interface org.eclipse.ui.ISaveablesSource
public org.eclipse.ui.Saveable[] getSaveables()
getSaveables
in interface org.eclipse.ui.ISaveablesSource
public java.lang.String toString()
toString
in class java.lang.Object
public boolean containsEditorInputObject(org.eclipse.ui.IEditorInput editorInput, java.util.Set<org.eclipse.emf.ecore.EObject> objects)
containsEditorInputObject
in interface IModelEditorInputChangeAnalyzer
public boolean containsEditorInputResourceURI(org.eclipse.ui.IEditorInput editorInput, java.util.Set<org.eclipse.emf.common.util.URI> resourceURIs)
containsEditorInputResourceURI
in interface IModelEditorInputChangeAnalyzer