The recommended way how to invoke popup or main menu is through an {@link
org.netbeans.jellytools.actions.Action} or {@link org.netbeans.jellytools.actions.ActionNoBlock}
instance. Predefined actions in this package are descendants either of Action
for non blocking operations or of ActionNoBlock for operations which
may block further execution by a modal dialog showing.
An action can be performed in "main menu", "popup", "shortcut" or "API"
modes. By default it is performed in the first available mode because not
every action is defined for all four modes. An example of usage can be:
// performs in default mode
new CopyAction().perform();
// performs in "menu" mode
new CopyAction().performMenu();
It also possible to specify a node or component on which an action will be performed:
// selects node first and then performs on it
new FindAction().perform(myNode);
// focuses component first and then performs action in "popup"
mode
new FindAction().performPopup(myComponentOperator);
If an action is not predefined, you can create and use your own action.
// invokes main menu item "Edit|Copy"
new Action("Edit|Copy", null).perform();
// invokes popup menu item "Copy" on given node
new Action(null, "Copy").perform(myNode);
// invokes main menu item "Edit|Find" (first selects given
node)
new ActionNoBlock("Edit|Find", null).perform(myFolderNode);
// invoke popup menu item "Find" on given component
new ActionNoBlock(null, "Find").perform(myEditorOperator);