Creating an Action
See Also
The New Action wizard creates a new action.
To create a new action:
- Right-click a module project and choose New > Action.
- In the Action Type page, you set the type:
- Always Enabled. Specifies that the action will be invoked
from a menu item in the menu bar, from a toolbar button in a toolbar, or from a keyboard shortcut anywhere
in the IDE.
- Conditionally Enabled. Specifies the classes for which the action will be created.
This is normally one of your own business objects. However, optionally, you can also include one or more of the
following, which creates the action for all classes that subclass them:
- DataObject
- EditCookie
- EditorCookie
- OpenCookie
- Project
- User Selects One Node.
User May Select Multiple Nodes. Specifies the conditions under which the
action will be enabled. By default, will be
enabled if one, and only one, node
holding the business object of interest is selected.
If checked, it will also be enabled if
multiple nodes all holding
the desired business object(s) are selected.
Click Next.
- In the GUI Registration page, you have to specify how the user will
be able to call the new action.
- Category. Specifies where the action will be displayed
in the Keymap section of the Options window.
- Global Menu Item. Specifies the menu where the action
will be displayed as an item. You can also specify the position within the menu,
and whether you want a separator to appear before it, after it, or both.
- Global Toolbar Button. Specifies the toolbar where the action
will be displayed as a button. You can also specify the position within the toolbar.
- Global Keyboard Shortcut. Specifies a shortcut that will invoke the
action.
Only if Conditionally Enabled is selected in the Action Type page
can you set the following items:
- File Type Context Menu Item. Specifies the file type where
the action will be displayed in the pop-up menu.
- Editor Context Menu Item. Specifies the IDE editor where the
action will be displayed in the pop-up menu.
Click Next.
- In the Name, Icon, and Location page, you set the following:
- Class Name. Specifies the name of the new Action class.
- Display Name. Specifies the action's label. (Optional)
- Icon. Specifies the icon that will accompany the action. For example, if
the action will be invoked by a toolbar button, the icon specified here is displayed on
the toolbar button.
- Package. Specifies the name of the package where the class will be housed.
Click Finish.
- After completing the wizard, you can do the following:
- Tweak the layer.xml file
to change the icon or to rearrange the position of the action within the actions provided by the available modules.
- See Also
- About NetBeans Platform and Module Development
- About the NetBeans Platform
Legal Notices