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,ActionListener,Serializable,Cloneable,Comparable,EventListener,Action
@OpenApiAll
public class MultipleModelElementAction
extends SingleModelElementAction
implements IMultipleModelElementAction
Base class for actions to work with multiple model elements.
- See Also:
-
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_ICONFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionMultipleModelElementAction(String actionID, String actionName, KeyStroke stroke, String group) ConstructorMultipleModelElementAction(String actionID, String actionName, KeyStroke stroke, String group, boolean useSchema) Constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones the object.static <T> 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 ElementReturns data from selected node.Returns data from selected node.Gets the provider.voidsetElementsProvider(ModelElementsProvider provider) Set provider for actionMethods inherited from class com.nomagic.magicdraw.uml.actions.SingleModelElementAction
getProvider, setProviderMethods inherited from class com.nomagic.magicdraw.actions.MDAction
actionPerformed, isUseShortcutSchema, updateStateMethods inherited from class com.nomagic.actions.NMAction
accept, addAction, addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, 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, toStringMethods inherited from class javax.swing.AbstractAction
getKeys, getValue, isEnabled, putValue, setEnabled
-
Constructor Details
-
MultipleModelElementAction
public MultipleModelElementAction(@CheckForNull String actionID, String actionName, @CheckForNull KeyStroke stroke, @CheckForNull String group) Constructor- Parameters:
actionID- action idactionName- action namestroke- action strokegroup- action group
-
MultipleModelElementAction
public MultipleModelElementAction(@CheckForNull String actionID, String actionName, @CheckForNull KeyStroke stroke, @CheckForNull String group, boolean useSchema) Constructor- Parameters:
actionID- action idactionName- action namestroke- action strokegroup- action groupuseSchema- use shortcuts schema
-
-
Method Details
-
getElements
Returns data from selected node. If there are no selected nodes, or more than one selected node returns null.- Returns:
- element
-
createCollection
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
Set provider for action- Specified by:
setElementsProviderin interfaceIMultipleModelElementAction- Parameters:
provider- the provider to set
-
getElementsProvider
Description copied from interface:IMultipleModelElementActionGets the provider.- Specified by:
getElementsProviderin interfaceIMultipleModelElementAction- Returns:
- provider of action
-
getElement
Description copied from class:SingleModelElementActionReturns data from selected node. If there are no selected nodes, or more than one selected node returns null.- Overrides:
getElementin classSingleModelElementAction- Returns:
- a single element in case many elements are set
-
clone
Description copied from class:NMActionClones the object. Does the deep clone.
-