Configuring the Display Name Format of Java Elements

You can configure what information is given on nodes in the Explorer to identify Java classes and their corresponding methods and fields. This display name can include type (for fields), return type and parameters (for methods and constructors), interfaces implemented, and other types of information.

To configure the display name of Java elements:

  1. Choose Tools and choose Options.
  2. In the Options window, expand the IDE Configuration node, and expand the Look and Feel node.
  3. Select the Java Elements node.

    The property sheet on the right side of the window shows properties for six Java elements -- classes, constructors, and fields, initializers, interfaces, and methods.

  4. On the property sheet, type a combination of plain text and substitution codes to set the display format for each element. See the following table for a key to the available substitution codes.
  5. Restart the IDE to enact the new display name format.

The following table lists the available substitution codes and the information the codes substitute:
Substitution Code Information Substituted
{m}Modifiers (for all elements except initializers).
{n}Name (for all elements except initializers).
{C}Name with all outerclasses (for classes and interfaces only).
{f}Full name including the package (for classes).
{t}Type (for fields only).
{r}Return type (for methods and constructors).
{s}Superclass (for classes only).
{c}Returns static for static initializers (for initializers only).
{p}Parameters with types but not variable names (for constructors and methods).
{a}Parameters with types and names (for constructors and methods).
{i}Interfaces implemented or extended (for classes and interfaces only).
{e}Exceptions (for constructors and methods only).
<initializer>Initializer.

Advanced Substitution Formats

You can also use advanced substitution formats with these substitution codes to display text conditionally.

For simple arguments that do not contain a list of items, you can use the following substitution format:

{SubstitutionCode,prefix,suffix}
where prefix represents a string to appear before the element name and suffix represents a string to appear after it. If there is nothing to replace the substitution code with, the prefix and suffix parameters are ignored. If you want to use a comma in the prefix or suffix, enclose the string in double quote (") marks.

For example, to display information about exceptions on method nodes, you could use the expression:

{n} {e, throws, }
If the method does not contain exception code, only the method name is displayed. If there is exception code, the following is displayed:
methodName throws exceptionName

For the {p}, {a}, {i}, and {e} codes, which can represent multiple parameters, you can use the following substitution format:

{SubstitutionCode,prefix,suffix,delimiter}
where delimiter represents text that separates the parameters.

For example, for methods, you could set the display name format to
{n} {p, (,),", "}
to display the method name and then the parameters of the method in parentheses. If there is more than one parameter, the parameters are delimited with commas. If there are no parameters, only the method name is displayed.

See also
Managing Objects in the IDE
The Explorer

Legal Notices