Configuring the Display Name Format of Java Elements

See Also

You can configure the way that nodes in the IDE identify Java classes and their corresponding elements. This display name can include information such as:

To configure the display name of Java elements:

  1. Choose Tools > Options and click the Advanced Options button at the bottom of the Options window.
  2. Expand IDE Configuration > Look and Feel.
  3. Select the Java Elements node.

    The property sheet on the right side of the window shows properties for each of the six types of Java elements. (These elements are classes, constructors, 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 that is substituted.
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}

Here 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}

In this case, delimiter represents text that separates the parameters.

For example, for methods, you could set the display name format to:
{n} {p, (,),", "}
The effect is 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
Projects Window
Files Window
Working with Unknown File Extensions

Legal Notices