Package com.nomagic.magicdraw.ui.actions
Class DefaultDiagramAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.nomagic.actions.NMAction
-
- com.nomagic.magicdraw.actions.MDAction
-
- com.nomagic.magicdraw.ui.actions.DefaultDiagramAction
-
- All Implemented Interfaces:
DiagramAction
,com.nomagic.magicdraw.actions.ShortcutSchemaAction
,java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
,javax.swing.Action
- Direct Known Subclasses:
DefaultActiveDiagramAction
,DiagramContextToolbarAction
@OpenApiAll public class DefaultDiagramAction extends MDAction implements DiagramAction
The default implementation of DiagramAction and simple MDAction- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ref.WeakReference<DiagramPresentationElement>
diagram
The diagram for this action.-
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 DefaultDiagramAction(java.lang.String actionID, java.lang.String actionName, javax.swing.KeyStroke stroke, java.lang.String group)
Constructs new action.DefaultDiagramAction(java.lang.String actionID, java.lang.String actionName, javax.swing.KeyStroke stroke, java.lang.String group, boolean useSchema)
Constructs new action.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiagramPresentationElement
getDiagram()
Returns diagram of this action.protected PresentationElement
getFirstSelected()
Returns first selected presentation element in the diagram.protected java.util.List<PresentationElement>
getSelected()
Returns list of selected presentation elements.void
setDiagram(DiagramPresentationElement diagram)
Sets diagram for this action.-
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
-
-
-
-
Field Detail
-
diagram
private java.lang.ref.WeakReference<DiagramPresentationElement> diagram
The diagram for this action.
-
-
Constructor Detail
-
DefaultDiagramAction
public DefaultDiagramAction(@CheckForNull java.lang.String actionID, @CheckForNull java.lang.String actionName, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.String group)
Constructs new action.- Parameters:
actionID
- the action IDactionName
- the action namestroke
- the action strokegroup
- the action group
-
DefaultDiagramAction
public DefaultDiagramAction(@CheckForNull java.lang.String actionID, @CheckForNull java.lang.String actionName, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.String group, boolean useSchema)
Constructs new action.- Parameters:
actionID
- the action IDactionName
- the action namestroke
- the action strokegroup
- the action group
-
-
Method Detail
-
setDiagram
public void setDiagram(@CheckForNull DiagramPresentationElement diagram)
Sets diagram for this action.- Specified by:
setDiagram
in interfaceDiagramAction
- Parameters:
diagram
- the given diagram
-
getDiagram
@CheckForNull public DiagramPresentationElement getDiagram()
Returns diagram of this action. MagicDraw framework guarantee that diagram will set if this method is called from updateState() or actionPerformed(ActionEvent) methods.- Returns:
- set diagram
-
getFirstSelected
@CheckForNull protected PresentationElement getFirstSelected()
Returns first selected presentation element in the diagram.- Returns:
- first selected presentation element
-
getSelected
protected java.util.List<PresentationElement> getSelected()
Returns list of selected presentation elements.- Returns:
- list of selected presentation elements. If no elements selected, empty list is returned.
-
-