<ide-actions>
[optional] binds predefined actions in the IDE GUI (e.g. Build
Project) to Ant targets of your choice. You can make simple bindings to actions
which take effect on the whole project, as well as "context-aware" bindings that
let you somehow process particular files which have been selected (in the
editor, Projects / Files tabs, etc.).
<action name="rebuild"> <script>${home}/build.xml</script> <target>clean</target> <target>build</target> <property name="set-from-ide">true</property> </action>
This binds the IDE action Clean and Build Project to targets in the Ant script
in ${home}/build.xml
. (Default script if not specified: build.xml
, i.e. at top
level in the project.) <target>
may be specified once, or several times (to run
in sequence), or not at all (to use the default target)—all as on the Ant
command line. You can use <property>
elements to pass some special definitions
to the target(s), just like -D
on the Ant command line.
<action name="debug.fix"> <target>debug-fix-nb</target> <context> <property>fix.file</property> <folder>src</folder> <pattern>\.java$</pattern> <format>relative-path-noext</format> <arity> <one-file-only/> </arity> </context> </action>
This binds the IDE action Fix (used by the debugger) to a target
debug-fix-nb
. It will be enabled for a selection consisting of one *.java
file
in the project’s src
subdirectory (the regular expression must match the
relative path, using /
as a separator, from the root folder); the path to the
source (in the format org/foo/pkg/Clazz
for a file src/org/foo/pkg/Clazz.java
)
will be passed to the target in the property named fix.file
.
The possible formats are:
absolute-path
absolute-path-noext
.ext
relative-path
/
separated)relative-path-noext
.ext
java-name
.
, e.g. org.foo.pkg.Clazz
Currently you can only pass one "context" property at a time, which can be cumbersome:
<action name="compile.single"> <target>compile-selected-files</target> <context> <property>includes</property> <folder>src</folder> <pattern>\.java$</pattern> <format>relative-path</format> <arity> <separated-files>,</separated-files> </arity> </context> </action>
This binds Compile Single to the target compile-selected-files
. It will be
enabled for one or more Java sources in src
. The context is equivalent to
calling command-line Ant something like this:
ant -Dincludes=org/foo/pkg/Clazz1.java,org/foo/pkg/Clazz2.java compile-selected-files
Currently you cannot have the action be enabled on a folder (or package):
Common examples of these configurations can be found online:
The Skeletal Project Template can also be used as a source of examples.
For certain commands, the IDE can set up basic bindings and Ant targets
automatically. For example, try selecting Compile File from the context menu
of a Java source in your project—if you do not already have a binding for
compile.single
, one will be created for you. (You may have to customize
the Ant target to exactly match your requirements, but at least you have a starting
point.) Similarly, you can try selecting Debug Project from the project’s
context menu to create a debug
binding. However, other IDE actions have
not yet been implemented: