Java Reference
In-Depth Information
Table 13.3
Macros enable contextual scripting of repeatable operations.
(continued)
Category
Macro
Description
Miscellaneous
ColumnNumber
Column number of the cursor in the editor
LineNumber
Line number of the cursor in the editor
Prompt
Displays a string input dialog used to complete the macro
When you're selecting a macro, the
Macro preview
area shows you what
the macro will evaluate to under the current circumstances. For this rea-
son, it's best to configure your external tools while operating under cir-
cumstances like those in which you expect to use it.
TIP
Prompting the user for values
Although most of the macros replace themselves with a value derived from the
project or selected file, one macro behaves differently. The
Prompt
macro prompts
you for its value when you execute the tool. If you have multiple
Prompt
macros,
you're asked to supply a macro for each. Unfortunately, you have no control over
the message displayed when you're prompted for a value; it always asks you
vaguely to
Enter parameters
. Nevertheless, the
Prompt
macro is handy for call pro-
grams whose arguments must change regularly or when you don't want to include
sensitive information in your tool settings, such as a database password.
13.4.2
Accessing external tools from within IDEA
Once you've configured a set of tools within
IDEA
, you need to define how those
tools will be launched. Typically, external tools are accessed either via a menu
option or by a user-defined keyboard shortcut.
Adding your tools to IDEA's menus
To access your tools, add them to one or more of
IDEA
's menus by selecting the
appropriate options from the
Menu
options listed in the
Edit Tool
panel. If
you've specified groups for your tools, they're arranged in submenus by group
name. Any commands that aren't part of group appear as top-level menu items.
The order of the items in the menu is determined by the order in which the tools
appear in the External Tools settings. To change their order, bring up the Exter-
nal Tools settings, select a tool entry, and use the
Move Up
and
Move Down
but-
tons to reorder the entries. (If you don't add your tool to any of the menus, the
only way to run the tool is through keyboard shortcuts, as described next.) The
available menu options are as follows: