Preferences - Code Parsing

This page is used to control various Code Parsing options.

Designer supports special comment tags that can be used to hide code from its parser. This can be useful, if you need to add some complex dynamic code to your layout that can't be parsed by Designer. You can also use a special end-of-line comment to hide a single line of code (e.g., a single attribute of a widget).

Begin hidden code block tag

This preference determines the comment text used to designate the beginning of a hidden block of code.

End hidden code block tag

This preference determines the comment text used to designate the end of a hidden block of code.

Single hidden code line tag

This preference determines the end-of-line comment text used to hide a single line of code.

Example

Give the following simple example window, placing a pair of hide tags around the checkbox widget will hide it from the parser and it will not show up in the design view.

public class DesignerTest {

    private static Text text;
    private static Button checkbox;
    private static Button button;
    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell();
        shell.setText("SWT Application");

        button = new Button(shell, SWT.NONE);
        button.setBounds(20, 20, 130, 60);
        button.setText("button");

        //$hide>>$
        checkbox = new Button(shell, SWT.CHECK);
        checkbox.setBounds(70, 100, 140, 40);
        checkbox.setText("check button");
        //$hide<<$

        text = new Text(shell, SWT.BORDER);
        text.setBounds(130, 160, 130, 50);

        shell.open();
        while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
        }
    }
}

Without the hide tags, the window looks like the left image; with the tags, it looks like the right image:

 

Default value for unparsed string properties

This preference determines the string used for unparsed string properties.

Evaluate complex expressions

This preference determines whether complex expressions are evaluated when Designer is parsing a window. This option is normally on which allows Designer to more accurately render a window at design time. Turn this option off, if your window included complex expressions that can't be evaluated properly at design time. You can control this on a line-by-line basis by using the code hiding tags described above.

Reparse after custom component change

This preference determines whether Designer reparses the current class any time a custom component used in the class is changed. This option ensures that the design view accurately reflects the layout of the current window and its embedded components. Turning this option off can reduce memory usage and increase response time.

Check indirect custom components dependencies

This preference determines whether Designer checks indirect custom component dependencies. Turning this option off can reduce memory usage and increase response time.