See: Description
Package | Description |
---|---|
org.openide.actions |
There are a number of standard
system actions
available for use in NetBeans.
|
XXX no answer for arch-overall
SelectionType ANY in SaveAction
SaveAction
has been modified to allow one or more SaveCookie
s
into it's context. The previous behavior was to allow EXACTLY_ONE.
ToolsAction via layers
Register your actions for ToolsAction
via
layer, don't use the deprecated manifest style.
HeapView
preserves its settings between sessions
Settings of showDropShadow
, showText
and tickStyle
are now preserved between sessions in NBPreferences of the same corresponding names.
Use
topComponent.getActionMap().put("jumpPrev", new YourPrevAction()); topComponent.getActionMap().put("jumpNext", new YourNextAction());if your component provides items and you want the user to jump among them using standard next/prev actions.
ActionManager.getDefault()
added
This method should be more convenient than looking for an instance in lookup. Also there is a simple implementation for standalone use available.
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 TopComponent
s 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.
|
|
|
|
The sources for the module are in the NetBeans Mercurial repositories.
Nothing.
Read more about the implementation in the answers to architecture questions.
Built on March 18 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.