Class DefaultBrowserAction
java.lang.Object
javax.swing.AbstractAction
com.nomagic.actions.NMAction
com.nomagic.magicdraw.actions.MDAction
com.nomagic.magicdraw.ui.browser.actions.DefaultBrowserAction
- All Implemented Interfaces:
BrowserAction
,com.nomagic.magicdraw.actions.ShortcutSchemaAction
,ActionListener
,Serializable
,Cloneable
,Comparable
,EventListener
,Action
The default implementation of BrowserAction and simple MDAction
- 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_ICON
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
Fields 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
ConstructorDescriptionDefaultBrowserAction
(String actionID, String actionName, KeyStroke stroke, String group) Constructs new action.DefaultBrowserAction
(String actionID, String actionName, KeyStroke stroke, String group, boolean useShortcutSchema) Constructs new action. -
Method Summary
Modifier and TypeMethodDescriptionstatic Tree
Returns first selected element.getFirstElement
(Tree tree) Returns first selected element in a given tree.Collection<? extends BaseElement>
Collects selected base elements in treeprotected Object
static Object
getSelectedObject
(Tree tree) Returns first selected object in a given tree.Collection<?>
Collect selected user objects in treegetSelectedObjectsStream
(Tree tree) getTree()
Return tree of this action.protected Tree
void
Set tree 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
-
Constructor Details
-
DefaultBrowserAction
@OpenApi public DefaultBrowserAction(@CheckForNull String actionID, String actionName, @CheckForNull KeyStroke stroke, @CheckForNull String group) Constructs new action.- Parameters:
actionID
- the action IDactionName
- the action namestroke
- the action strokegroup
- the action group
-
DefaultBrowserAction
@OpenApi public DefaultBrowserAction(@CheckForNull String actionID, @CheckForNull String actionName, @CheckForNull KeyStroke stroke, @CheckForNull String group, boolean useShortcutSchema) Constructs new action.- Parameters:
actionID
- the action IDactionName
- the action namestroke
- the action strokegroup
- the action groupuseShortcutSchema
- use shortcut schema
-
-
Method Details
-
setTree
Set tree for this action.- Specified by:
setTree
in interfaceBrowserAction
- Parameters:
tree
- the browser for this action
-
getTree
Return tree of this action. MagicDraw framework guarantee that tree will set if this method is called from updateState() or actionPerformed(ActionEvent) methods.- Returns:
- browser of this action
-
getTreeOrActiveTree
- Returns:
- action's tree or active tree in browser of action's tree is null
-
getActiveTree
-
getSelectedObject
Returns first selected object in a given tree.- Parameters:
tree
- given tree- Returns:
- first selected object
-
getFirstElement
Returns first selected element in a given tree.- Parameters:
tree
- given tree- Returns:
- first selected element
-
getFirstElement
Returns first selected element.- Returns:
- first selected element
-
getSelectedObject
- Returns:
- selected object in tree
-
getSelectedObjects
Collect selected user objects in tree- Returns:
- collection of selected objects. Empty collection is nothing is selected
-
getSelectedBaseElements
Collects selected base elements in tree- Returns:
- collection of selected base elements. Empty collection is nothing is selected
-
getSelectedObjectsStream
-