## About Actions

See Also

Actions are defined by the

The Actions API is a standard representation of the actions a user can invoke. It provides an interface to such IDE elements as toolbars, menus, and keyboard shortcuts, allowing third parties to create actions that are sensitive to context and invocable in more than one way. The Actions API offers the ability to write the action once, and have it automatically apply as appropriate. For example, a user action might show up in both a toolbar and be selected by a keyboard shortcut, all from the same implementation.

Actions are typically presented in pop-up menus, or attached to a component such as a window, node, or data object.

The Actions API provides two types of action:

- An action that can be called programmatically throughout the IDE, regardless of context, be it from a menu item in the main menu bar, a toolbar button in the main toolbar, or a keyboard shortcut. For example, in the IDE, the action that defines Tools > Options subclasses `CallableSystemAction`.

- An action that is context aware. Whether it can be called depends on the cookies of the selected nodes. Cookies are a design pattern used to add behaviors to existing data objects and nodes, or to separate an implementation from the main object. The Loaders API describes how to use cookies in conjunction with data objects, including creating new cookie interfaces, creating new cookie support implementations, and reusing existing supports. The Nodes API also permits use of cookies to add behavior to nodes.

Both types of action can be created with the New Action wizard. The wizard automatically registers actions in the `layer.xml` file.

For an example of the use of an action that shows up as a menu item and as a toolbar button, see the
For an example of an action that shows up as an edit box in a toolbar, see the

See Also
  About NetBeans Platform and Module Development
  About the NetBeans Platform

Legal Notices