Skip navigation links
org.openide.actions 6.43.1

Actions APIs
Official

See: Description

Actions APIs 
Package Description
org.openide.actions
There are a number of standard system actions available for use in NetBeans.

XXX no answer for arch-overall

What is New (see all changes)?

Use Cases

First see the API description. Here is just a list of frequently asked or interesting questions slowly expanding as people ask them:

Actions faq:

How to define configurable Shortcut for Component based shortcut?
Q: The usual Swing way of defining Actions for your component is to create an Action instance and put it into the Input and Action maps of your component. However how to make this Action's shortcut configurable from the Tools/Keyboard Shortcuts dialog?

In order for the action to show up in Keyboards Shortcut dialog you need the action defined in the layer file under "Actions" folder and have the shortcut defined there under "Keymaps/<Profile Name>" linking to your action.

    <folder name="Actions" >
        <folder name="Window">
            <file name="org-netbeans-core-actions-PreviousViewCallbackAction.instance"/>
        </folder>
    </folder>

    <folder name="Keymaps">
        <folder name="NetBeans">
            <file name="S-A-Left.shadow">
                <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-actions-PreviousViewCallbackAction.instance"/>
            </file>
        </folder>
    </folder>

The mentioned Action has to be a subclass of org.openide.util.actions.CallbackSystemAction. It does not necessarily has to perform the action, it's just a placeholder for linking the shortcut. You might want to override it's getActionMapKey() and give it a reasonable key.

The actual action that does the work in your component (preferably a simple Swing javax.swing.Action) is to be put into your TopComponent's ActionMap. The key for the ActionMap has to match the key defined in the global action's getActionMapKey() method.

        getActionMap().put("PreviousViewAction", new MyPreviousTabAction());

This way even actions from multiple TopComponents with the same gesture (eg. "switch to next tab") can share the same configurable shortcut.

Note: Don't define your action's shortcut and don't put it into any of the TopComponent's javax.swing.InputMap. Otherwise the component would not pick up the changed shortcut from the global context.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
ActionsAPIExportedOfficialoverview-summary.html

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?
OpenIDE-Transmodal-ActionExportedUnder Development

Inidicates action can be performed (typicaly via shortcut) even when dialog is popped out (modal or modeless).

delegatesExportedUnder Development

Used internaly in PasteAction delegate action which serves to pass an array of PasteType or Action to global instance (it is the only one which actually performs paste operation).

iconBaseExportedUnder Development

Used in companion to Actions.SMALL_ICON. Because there is no way to specify values for other types of icons the value of "iconBase" is used to construct the resource names of disabled, pressed and rollover icons. The value is expected to contain a resource path of the normal icon. Strings "_pressed", "_disabled" and "_rollover" are inserted before the suffix when searching for the other types of icons.

noIconInMenuExportedUnder Development

Allowed value Boolean.TRUE. Influences the display of the action in the main menu, the item will have no icon there. Works for Actions that don't define custom MenuPresenter.

PreferredIconSizeExportedUnder Development

Used to support 24x24 icons in toolbars. If toolbar button has client property "PreferredIconSize" set to Integer(24) button tries to load icon with name "iconBase" + "24" eg. "cut24.gif". Strings "_pressed","_disabled" and "_rollover" are inserted before the suffix when searching for the other types of icons eg.:"cut24_pressed.gif".

waitFinishedExportedFriend

There is a new contract established between the caller of an action that allows mutual communication and possible synchronous execution even for actions that by default perform their operations asynchronously. If the action's actionPeformed method is passed ActionEvent with command waitFinished the action shall be executed synchronously. The code:
             action.actionPerformed (new ActionEvent (this, 0, "waitFinished"))
             
shall be executed synchronously, even if the action by default runs asynchronously. All asynchronous actions are asked to obey this contract, CallableSystemAction does it by default. However this contract is defined as friend one and may be abandoned in future.

ActionMapKeysExportedStable

CallableSystemAction uses its getActionMapKey() method (usually overriden by subclasses) to get a key which is then searched in the ActionMap obtained from the action's context. Other modules can register their own action then:
topComponent.getActionMap ().put (theKey, new YourOwnSwingAction ());
Here is the list of special keys:
  • "cloneWindow" - an action to be executed when a top component is to be cloned
  • "closeWindow" - an action when a view is about to be closed
  • DefaultEditorKit.copyAction - copy action handler
  • DefaultEditorKit.cutAction - cut action handler
  • "delete" - delete action handler
  • DefaultEditorKit.pasteAction - paste action handler
  • "jumpNext" - when a next element shall be selected
  • "jumpPrev" - when a previous element shall be selected

Group of systemproperty interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.openide.util.actions.CallableSystemAction.synchronousByDefaultExportedFriend

If set to true, changes default value of the asynchronous() method. Useful for unit tests which would prefer to run all tested actions synchronously.

Group of layer interfaces
Interface NameIn/OutStabilitySpecified in What Document?
UI-ToolActionsExportedStable

Register your javax.swing.Action instances in UI/ToolActions folder to make them known to ToolsAction.

Group of preferences interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.openide.actions.HeapViewExportedPrivate

key description read write
showDropShadow Preserves "Drop Shadow" setting of the view x x
showText Preserves "Show Text" setting of the view x x
tickStyle Preserves "Overlay Grid" setting of the view x x

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans Mercurial repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

Nothing.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.openide.actions 6.43.1