Class 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:
  • Constructor Details

    • MultipleModelElementAction

      public MultipleModelElementAction(@CheckForNull String actionID, String actionName, @CheckForNull KeyStroke stroke, @CheckForNull String group)
      Constructor
      Parameters:
      actionID - action id
      actionName - action name
      stroke - action stroke
      group - action group
    • MultipleModelElementAction

      public MultipleModelElementAction(@CheckForNull String actionID, String actionName, @CheckForNull KeyStroke stroke, @CheckForNull String group, boolean useSchema)
      Constructor
      Parameters:
      actionID - action id
      actionName - action name
      stroke - action stroke
      group - action group
      useSchema - use shortcuts schema
  • Method Details

    • getElements

      protected 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> 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 interface IMultipleModelElementAction
      Parameters:
      provider - the provider to set
    • getElementsProvider

      public ModelElementsProvider getElementsProvider()
      Description copied from interface: IMultipleModelElementAction
      Gets the provider.
      Specified by:
      getElementsProvider in interface IMultipleModelElementAction
      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 class SingleModelElementAction
      Returns:
      a single element in case many elements are set
    • clone

      public NMAction clone()
      Description copied from class: NMAction
      Clones the object. Does the deep clone.
      Overrides:
      clone in class NMAction
      Returns:
      cloned object