There are a couple of exceptions to the conditional rule. The parser will parse into conditions where the conditional test is hard coded to
true (as in your example) or does a simple
Beans.isDesignTime() test (which is true at design time and false at runtime).
You can also use
code hiding tags to change what gets displayed. The following, for example, will cause the second button to be displayed rather than the first:
- Code: Select all
protected void createContents() {
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT Application");
if (true) { //$hide>>$
final Button button = new Button(shell, SWT.NONE);
button.setText("button");
button.setBounds(158, 156, 54, 29);
} else { //$hide<<$
final Button button_1 = new Button(shell, SWT.NONE);
button_1.setText("button_1");
button_1.setBounds(158, 221, 54, 29);
}
}