public class BasicModelEditActionProvider extends BasicActionProvider
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.emf.edit.ui.action.CopyAction |
copyAction
This is the action used to implement copy.
|
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 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 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.emf.edit.ui.action.CutAction |
cutAction
This is the action used to implement cut.
|
protected org.eclipse.emf.edit.ui.action.DeleteAction |
deleteAction
This is the action used to implement delete.
|
protected org.eclipse.emf.edit.ui.action.PasteAction |
pasteAction
This is the action used to implement paste.
|
selectionProvider, viewer, viewerId, workbenchPart
Constructor and Description |
---|
BasicModelEditActionProvider() |
Modifier and Type | Method and Description |
---|---|
protected org.eclipse.emf.edit.ui.action.CopyAction |
createCopyAction() |
protected org.eclipse.emf.edit.ui.action.CreateChildAction |
createCreateChildAction(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
org.eclipse.jface.viewers.ISelection selection,
java.lang.Object descriptor) |
protected org.eclipse.jface.action.IAction |
createCreateSiblingAction(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
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 ICommandParameterFilter |
createNewChildOrSiblingItemFilter() |
protected org.eclipse.emf.edit.ui.action.PasteAction |
createPasteAction() |
void |
dispose() |
void |
doInit()
Method to override in order to provide a custom initialization of this action
provider.
|
void |
fillActionBars(org.eclipse.ui.IActionBars actionBars) |
void |
fillContextMenu(org.eclipse.jface.action.IMenuManager menuManager) |
protected java.util.Collection<org.eclipse.jface.action.IAction> |
generateCreateChildActions(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
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(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
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
provider 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 provider 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 . |
protected ICommandParameterFilter |
getNewChildOrSiblingItemFilter() |
protected boolean |
removeAllReferencesOnDelete() |
protected boolean |
shouldCreateCreateChildActions(java.lang.Object object)
Returns if create child/sibling menus and actions should be shown for the given object.
|
protected void |
updateActions(org.eclipse.jface.viewers.ISelection selection) |
addSubMenu, depopulateManager, depopulateManager, extractSubmenuActions, fillSubMenu, getEditingDomainFromSelection, init, isActivePropertySheet, isTransient, populateManager, populateManager
filterAction, getActionSite, restoreState, saveState
protected org.eclipse.emf.edit.ui.action.CutAction cutAction
protected org.eclipse.emf.edit.ui.action.CopyAction copyAction
protected org.eclipse.emf.edit.ui.action.PasteAction pasteAction
protected org.eclipse.emf.edit.ui.action.DeleteAction deleteAction
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 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.public void doInit()
BasicActionProvider
doInit
in class BasicActionProvider
public void fillContextMenu(org.eclipse.jface.action.IMenuManager menuManager)
fillContextMenu
in class BasicActionProvider
public void fillActionBars(org.eclipse.ui.IActionBars actionBars)
fillActionBars
in class org.eclipse.ui.actions.ActionGroup
public void dispose()
dispose
in class org.eclipse.ui.actions.ActionGroup
protected void updateActions(org.eclipse.jface.viewers.ISelection selection)
protected boolean shouldCreateCreateChildActions(java.lang.Object object)
This default implementation returns always true
. It may be overridden by subclasses as appropriate.
object
- The object under investigation.true
if create child/sibling menus and actions should be shown for the given object,
false
otherwise.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.CopyAction createCopyAction()
protected org.eclipse.emf.edit.ui.action.CutAction createCutAction()
protected boolean removeAllReferencesOnDelete()
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 a custom adapter
factory
instead can override getCustomAdapterFactory()
and return any adapter
factory
of their choice. This custom adapter factory
will then be the result returned by
getAdapterFactory(TransactionalEditingDomain)
and consequently also used by this method.
editingDomain
- The editing domain
behind given object
.object
- The object
to return the new child descriptors for.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
provider
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 provider
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 provider
. 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 provider
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 provider
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 provider
. null
the default
adapter factory
returned by getAdapterFactory(TransactionalEditingDomain)
should be used instead.getAdapterFactory(TransactionalEditingDomain)
protected java.util.Collection<org.eclipse.jface.action.IAction> generateCreateChildActions(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, 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(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.util.Collection<?> descriptors, org.eclipse.jface.viewers.ISelection selection)
CreateSiblingAction
for each object in
descriptors
, and returns the collection of these actions.protected ICommandParameterFilter getNewChildOrSiblingItemFilter()
protected ICommandParameterFilter createNewChildOrSiblingItemFilter()
protected org.eclipse.emf.edit.ui.action.CreateChildAction createCreateChildAction(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.jface.viewers.ISelection selection, java.lang.Object descriptor)
protected org.eclipse.jface.action.IAction createCreateSiblingAction(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.jface.viewers.ISelection selection, java.lang.Object descriptor)