To get more information on classes from the com.install4j.* packages, please choose Help->Show Javadoc Overview from the menu and read the the help topic for the install4j API. In addition, the Java code editor offers a code gallery that contains useful snippets that show you how to get started with using the install4j API. The code gallery is invoked from the tool bar or by choosing Code->Insert from Code gallery from the menu.
A number of packages can be used with using fully-qualified class names. Those packages are:
You can put a number of import statements as the first lines in the text area in order to avoid using fully qualified class names.
Example: !context.isUnattended() && !context.isConsole()
The above example would work as the condition expression of an action and skip the action for unattended or console installations.
Example: if (!context.getBooleanVariable("enterDetails")) context.goForward(2, true, true); return true;
The above example would work as the validation expression of a screen and skip two screens forward (checking the conditions of the target screen as well as executing the actions of the current screen) if the variable with name "enterDetails" is not set to "true".
install4j detects automatically whether you have entered an expression or a script.
Apart from the context, the action, screen or form component to which the Java code property belongs is among the available parameters. If you know the actual class, you can cast to it and modify the object as needed.
CTRL-Space
brings up a popup with code completion proposals. Also, typing
a dot (".") shows this popup after a delay if no other character is typed.
While the popup is displayed, you can continue to type or delete characters with Backspace
and
the popup will be updated accordingly. "Camel-hump completion" is supported, i.e. typing NPE and
hitting CTRL-Space
will propose NullPointerException among other classes.
If you accept a class that is not automatically imported, the fully qualified name will be inserted.
The completion popup can suggest:
You can configure code completion behavior in the Java editor settings.
The status indicator at the top of the right gutter is
You can configure the threshold for problem analysis in the Java editor settings.
SHIFT-F1
opens the browser at the Javadoc page that describes the element at the cursor
position. If no corresponding Javadoc can be found, a warning message is displayed. Javadoc for the
Java runtime library can only be displayed if a design time JDK is configured
and a valid Javadoc location is specified in the design time JDK configuration.
You can set the design time JDK in the Java editor settings
All key bindings in the Java code editor are configurable. Choose Settings->Key Map to display the Key map editor.
${installer:myVariableName}
.