|
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 "Shortcuts" linking to your action.
<folder name="Actions" > <folder name="Window"> <file name="org-netbeans-core-actions-PreviousViewCallbackAction.instance"/> </folder> </folder> <folder name="Shortcuts"> <file name="S-A-Left.shadow"> <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-actions-PreviousViewCallbackAction.instance"/> </file> </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.
NodeAction
.
NodeAction
uses TopComponent.Registry
.
PasteAction
uses ExplorerManager
.
FileSystemAction
uses FileSystem
.
FileSystemAction
uses DataObject
.
openide.jar
.
Question (deploy-nbm):
Can you deploy an NBM via the Update Center?
Answer:
Whole openide can be deployed via AU center.
Question (deploy-shared):
Do you need to be installed in the shared location only, or in the user directory only,
or can your module be installed anywhere?
Answer:
openide.jar
needs to be in the system directory.
Question (deploy-packages):
Are packages of your module made inaccessible by not declaring them
public?
Answer:
No, ther are ActionsAPI.
Question (deploy-dependencies):
What do other modules need to do to declare a dependency on this one?
WARNING: Question with id="deploy-dependencies" has not been answered!org.openide.util.actions.SystemAction
, this
was recently changed that Actions supports javax.swing.Action
which
is java API standard, and Actions will be improving towards this more and more.
Question (compat-version):
Can your module coexist with earlier and future
versions of itself? Can you correctly read all old settings? Will future
versions be able to read your current settings? Can you read
or politely ignore settings stored by a future version?
Answer:
Yes up to now it is supposed to be compatible with older versions.
java.io.File
directly?
Answer:
No.
Question (resources-layer):
Does your module provide own layer? Does it create any files or
folders in it? What it is trying to communicate by that and with which
components?
Answer:
No in fact. Just concrete action implementation provided by this module
are typically used in xml layers.
Question (resources-read):
Does your module read any resources from layers? For what purpose?
Answer:
There are special folders containing actions in xml layers.
org.openide.util.Lookup
or any similar technology to find any components to communicate with? Which ones?
Answer:
It uses Lookup
as a representation of context in which are certain action
types ContextAwareAction
s used. Current implementations
lookup in the context for javax.swing.ActionMap
or org.openide.nodes.Node
or org.openide.Node.Cookie
instances.
Question (lookup-register):
Do you register anything into lookup for other code to find?
Answer:
No. Actions are just clients of some lookups.
Question (lookup-remove):
Do you remove entries of other modules from lookup?
Answer:
No.
System.getProperty
) property?
Answer:
true
, changes default value of the
asynchronous()
method. Useful for unit tests
which would prefer to run all tested actions synchronously.
netbeans.popup.no_hack
-
Valid values are "true" and "false". If not set the default value is false. By default various
hacks are used to improve popup placement. These can cause problems when using dual monitors.
Use this property to turn off these hacks.
It can be set on command line or in ide.cfg. Usage example: To start IDE with dual monitors use
-J-Dnetbeans.popup.no_hack=true
Action.getValue()
).
PasteAction
delegate action
which serves to pass PasteTypes
S to global instance (it is the only one
which actually performs paste operation).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.
actionPeformed
method is passed ActionEvent
with command waitFinishedthe 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 abadoned in future.
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 closedDefaultEditorKit.copyAction
- copy action handlerDefaultEditorKit.cutAction
- cut action handler"delete"
- delete action handlerDefaultEditorKit.pasteAction
- paste action handler"jumpNext"
- when a next element shall be selected"jumpPrev"
- when a previous element shall be selectedSystemAction.get (...)
calls to SharedClassObject.findObject
which calls constructor by reflection.
Question (exec-privateaccess):
Are you aware of any other parts of the system calling some of
your methods by reflection?
Answer:
No.
Question (exec-process):
Do you execute an external process from your module? How do you ensure
that the result is the same on different platforms? Do you parse output?
Do you depend on result code?
WARNING: Question with id="exec-process" has not been answered!
Question (exec-introspection):
Does your module use any kind of runtime type information (instanceof
,
work with java.lang.Class
, etc.)?
WARNING: Question with id="exec-introspection" has not been answered!
Question (exec-threading):
What threading models, if any, does your module adhere to?
WARNING: Question with id="exec-threading" has not been answered!
Question (security-policy):
Does your functionality require modifications to the standard policy file?
WARNING: Question with id="security-policy" has not been answered!
Question (security-grant):
Does your code grant additional rights to some other code?
WARNING: Question with id="security-grant" has not been answered!
java.awt.datatransfer.Transferable
?
Answer:
Implementations of cut, copy and paste (CutAction
, CopyAction
and PasteAction
) reads/writes from/into clipboard. It uses standard
java datatransfer mechanism
and Netbeans extension to the mechanism.
SystemAction
.
Those kind of actions are singletons.
That older approach is getting away. There are already newer implementation
which creates short living action instances (context sensitive actions)
when invoking popup menu.
org.netbeans.core.ShortcutsEditor
.
Question (perf-menus):
Does your module use dynamically updated context menus, or
context-sensitive actions with complicated and slow enablement logic?
Answer:
Actions doesn't use menus, it is vice versa.
Question (perf-spi):
How the performance of the plugged in code will be enforced?
WARNING: Question with id="perf-spi" has not been answered!Built on May 4 2005. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.