Shortcuts for single-file and targets
LAYAT Jérôme <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
How about the possibility to create new IDE-Actions and link them with custom
ant target?
Let me explain what I would like to see in NetBeans (if it
does not already exist): all begun because I wanted to be able to apply
checkstyle to a single file. There's no working corresponding module dedicated
to NetBeans 4.1 and I don't think this is really necessary since I know how to
map IDE Commands in project.xml (see
http://www.netbeans.org/kb/articles/freeform-config-40.html#in_file).
So let's detail, that's really simple:
I've added this target in my build.xml:
<target name="checkstyle-selected-files">
<fail unless="files">Must set property 'files'</fail>
<mkdir dir="${build}"/>
<checkstyle failOnViolation="false" failureProperty="checkstyle.failure"
properties="../../9-Environment/dev/checkstyle.properties">
<fileset defaultexcludes="yes" dir="${src}">
<include name="${files}"/>
</fileset>
</checkstyle>
</target>
then I've put this entry in the project.xml file (in the nbproject directory),
as a child of the <ide-actions> tag:
<action name="debug.test.single"> <!--Ctrl-Shift-F6-->
<target>checkstyle-selected-files</target>
<context>
<property>files</property>
<folder>.</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
The result is that I can apply checkstyle to the currently selected file in the
IDE pressing Ctrl-Shift-F6 :)
The only drawback is that I have to use an existing standard IDE action in order
to map a ShortCut to this action. I've naturally chosen an action I do not
use: the "debug.test.single" which is associated with the Ctrl-Shift-F6
shortcut.
So what is my request? I would just want to create a custom action entry under
the <ide-actions> tag and link it with a custom action that could be created in
the IDE (I've looked at the menu Tools->Options->IDE Configuration->Look and
feel->Actions but found no way to create some). With this feature it would be
possible to launch any single-file ant target using a shortcut without using
the "existing action" workaround. It would be a simpler way to extend netbeans
than having to create a module for each simple task like this one I've talked
about.
Maybe this is already possible...
--
LAYAT Jérôme
www.hortis.ch - "La rencontre de l'Agilité et de l'Open-source" -
mobile +41 78 637 92 34
Admin/Contributeur www.xp-swiss.org
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.