Package org.freeplane.core.util
Class MenuUtils
java.lang.Object
org.freeplane.core.util.MenuUtils
Utilities for dealing with the Freeplane menu: In scripts available as "global variable" menuUtils.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The userObject type for createMenuEntryTree().static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultMutableTreeNode
createAcceleratebleMenuEntryTree
(String menuRootKey) Used as the basis for dynamic generation of hotkey list.static DefaultMutableTreeNode
createMenuEntryTree
(String menuRootKey) returns a tree of allJMenuItem
nodes the menu contains (omitting Strings and Separators).static void
executeMenuItems
(List<String> menuItemKeys) to be used from scripts to execute menu items.static org.freeplane.core.ui.IndexedTree.Node
findAssignedMenuItemNodeRecursively
(DefaultMutableTreeNode menubarNode, KeyStroke keystroke) there are little reasons to use this in scripts.static String
formatKeyStroke
(KeyStroke keyStroke) pretty print a keystroke.static Icon
getMenuItemIcon
(String menuItemKey) returns the icon for a menuItemKey or null if it has none.
-
Constructor Details
-
MenuUtils
public MenuUtils()
-
-
Method Details
-
createMenuEntryTree
returns a tree of allJMenuItem
nodes the menu contains (omitting Strings and Separators). The tree is build fromDefaultMutableTreeNode
nodes havingMenuEntry
objects as their userObjects. Note that the root node may have null as userObject if the menu item atmenuRootKey
doesn't contain aJMenuItem
!- Parameters:
menuRootKey
- the key of the node that should form the root of the output.- Throws:
IllegalArgumentException
- if the menuRootKey does not point to an entry in the menu tree
-
createAcceleratebleMenuEntryTree
Used as the basis for dynamic generation of hotkey list. Same ascreateMenuEntryTree(String)
but all MenuEntries without associated accelerator and (then) empty submenus are removed from the result.- Throws:
IllegalArgumentException
- if the menuRootKey does not point to an entry in the menu tree
-
formatKeyStroke
pretty print a keystroke. -
findAssignedMenuItemNodeRecursively
public static org.freeplane.core.ui.IndexedTree.Node findAssignedMenuItemNodeRecursively(DefaultMutableTreeNode menubarNode, KeyStroke keystroke) there are little reasons to use this in scripts. -
executeMenuItems
to be used from scripts to execute menu items. Find out the menuItemKey of a menu item with the devtools add-on. It contains a tool for that. -
getMenuItemIcon
returns the icon for a menuItemKey or null if it has none.
-