XXX no answer for arch-overallQuestion (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module? Answer: First see the API description. Here is just a list of frequently asked or interesting questions slowly expanding as people ask them:
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
The actual action that does the work in your component (preferably a simple Swing
is to be put into your
ActionMap. The key for the
has to match the key defined in the global action's
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
javax.swing.InputMap. Otherwise the component would not pick up the changed shortcut from the
XXX no answer for arch-timeQuestion (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented? Answer:
XXX no answer for arch-qualityQuestion (arch-where): Where one can find sources for your module? Answer:
The sources for the module are in the NetBeans Mercurial repositories.
The default answer to this question is:
These modules are required in project.xml:
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.jarneeds 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, in addition to or instead of the normal module dependency declaration (e.g. tokens to require)? Answer:
org.openide.util.actions.SystemAction, this was recently changed that Actions supports
javax.swing.Actionwhich 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. Question (compat-deprecation): How the introduction of your project influences functionality provided by previous version of the product? WARNING: Question with id="compat-deprecation" has not been answered!
java.io.Filedirectly? 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: UI-ToolActions - Register your javax.swing.Action instances in
UI/ToolActionsfolder to make them known to ToolsAction. Question (resources-read): Does your module read any resources from layers? For what purpose? Answer: There are special folders containing actions in xml layers.
|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|
org.openide.util.Lookupor any similar technology to find any components to communicate with? Which ones? Answer: It uses
Lookupas a representation of context in which are certain action types
ContextAwareActions used. Current implementations lookup in the context for
org.openide.Node.Cookieinstances. 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? On a similar note, is there something interesting that you pass to
java.util.logging.Logger? Or do you observe what others log? Answer:
true, changes default value of the
asynchronous()method. Useful for unit tests which would prefer to run all tested actions synchronously.
PasteActiondelegate action which serves to pass an array of
Actionto 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.
actionPeformedmethod is passed
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,
CallableSystemActiondoes it by default. However this contract is defined as friend one and may be abandoned in future.
getActionMapKey()method (usually overriden by subclasses) to get a key which is then searched in the
ActionMapobtained 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
XXX no answer for exec-ant-tasksQuestion (exec-classloader): Does your code create its own class loader(s)? Answer: No. Question (exec-reflection): Does your code use Java Reflection to execute other code? Answer: A bit indirectly.
SystemAction.get (...)calls to
SharedClassObject.findObjectwhich 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? Answer:
XXX no answer for exec-processQuestion (exec-introspection): Does your module use any kind of runtime type information (
instanceof, work with
java.lang.Class, etc.)? Answer:
XXX no answer for exec-introspectionQuestion (exec-threading): What threading models, if any, does your module adhere to? How the project behaves with respect to threading? Answer:
XXX no answer for exec-threadingQuestion (security-policy): Does your functionality require modifications to the standard policy file? Answer:
XXX no answer for security-policyQuestion (security-grant): Does your code grant additional rights to some other code? Answer:
XXX no answer for security-grant
java.awt.datatransfer.Transferable? Answer: Implementations of cut, copy and paste (
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? Answer:
XXX no answer for perf-spi
Built on December 18 2017. | Portions Copyright 1997-2017 Oracle. All rights reserved.