Created
February 16, 2017 17:20
-
-
Save valeriocos/b487e48ec57f06bd2f7583edc244e09b to your computer and use it in GitHub Desktop.
SampleDialog SWT with ISWTObservableValue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleDialog extends Dialog { | |
private DataBindingContext context = new DataBindingContext(); | |
public SampleDialog(Shell parentShell) { | |
super(parentShell); | |
} | |
@Override | |
protected Control createDialogArea(Composite parent) { | |
Composite container = (Composite) super.createDialogArea(parent); | |
Button button = new Button(container, SWT.CHECK); | |
button.setText("Show hidden controls"); | |
Label label = new Label(container, SWT.NONE); | |
label.setText("Sample label"); | |
ISWTObservableValue buttonObservable = WidgetProperties.selection().observe(button); | |
ISWTObservableValue labelObservable = WidgetProperties.visible().observe(label); | |
context.bindValue(labelObservable, buttonObservable); | |
return container; | |
} | |
@Override | |
protected void configureShell(Shell newShell) { | |
super.configureShell(newShell); | |
newShell.setText("Selection dialog"); | |
} | |
@Override | |
protected Point getInitialSize() { | |
return new Point(450, 300); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment