<questionid="arch-what"> Whatisthisprojectgoodfor? <hint> Pleaseprovideherefewlinesdescribingthetheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<em>Actions</em> provides system of support and utility classes
for 'actions' usage in NetBeans.
</answer>
<answer id="arch-usecases">
First see the <a href="@TOP@/org/openide/actions/doc-files/api.html">API description</a>. Here is just
a list of frequently asked or interesting questions slowly expanding as
people ask them:
<h3>Actions faq:</h3>
<usecase id="context-action-shortcuts" name="How to define configurable Shortcut for Component based shortcut?" >
<em><b>Q:</b>
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?</em>
<p>
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.
</p>
<pre>
<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>
</pre>
<p>
The mentioned Action has to be a subclass of <code>org.openide.util.actions.CallbackSystemAction</code>. 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 <code>getActionMapKey()</code> and give it a
reasonable key.
</p>
<p>
The actual action that does the work in your component (preferably a simple Swing <code>javax.swing.Action</code>)
is to be put into your <code>TopComponent</code>'s <code>ActionMap</code>. The key for the <code>ActionMap</code>
has to match the key defined in the global action's <code>getActionMapKey()</code> method.
</p>
<pre>
getActionMap().put("PreviousViewAction", new MyPreviousTabAction());
</pre>
<p>
This way even actions from multiple <code>TopComponent</code>s with the same gesture (eg. "switch to next tab") can share the same configurable shortcut.
</p>
<p>
Note: Don't define your action's shortcut and don't put it into any of the <code>TopComponent</code>'s
<code>javax.swing.InputMap</code>. Otherwise the component would not pick up the changed shortcut from the
global context.
</p>
<questionid="compat-standards"> Doesthemoduleimplementsordefinesanystandards?Isthe implementationexactoritdeviatessomehow? </question>
-->
<answer id="compat-standards">
Before the Actions was build on <code>org.openide.util.actions.SystemAction</code>, this
was recently changed that Actions supports <code>javax.swing.Action</code> which
is java API standard, and Actions will be improving towards this more and more.
</answer>
<!-- Question: compat-version
<questionid="compat-version"> Doesyourmoduleproperlycoexistswithearlierandfuture versions?Canyoucorrectlyreadsettings?Willfuture versionsbeabletoreadsettings? <hint> Veryhelpfulforreadingsettingsistostoreversionnumber there,sofutureversionscandecidewhetherhowtoread/convert thesettingsandolderversionscanignorethenewones. </hint> </question>
-->
<answer id="compat-version">
Yes up to now it is supposed to be compatible with older versions.
</answer>
<questionid="dep-platform"> Onwhichplatformsyourmodulerun?Any?Doesitruninthesame way? <hint> IfyourmoduleisusingJNIordealswithspecialdifferencesof OSeslikefilesystems,etc.pleasedescribeherewhattheyare. </hint> </question>
-->
<answer id="dep-platform"> 100% pure Java. It should run anywhere.
</answer>
<!-- Question: deploy-jar
<questionid="deploy-jar"> DoyoudeployjustmoduleJARfile(s)orsomeotherfiles? <hint> IfyourmoduleconsistjustfromonemoduleJARfile,justconfirmthat. IfitusesmorethanoneJAR,describewheretherearelocated,how theyrefertoeachother. IfitconsistofmoduleJAR(s)andotherfiles,pleasedescribe whatistheirpurpose,whyotherfilesarenecessary.Please makesurethatinstallation/deinstallationleavesthesystem instateasitwasbeforeinstallation. </hint> </question>
-->
<answer id="deploy-jar">
Classes belonging to this module do not reside in standalone library.
They are bundled together with other parts of the openide in <code>openide.jar</code>.
</answer>
<!-- Question: deploy-nbm
<questionid="deploy-nbm"> CanyoudeployNBMviaAutoUpdatecenter? <hint> Ifnotwhy? </hint> </question>
-->
<answer id="deploy-nbm">
Whole openide can be deployed via AU center.
</answer>
<!-- Question: deploy-packages
<questionid="deploy-packages"> Arepackagesofyourmodulemadeinaccessiblebynotdeclaringthem public? <hint> NetBeansmodulesystemallowsrestrictionofaccessrightsto publicclassesofyourmodulefromothermodules.Thisprevents unwanteddependenciesofothersonyourcodeandshouldbeused wheneverpossible(<ahref="http://www.netbeans.org/download/apis/org/openide/doc-files/upgrade.html#3.4-public-packages"> publicpackages </a>). </hint> </question>
-->
<answer id="deploy-packages"> <!-- XXX what does this mean? -->
No, ther are <api name="ActionsAPI" group="java"type="export" category="official"url="@TOP@/overview-summary.html"/>.
</answer>
<!-- Question: deploy-shared
<questionid="deploy-shared"> Doyouneedtobeinstalledinsharedlocationoronlyinuserdirectory? <hint> Installationlocationshallnotmatter,ifitdoesexplainwhy. </hint> </question>
-->
<answer id="deploy-shared">
<code>openide.jar</code> needs to be in the system directory.
</answer>
<questionid="exec-component"> Isexecutionofyourcodeinfluencedby(string)property ofanyofyourcomponents? <hint> Often<code>JComponent.getClientProperty</code>,<code>Action.getValue</code> or<code>PropertyDescriptor.getValue</code>,etc.areusedtoinfluence abehaviourofsomecode.Thisofcourseformsaninterfacethatshould bedocumented.Alsoifonedependsonsomeinterfacethatanobject implements(<code>componentinstanceofRunnable</code>)thatformsan APIaswell. </hint> </question>
-->
<answer id="exec-component">
There are used three values (via <code>Action.getValue()</code>).
<ul>
<li><api name="OpenIDE-Transmodal-Action" group="property" category="devel"type="export">Inidicates action can be performed
(typicaly via shortcut) even when dialog is popped out (modal or modeless).</api></li>
<li><api name="delegates" group="property" category="devel"type="export">Used internaly in <code>PasteAction</code> delegate action
which serves to pass an array of <code>PasteType</code> or <code>Action</code> to global instance (it is the only one
which actually performs paste operation).</api></li>
<li><api name="iconBase" group="property" category="devel"type="export">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.</api></li>
<li><api name="noIconInMenu" group="property" category="devel"type="export">
Allowed value <code>Boolean.TRUE</code>.
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.
</api></li>
<li><api name="PreferredIconSize" group="property" category="devel"type="export">
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".</api></li>
<li>
<api name="waitFinished" group="property" category="friend"type="export">
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 <code>actionPeformed</code> method is passed <code>ActionEvent</code>
with command <q>waitFinished</q> the action shall be executed synchronously.
The code:
<pre>
action.actionPerformed (new ActionEvent (this, 0, "waitFinished"))
</pre>
shall be executed synchronously, even if the action by default runs asynchronously.
All asynchronous actions are asked to obey this contract, <code>CallableSystemAction</code>
does it by default. However this contract is defined as friend one
and may be abandoned in future.
</api>
</li>
</ul>
<api name="ActionMapKeys" category="stable" group="property"type="export" >
<code>CallableSystemAction</code> uses its <code>getActionMapKey()</code> method
(usually overriden by subclasses) to get a key which is then searched in the
<code>ActionMap</code> obtained from the action's context. Other modules can
register their own action then:
<pre>
topComponent.getActionMap ().put (theKey, new YourOwnSwingAction ());
</pre>
Here is the list of special keys:
<ul>
<li><code>"cloneWindow"</code> - an action to be executed when a top component is to be cloned</li>
<li><code>"closeWindow"</code> - an action when a view is about to be closed</li>
<li><code>DefaultEditorKit.copyAction</code> - copy action handler</li>
<li><code>DefaultEditorKit.cutAction</code> - cut action handler</li>
<li><code>"delete"</code> - delete action handler</li>
<li><code>DefaultEditorKit.pasteAction</code> - paste action handler</li>
<!-- new since 5.8 -->
<li><code>"jumpNext"</code> - when a next element shall be selected</li>
<li><code>"jumpPrev"</code> - when a previous element shall be selected</li>
</ul>
</api>
<questionid="exec-property"> Isexecutionofyourcodeinfluencedbyanyenvironmentof system(<code>System.getProperty</code>)property? <hint> Ifthereisapropertythatcanchangethebehaviourofyour code,somebodywilllikelyuseit.Youshoulddescribewhatitdoes andthestabilitycategoryofthisAPI.Youmayuse <PRE> <propertyname="id"category="private"> descriptionoftheproperty,whereitisused,whatitinfluence,etc. </property> </PRE> </hint> </question>
-->
<answer id="exec-property">
<ul>
<li>
<api type="export" group="systemproperty" name="org.openide.util.actions.CallableSystemAction.synchronousByDefault" category="friend">
If set to <code>true</code>, changes default value of the
<code>asynchronous()</code> method. Useful for unit tests
which would prefer to run all tested actions synchronously.
</api>
</li>
</ul>
</answer>
<!-- Question: exec-reflection
<questionid="exec-reflection"> Doesyourcodeusesjava.lang.reflecttoexecutesomeothercode? <hint> ThisusuallyindicatesamissingorunsufficientAPIintheother partofthesystem.Iftheothersideisnotawareofyourdependency thiscontractcanbeeasilybroken. </hint> </question>
-->
<answer id="exec-reflection">
A bit indirectly. <code>SystemAction.get (...)</code>
calls to <code>SharedClassObject.findObject</code> which calls constructor by reflection.
</answer>
<!-- Question: format-clipboard
<questionid="format-clipboard"> Whichprotocolsyourcodereads/insertswhencommunicatingwith clipboard? </question>
-->
<answer id="format-clipboard">
Implementations of cut, copy and paste (<code>CutAction</code>, <code>CopyAction</code>
and <code>PasteAction</code>) reads/writes from/into clipboard. It uses standard
<a href="@JDK@@JDKMODULE_JAVA_DATATRANSFER@/java/awt/datatransfer/package-summary.html">java datatransfer mechanism</a>
and <a href="@org-openide-util-ui@/org/openide/util/datatransfer/package-summary.html">Netbeans extension to the mechanism</a>.
</answer>
<!-- Question: format-dnd
<questionid="format-dnd"> Whichprotocolsyourcodeunderstandsduringdrag-n-drop? </question>
-->
<answer id="format-dnd">
See format-clibpoard.
</answer>
<questionid="lookup-lookup"> Doesyourmoduleuses<code>org.openide.util.Lookup</code> tofindanycomponentstocommunicateto?Whichones? <hint> Pleasedescribetheinterfacesyouaresearchingfor,where aredefined,whetheryouaresearchingforjustoneormoreofthem, iftheorderisimportant,etc.Alsoclasifythestabilityofsuch APIcontract. </hint> </question>
-->
<answer id="lookup-lookup">
It uses <code>Lookup</code> as a representation of context in which are certain action
types <code>ContextAwareAction</code>s used. Current implementations
lookup in the context for <code>javax.swing.ActionMap</code>
or <code>org.openide.nodes.Node</code> or <code>org.openide.Node.Cookie</code>
instances.
</answer>
<!-- Question: lookup-register
<questionid="lookup-register"> Doyouregisteranythingintothelookupforothertofind? <hint> Doyouregisterusinglayerfileorusing<code>META-INF/services</code>? Whoissupposedtofindyourcomponent? </hint> </question>
-->
<answer id="lookup-register">
No. Actions are just clients of some lookups.
</answer>
<questionid="perf-mem"> Whatistheamountofmemoryyourcomponentoccupies?Estimate witharelactiontothenumberofwindows,etc. </question>
-->
<answer id="perf-mem">
There is one class in VM per action. Because currently all actions are subclasses
of <code>SystemAction</code>.
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.
<br/>It should be measured how much of memory they take.
I guess the amount shouldn't be signicant.
</answer>
<!-- Question: perf-menus
<questionid="perf-menus"> Doesyourmoduleusedynamicallychangingcontextmenusor contextsensitiveactionswithcomplicatedlogicforenable/disable? </question>
-->
<answer id="perf-menus">
Actions doesn't use menus, it is vice versa.
</answer>
<questionid="perf-scale"> Whichexternalcriteriainfluencetheperformanceofyour program(sizeoffileineditor,numberoffilesinmenu, insourcedirectory,etc.)andhowwellyourcodescales? Pleaseincludesomeestimates. </question>
-->
<answer id="perf-scale">
This should be irrelevant, as far as I know, Actions shouldn't use any collections
of data or something like that. One exception I know is global keymap implementation
which scales linear.
</answer>
<questionid="perf-wakeup"> Isanypieceofyourcodewakingupperiodically? </question>
-->
<answer id="perf-wakeup">
No. At least I do not know about that.
</answer>
<questionid="resources-read"> Doesyourmodulereadanyresourcesfromlayers?Forwhatpurpose? <hint> Asthisissomekindofintermoduledependency,itisakindofAPI. Pleasedescribeitandclasifyaccordingto <ahref="http://openide.netbeans.org/tutorial/api-design.html#categories"> commonstabilitycategories</a>. </hint> </question>
-->
<answer id="resources-read">
There are special folders containing actions in xml layers.
<ul>
<li><em>Menu</em> contains actions which are present in menu.</li>
<li><em>Toolbars</em> contains actions which will be present in toolbars.</li>
<li><em>Shortcuts</em> contains actions which will have assigned shortcuts.</li>
<li><em>Actions</em> contains actions which are possible to manipulate with (via Options).</li>
</ul>
<em>Note:</em> Those layers are not necessarily read by Actions module. Probably
it belongs to <em>Window system module</em>.
</answer>
<!-- <questionid="perf-spi"when="init"> Howtheperformanceofthepluggedincodewillbeenforced? <hint> Ifyouallowforeigncodetobepluggedintoyourownmodule,how doyouenforcethatitwillbehavecorrectlyandquicklyandwillnot negativelyinfluencetheperformanceofyourownmodule? </hint> </question>
-->
<answer id="perf-spi">
<p>
XXX no answer for perf-spi
</p>
</answer>
<!-- <questionid="security-grant"when="final"> Doesyourcodegrantadditionalrightstosomeothercode? <hint>Avoidusingaclassloaderthataddsextra permissionstoloadedcodeunlessreallynecessary. AlsonotethatyourAPIimplementation canalsoexposeunneededpermissionstoenemycodeby callingAccessController.doPrivileged().</hint> </question>
-->
<answer id="security-grant">
<p>
XXX no answer for security-grant
</p>
</answer>
<!-- <questionid="security-policy"when="final"> Doesyourfunctionalityrequiremodificationstothestandardpolicyfile? <hint>Yourcodemightpasscontroltothird-partycodenot comingfromtrusteddomains.Thiscouldbecodedownloadedoverthe networkorcodecomingfromlibrariesthatarenotbundled withNetBeans.Whichpermissionsneedtobegrantedtowhichdomains?</hint> </question>
-->
<answer id="security-policy">
<p>
XXX no answer for security-policy
</p>
</answer>
</api-answers>
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.51Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.