New statements: A simple example is hitting Ctrl+Space without having entered anything, as shown below.
The completion list contains the member fields (for example, appFeat or
model) and member methods (for example,
callGuiCommand) that can be called. You can select a completion in two ways:
Partial statements: If you enter the beginning of a variable, field, or method name and press Ctrl+Space, the suggested completions are shown.
Only variables that match the prefix ra are shown. This example shows that local variables also appear in the completion suggestions.
Class members: If you enter a variable or expression that resolves to a known Java class for the model object, then you can get completion suggestions for the members in the class, as shown below.
Class members in assignments and declarations: In assignments and variable declarations, the expected type can be used to filter the list of completions. Only completions that have the same type declared on the left side of the assignment statement are shown.
Tags in the model object: When the expression to complete can be resolved to a concrete entity in the embedded model, completions are available for the methods in the model object API that take a first argument that is a tag in a list, as shown.
The list above comes from an application whose embedded model contains two plot groups (pg1 and
pg2). The completion list contains both the tags and the names of the corresponding plot groups. To transfer only the tag to the code, choose a completion in the list and then press Tab.
Types in the model object when creating new entities: When the expression to complete can be resolved to a concrete entity in the embedded model, completions are available for operation types in the model object when creating a new node.
Property names: When the expression to complete can be resolved to a concrete entity in the embedded model, completions are available for property names used as first arguments to the
get and
set operations. These are available for most features in the model object.
The example above shows the properties that are available for the plot group pg1 in the embedded model. If you select an entry in the list, you see the property’s description and its data type. When available, you may also see a link to the documentation and a set of allowed values. The allowed values appear if the set of allowed values is a finite array of strings.
Property values: When the expression to complete can be resolved to a concrete entity in the embedded model, completions are available for property values used as second arguments in the
set operations that are available for most features in the model object.
If you hover over the same property’s model entity name, "gev1" in this case, you see the following tooltip with information about the purpose of the model entity.
For variables defined under Declarations in the Application Builder tree, the variable’s description appears as the tooltip when you hover above them. In this case, it is the string variable
inXpolRatio.
For shortcuts to form objects, also defined under Declarations, the description and the corresponding Java code appear in the tooltip. In this case, it is for the shortcut with the name
labelinXpolRatio.
In the Methods part of the
Preferences dialog box, you can specify options for code generation and completion.
The Close brackets automatically check box is selected by default. The software then automatically inserts a corresponding closing bracket if you type a
{,
[, or
( character. Clear the check box to disable the addition of closing brackets.
The Generate compact code using 'with' statements check box is selected by default. The generated code uses
with statements to set a target to use with the coming calls to
set(),
setIndex(),
getString(), and so on, which makes the code more compact. Clear the check box if you prefer to use the full code without the use of
with statements.