DevFaqActionAddEditorPopup

(Difference between revisions)
(Created page with '__NOTOC__ ===How do I add an action to a the popup menu of the Java editor?=== The simplest way is to run New Action Wizard (File > New... > Module Development > Action) which c…')
(How do I add an action to a the popup menu of the Java editor?: Fixed wrong path in example)
 
(7 intermediate revisions not shown)
Line 6: Line 6:
# On the second tab, check '''Editor Context Menu Item''' and choose MIME type (<tt>text/x-java</tt> in this case) and position.
# On the second tab, check '''Editor Context Menu Item''' and choose MIME type (<tt>text/x-java</tt> in this case) and position.
-
You can also declare your action in your layer manually:
+
OR
-
 
+
use
-
<pre>
+
<pre>@ActionReference(path="Editors/text/x-java/Popup")</pre> for an action with the <tt>EditorCookie</tt> as context object
-
<folder name="Editors">
+
<hr/>
-
  <folder name="text">
+
-
    <folder name="x-java">
+
-
      <folder name="Popup">
+
-
        <file name="org-mymodule-MyAction.instance"/>
+
-
      </folder>
+
-
    </folder>
+
-
  </folder>
+
-
</folder>
+
-
</pre>
+
-
 
+
-
You can also use <tt>Editors/Popup/</tt> to add an action to ''all'' editor kits.
+
===See also:===
===See also:===
-
 
+
* [[DevFaqActionAddToContextMenuOfAllEditors|How do I add an action to the context menu of all editors?]]
* [[DevFaqActionAddFileMime| How do I add an action to a file of a given mime-type? ]]
* [[DevFaqActionAddFileMime| How do I add an action to a file of a given mime-type? ]]
* [[DevFaqActionAddFolder| How do I add an action to a folder? ]]
* [[DevFaqActionAddFolder| How do I add an action to a folder? ]]

Current revision as of 11:45, 31 December 2014

How do I add an action to a the popup menu of the Java editor?

The simplest way is to run New Action Wizard (File > New... > Module Development > Action) which creates an action for you and registers it in your layer.xml.

  1. On the first tab, choose Conditionally Enabled action and select EditorCookie as the cookie class.
  2. On the second tab, check Editor Context Menu Item and choose MIME type (text/x-java in this case) and position.

OR use

@ActionReference(path="Editors/text/x-java/Popup")
for an action with the EditorCookie as context object

See also:

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo