Class MultipleModelElementAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.nomagic.actions.NMAction
-
- com.nomagic.magicdraw.actions.MDAction
-
- com.nomagic.magicdraw.uml.actions.SingleModelElementAction
-
- com.nomagic.magicdraw.uml.actions.MultipleModelElementAction
-
- All Implemented Interfaces:
com.nomagic.magicdraw.actions.ShortcutSchemaAction
,IMultipleModelElementAction
,ISingleModelElementAction
,java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
,javax.swing.Action
@OpenApiAll public class MultipleModelElementAction extends SingleModelElementAction implements IMultipleModelElementAction
Base class for actions to work with multiple model elements.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.nomagic.actions.NMAction
ACTION_SHORTCUTS, BELONGS_TO_SEPARATE_GROUP_IN_UI, DO_NO_SHOW_ACTION_NAME_IN_UI, DO_NOT_REGISTER_ACTION_TO_COMPONENTS, GENERATED_ID_PREFIX, GROUP, ID, LARGE_ICON, MENU_SHORTCUT_MASK, TINY_ICON
-
-
Constructor Summary
Constructors Constructor Description MultipleModelElementAction(java.lang.String actionID, java.lang.String actionName, javax.swing.KeyStroke stroke, java.lang.String group)
ConstructorMultipleModelElementAction(java.lang.String actionID, java.lang.String actionName, javax.swing.KeyStroke stroke, java.lang.String group, boolean useSchema)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> java.util.List<T>
createCollection(T element)
Utility method to create an empty collection in case given element is null or a singleton collection in other case.protected Element
getElement()
Returns data from selected node.protected java.util.List<Element>
getElements()
Returns data from selected node.ModelElementsProvider
getElementsProvider()
Gets the provider.void
setElementsProvider(ModelElementsProvider provider)
Set provider for action-
Methods inherited from class com.nomagic.magicdraw.uml.actions.SingleModelElementAction
getProvider, setProvider
-
Methods inherited from class com.nomagic.magicdraw.actions.MDAction
actionPerformed, isUseShortcutSchema, updateState
-
Methods inherited from class com.nomagic.actions.NMAction
accept, addAction, addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, clone, compareTo, createMenuItem, equals, firePropertyChange, forEach, forEachIncludingSelf, getActions, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeIcon, getLargeOrSmallIcon, getMenuShortcutMaskAsString, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, getSmallIcon, getSmallOrLargeIcon, getTinyIcon, hashCode, hasMenuShortcutMask, isIDGenerated, removeAction, removeIf, removePropertyChangeListener, removeShortcut, removeWeakPropertyChangeListener, setActions, setDescription, setGroup, setIcon, setLargeIcon, setMnemonicKey, setName, setShortcuts, setSmallIcon, setTinyIcon, shallowClone, toString
-
Methods inherited from class javax.swing.AbstractAction
getKeys, getValue, isEnabled, putValue, setEnabled
-
-
-
-
Constructor Detail
-
MultipleModelElementAction
public MultipleModelElementAction(@CheckForNull java.lang.String actionID, java.lang.String actionName, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.String group)
Constructor- Parameters:
actionID
- action idactionName
- action namestroke
- action strokegroup
- action group
-
MultipleModelElementAction
public MultipleModelElementAction(@CheckForNull java.lang.String actionID, java.lang.String actionName, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.String group, boolean useSchema)
Constructor- Parameters:
actionID
- action idactionName
- action namestroke
- action strokegroup
- action groupuseSchema
- use shortcuts schema
-
-
Method Detail
-
getElements
protected java.util.List<Element> getElements()
Returns data from selected node. If there are no selected nodes, or more than one selected node returns null.- Returns:
- element
-
createCollection
public static <T> java.util.List<T> createCollection(@CheckForNull T element)
Utility method to create an empty collection in case given element is null or a singleton collection in other case.- Parameters:
element
- element- Returns:
- collection
-
setElementsProvider
public void setElementsProvider(ModelElementsProvider provider)
Set provider for action- Specified by:
setElementsProvider
in interfaceIMultipleModelElementAction
- Parameters:
provider
- the provider to set
-
getElementsProvider
public ModelElementsProvider getElementsProvider()
Description copied from interface:IMultipleModelElementAction
Gets the provider.- Specified by:
getElementsProvider
in interfaceIMultipleModelElementAction
- Returns:
- provider of action
-
getElement
protected Element getElement()
Description copied from class:SingleModelElementAction
Returns data from selected node. If there are no selected nodes, or more than one selected node returns null.- Overrides:
getElement
in classSingleModelElementAction
- Returns:
- a single element in case many elements are set
-
-