public class BasicTransactionalEditorActionBarContributor
extends org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
implements org.eclipse.jface.viewers.ISelectionChangedListener
Modifier and Type | Class and Description |
---|---|
class |
BasicTransactionalEditorActionBarContributor.RefreshAction |
class |
BasicTransactionalEditorActionBarContributor.ShowPropertiesViewAction |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_ATTR
The class node name for a configuration element.
|
protected java.util.Collection<org.eclipse.jface.action.IAction> |
createChildActions
This will contain one
CreateChildAction corresponding to each descriptor
generated for the current selection by the item provider. |
protected org.eclipse.jface.action.IMenuManager |
createChildMenuManager
This is the menu manager into which menu contribution items should be added for CreateChild actions.
|
protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> |
createChildSubmenuActions
This will contain a map of
CreateChildAction s, keyed by sub-menu text. |
protected java.util.Collection<org.eclipse.jface.action.IAction> |
createSiblingActions
This will contain one
CreateSiblingAction corresponding to each descriptor
generated for the current selection by the item provider. |
protected org.eclipse.jface.action.IMenuManager |
createSiblingMenuManager
This is the menu manager into which menu contribution items should be added for CreateSibling actions.
|
protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> |
createSiblingSubmenuActions
This will contain a map of
CreateSiblingAction s, keyed by submenu text. |
protected org.eclipse.jface.action.IAction |
refreshAction
This action refreshes the viewer of the current editor if the editor implements
IViewerProvider . |
protected org.eclipse.jface.viewers.ISelectionProvider |
selectionProvider
This keeps track of the current selection provider.
|
protected org.eclipse.jface.action.IAction |
showPropertiesViewAction
This action opens the Properties view.
|
static java.lang.String |
VALIDATEACTION
The validateAction node name for a configuration element.
|
static java.lang.String |
VIEW_POINT |
Constructor and Description |
---|
BasicTransactionalEditorActionBarContributor()
This creates an instance of the contributor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addGlobalActions(org.eclipse.jface.action.IMenuManager menuManager)
This inserts global actions before the "additions-end" separator.
|
void |
clearGlobalActionHandlers()
Clears the global action handler list.
|
void |
contributeToMenu(org.eclipse.jface.action.IMenuManager menuManager)
This adds to the menu bar a menu and some separators for editor additions, as well as the sub-menus for object
creation items.
|
protected org.eclipse.emf.edit.ui.action.CopyAction |
createCopyAction() |
protected org.eclipse.emf.edit.ui.action.CreateChildAction |
createCreateChildAction(org.eclipse.ui.IEditorPart editorPart,
org.eclipse.jface.viewers.ISelection selection,
java.lang.Object descriptor) |
protected org.eclipse.emf.edit.ui.action.CreateSiblingAction |
createCreateSiblingAction(org.eclipse.ui.IEditorPart editorPart,
org.eclipse.jface.viewers.ISelection selection,
java.lang.Object descriptor) |
protected org.eclipse.emf.edit.ui.action.CutAction |
createCutAction() |
protected org.eclipse.emf.edit.ui.action.DeleteAction |
createDeleteAction() |
protected org.eclipse.emf.edit.ui.action.PasteAction |
createPasteAction() |
protected org.eclipse.emf.edit.ui.action.RedoAction |
createRedoAction() |
protected org.eclipse.emf.edit.ui.action.UndoAction |
createUndoAction() |
protected void |
depopulateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Collection<? extends org.eclipse.jface.action.IAction> actions)
This removes from the specified
manager all ActionContributionItem s
based on the IAction s contained in the actions collection. |
protected void |
depopulateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions)
This removes from the specified
manager all MenuManager s and their
ActionContributionItem s based on the IAction s
contained in the submenuActions map. |
protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> |
extractSubmenuActions(java.util.Collection<org.eclipse.jface.action.IAction> createActions,
org.eclipse.jface.viewers.ISelection selection)
This extracts those actions in the
submenuActions collection whose text is qualified and returns a
map of these actions, keyed by submenu text (see GenModel option "Editor > Creation Sub-menus" for details). |
protected java.util.Collection<org.eclipse.jface.action.IAction> |
generateCreateChildActions(java.util.Collection<?> descriptors,
org.eclipse.jface.viewers.ISelection selection)
This generates a
CreateChildAction for each object in
descriptors , and returns the collection of these actions. |
protected java.util.Collection<org.eclipse.jface.action.IAction> |
generateCreateSiblingActions(java.util.Collection<?> descriptors,
org.eclipse.jface.viewers.ISelection selection)
This generates a
CreateSiblingAction for each object in
descriptors , and returns the collection of these actions. |
protected org.eclipse.emf.common.notify.AdapterFactory |
getAdapterFactory(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
Returns the
adapter factory to be used by this
action bar contributor for creating
item provider s which control the way how model element s from given
editingDomain are displayed and can be edited. |
protected org.eclipse.emf.common.notify.AdapterFactory |
getCustomAdapterFactory()
Returns a custom
adapter factory to be used by this
action bar contributor for creating
item provider s which control the way how model element s from given
editingDomain are displayed and can be edited. |
protected java.util.Collection<?> |
getNewChildDescriptors(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
java.lang.Object object,
java.lang.Object sibling)
Returns descriptors for all the possible children that can be added to the specified
object . |
void |
init(org.eclipse.ui.IActionBars actionBars) |
void |
menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)
This populates the pop-up menu before it appears.
|
protected void |
populateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Collection<? extends org.eclipse.jface.action.IAction> actions,
java.lang.String contributionId)
This populates the specified
manager with ActionContributionItem s
based on the IAction s contained in the actions collection, by
inserting them before the specified contribution item contributionId . |
protected void |
populateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions,
java.lang.String contributionId)
This populates the specified
manager with MenuManager s containing
ActionContributionItem s based on the IAction s
contained in the submenuActions collection, by inserting them before the specified contribution item
contributionId . |
protected boolean |
removeAllReferencesOnDelete()
Determines whether or not the delete action should clean up all references to the deleted objects.
|
void |
selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
This implements
ISelectionChangedListener , handling
SelectionChangedEvent s by querying for the children and siblings that can be
added to the selected object and updating the menus accordingly. |
void |
setActiveEditor(org.eclipse.ui.IEditorPart part)
When the active editor changes, this remembers the change and registers with it as a selection provider.
|
void |
setGlobalActionHandlers()
Sets the global action handler for the action contributed by this
BasicTransactionalEditorActionBarContributor . |
activate, contributeToStatusLine, contributeToToolBar, deactivate, getActiveEditor, propertyChanged, setActivePage, setActiveView, shareGlobalActions, update
public static final java.lang.String VIEW_POINT
public static final java.lang.String VALIDATEACTION
Equal to the word: validateAction
public static final java.lang.String CLASS_ATTR
Equal to the word: class
protected org.eclipse.jface.viewers.ISelectionProvider selectionProvider
protected org.eclipse.jface.action.IAction showPropertiesViewAction
protected org.eclipse.jface.action.IAction refreshAction
IViewerProvider
.protected java.util.Collection<org.eclipse.jface.action.IAction> createChildActions
CreateChildAction
corresponding to each descriptor
generated for the current selection by the item provider.protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> createChildSubmenuActions
CreateChildAction
s, keyed by sub-menu text.protected org.eclipse.jface.action.IMenuManager createChildMenuManager
protected java.util.Collection<org.eclipse.jface.action.IAction> createSiblingActions
CreateSiblingAction
corresponding to each descriptor
generated for the current selection by the item provider.protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> createSiblingSubmenuActions
CreateSiblingAction
s, keyed by submenu text.protected org.eclipse.jface.action.IMenuManager createSiblingMenuManager
public BasicTransactionalEditorActionBarContributor()
public void setGlobalActionHandlers()
BasicTransactionalEditorActionBarContributor
.public void clearGlobalActionHandlers()
public void init(org.eclipse.ui.IActionBars actionBars)
init
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.DeleteAction createDeleteAction()
createDeleteAction
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.PasteAction createPasteAction()
createPasteAction
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.CopyAction createCopyAction()
createCopyAction
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.CutAction createCutAction()
createCutAction
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.RedoAction createRedoAction()
createRedoAction
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.UndoAction createUndoAction()
createUndoAction
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected boolean removeAllReferencesOnDelete()
This implementation returns true
by default. Clients may override this method and return
false
if appropriate.
removeAllReferencesOnDelete
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
true
if delete action should clean up all references to deleted model objects,
false
otherwise.public void contributeToMenu(org.eclipse.jface.action.IMenuManager menuManager)
contributeToMenu
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
public void setActiveEditor(org.eclipse.ui.IEditorPart part)
setActiveEditor
in interface org.eclipse.ui.IEditorActionBarContributor
setActiveEditor
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
ISelectionChangedListener
, handling
SelectionChangedEvent
s by querying for the children and siblings that can be
added to the selected object and updating the menus accordingly.selectionChanged
in interface org.eclipse.jface.viewers.ISelectionChangedListener
protected java.util.Collection<?> getNewChildDescriptors(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.lang.Object object, java.lang.Object sibling)
object
. For
that purpose, it adapts the given object
to IEditingDomainItemProvider
and delegates the
actual calculation of possible child descriptors to
IEditingDomainItemProvider.getNewChildDescriptors(Object, EditingDomain, Object)
.
The adapter factory
required for adapting given object
to
IEditingDomainItemProvider
is retrieved by invoking
getAdapterFactory(TransactionalEditingDomain)
which returns the adapter factory
behind given editingDomain
by default. Clients which want the calculation of possible child
descriptors to be based on IEditingDomainItemProvider
s from an alternative adapter
factory
instead may override getCustomAdapterFactory()
and return any adapter
factory
of their choice. This custom adapter factory
will then be returned as result by
getAdapterFactory(TransactionalEditingDomain)
and consequently also be used by this method.
editingDomain
- The editing domain
behind given object
.object
- The object
for which the new child descriptors are to be returned.sibling
- If sibling
is non-null, an index is added to each new child descriptor with a
multi-valued feature, to ensure that the new child object gets added in the right position.object
getAdapterFactory(TransactionalEditingDomain)
,
getCustomAdapterFactory()
protected org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
adapter factory
to be used by this
action bar contributor
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
action bar contributor
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
action bar contributor
. 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
action bar contributor
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 action bar contributor
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
action bar contributor
. null
the
default adapter factory
returned by
getAdapterFactory(TransactionalEditingDomain)
should be used instead.getAdapterFactory(TransactionalEditingDomain)
public void menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)
menuAboutToShow
in interface org.eclipse.jface.action.IMenuListener
menuAboutToShow
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected java.util.Collection<org.eclipse.jface.action.IAction> generateCreateChildActions(java.util.Collection<?> descriptors, org.eclipse.jface.viewers.ISelection selection)
CreateChildAction
for each object in
descriptors
, and returns the collection of these actions.protected java.util.Collection<org.eclipse.jface.action.IAction> generateCreateSiblingActions(java.util.Collection<?> descriptors, org.eclipse.jface.viewers.ISelection selection)
CreateSiblingAction
for each object in
descriptors
, and returns the collection of these actions.protected void populateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Collection<? extends org.eclipse.jface.action.IAction> actions, java.lang.String contributionId)
manager
with ActionContributionItem
s
based on the IAction
s contained in the actions
collection, by
inserting them before the specified contribution item contributionId
. If ID
is
null
, they are simply added.protected void populateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions, java.lang.String contributionId)
manager
with MenuManager
s containing
ActionContributionItem
s based on the IAction
s
contained in the submenuActions
collection, by inserting them before the specified contribution item
contributionId
. If contributionId
is null
, they are simply added.protected void depopulateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Collection<? extends org.eclipse.jface.action.IAction> actions)
manager
all ActionContributionItem
s
based on the IAction
s contained in the actions
collection.protected void depopulateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions)
manager
all MenuManager
s and their
ActionContributionItem
s based on the IAction
s
contained in the submenuActions
map.protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> extractSubmenuActions(java.util.Collection<org.eclipse.jface.action.IAction> createActions, org.eclipse.jface.viewers.ISelection selection)
submenuActions
collection whose text is qualified and returns a
map of these actions, keyed by submenu text (see GenModel option "Editor > Creation Sub-menus" for details).protected void addGlobalActions(org.eclipse.jface.action.IMenuManager menuManager)
addGlobalActions
in class org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
protected org.eclipse.emf.edit.ui.action.CreateChildAction createCreateChildAction(org.eclipse.ui.IEditorPart editorPart, org.eclipse.jface.viewers.ISelection selection, java.lang.Object descriptor)
protected org.eclipse.emf.edit.ui.action.CreateSiblingAction createCreateSiblingAction(org.eclipse.ui.IEditorPart editorPart, org.eclipse.jface.viewers.ISelection selection, java.lang.Object descriptor)