use of org.eclipse.core.databinding.DataBindingContext in project meclipse by flaper87.
the class FilterWizardPage method createControl.
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.FILL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
GridData gd = new GridData(SWT.FILL);
gd.widthHint = 250;
Label label;
label = new Label(container, SWT.NULL);
label.setText(getCaption("filterWizard.label.name"));
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.setLayoutData(gd);
label = new Label(container, SWT.NULL);
label.setImage(help);
label.setToolTipText(getCaption("filterWizard.tooltip.name"));
label = new Label(container, SWT.NULL);
label.setText(getCaption("filterWizard.label.query"));
queryText = new Text(container, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.FILL);
queryText.setLayoutData(gd);
label = new Label(container, SWT.NULL);
label.setToolTipText(getCaption("filterWizard.tooltip.query"));
label.setImage(help);
// add WizardPage validators
DataBindingContext dbc = new DataBindingContext();
WizardPageSupport.create(this, dbc);
dbc.bindValue(SWTObservables.observeText(nameText, SWT.Modify), nameValue, new UpdateValueStrategy().setBeforeSetValidator(new FilterNameValidator()), null);
dbc.bindValue(SWTObservables.observeText(queryText, SWT.Modify), queryValue, new UpdateValueStrategy().setBeforeSetValidator(new JSONValidator()), null);
setControl(container);
// disable save until everything matches
setPageComplete(false);
}
use of org.eclipse.core.databinding.DataBindingContext in project translationstudio8 by heartsome.
the class NewTermDbBaseInfoPage method initDataBindings.
protected void initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
WizardPageSupport.create(this, bindingContext);
IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(dbNameText);
final IObservableValue dbNameModelValue = BeanProperties.value("dbName").observe(dbModel);
bindingContext.bindValue(widgetValue, dbNameModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText);
final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(dbModel);
bindingContext.bindValue(widgetValue, instanceModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText);
final IObservableValue hostModelValue = BeanProperties.value("host").observe(dbModel);
bindingContext.bindValue(widgetValue, hostModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(portText);
final IObservableValue protModelValue = BeanProperties.value("port").observe(dbModel);
bindingContext.bindValue(widgetValue, protModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText);
final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(dbModel);
bindingContext.bindValue(widgetValue, locationModelValue, null, null);
//
widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText);
final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(dbModel);
bindingContext.bindValue(widgetValue, usernameModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText);
final IObservableValue passwordModelValue = BeanProperties.value("password").observe(dbModel);
bindingContext.bindValue(widgetValue, passwordModelValue, null, null);
MultiValidator myValidator = new MultiValidator() {
@Override
protected IStatus validate() {
dbNameModelValue.getValue();
instanceModelValue.getValue();
hostModelValue.getValue();
protModelValue.getValue();
locationModelValue.getValue();
usernameModelValue.getValue();
passwordModelValue.getValue();
return validator();
}
};
bindingContext.addValidationStatusProvider(myValidator);
}
use of org.eclipse.core.databinding.DataBindingContext in project translationstudio8 by heartsome.
the class NewTmDbBaseInfoPage method initDataBindings.
protected void initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
WizardPageSupport.create(this, bindingContext);
IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(dbNameText);
final IObservableValue dbNameModelValue = BeanProperties.value("dbName").observe(dbModel);
bindingContext.bindValue(widgetValue, dbNameModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText);
final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(dbModel);
bindingContext.bindValue(widgetValue, instanceModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText);
final IObservableValue hostModelValue = BeanProperties.value("host").observe(dbModel);
bindingContext.bindValue(widgetValue, hostModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(portText);
final IObservableValue protModelValue = BeanProperties.value("port").observe(dbModel);
bindingContext.bindValue(widgetValue, protModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText);
final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(dbModel);
bindingContext.bindValue(widgetValue, locationModelValue, null, null);
//
widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText);
final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(dbModel);
bindingContext.bindValue(widgetValue, usernameModelValue, null, null);
widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText);
final IObservableValue passwordModelValue = BeanProperties.value("password").observe(dbModel);
bindingContext.bindValue(widgetValue, passwordModelValue, null, null);
MultiValidator myValidator = new MultiValidator() {
@Override
protected IStatus validate() {
dbNameModelValue.getValue();
instanceModelValue.getValue();
hostModelValue.getValue();
protModelValue.getValue();
locationModelValue.getValue();
usernameModelValue.getValue();
passwordModelValue.getValue();
return validator();
}
};
bindingContext.addValidationStatusProvider(myValidator);
}
use of org.eclipse.core.databinding.DataBindingContext in project eclipse-pmd by acanda.
the class AddRuleSetConfigurationWizardPage method initDataBindings.
private DataBindingContext initDataBindings() {
final DataBindingContext bindingContext = new DataBindingContext();
//
final IObservableValue locationObserveText = SWTObservables.observeDelayedValue(200, SWTObservables.observeText(location, SWT.Modify));
final IObservableValue locationObserveValue = BeansObservables.observeValue(controller.getModel(), "location");
bindingContext.bindValue(locationObserveText, locationObserveValue, null, null);
//
final ObservableListContentProvider rulesContentProvider = new ObservableListContentProvider();
final IObservableMap rulesObserveMap = PojoObservables.observeMap(rulesContentProvider.getKnownElements(), Rule.class, "name");
tableViewer.setLabelProvider(new ObservableMapLabelProvider(rulesObserveMap));
tableViewer.setContentProvider(rulesContentProvider);
//
final IObservableList rulesObserveList = BeansObservables.observeList(Realm.getDefault(), controller.getModel(), "rules");
tableViewer.setInput(rulesObserveList);
//
final IObservableValue nameObserveTextObserveWidget = SWTObservables.observeDelayedValue(100, SWTObservables.observeText(name, SWT.Modify));
final IObservableValue controllergetModelNameObserveValue = BeansObservables.observeValue(controller.getModel(), "name");
bindingContext.bindValue(nameObserveTextObserveWidget, controllergetModelNameObserveValue, null, null);
//
final IObservableValue observeVisibleBrowseObserveWidget = WidgetProperties.visible().observe(browse);
final IObservableValue browseEnabledControllergetModelObserveValue = BeanProperties.value("browseEnabled").observe(controller.getModel());
bindingContext.bindValue(observeVisibleBrowseObserveWidget, browseEnabledControllergetModelObserveValue, null, null);
//
return bindingContext;
}
use of org.eclipse.core.databinding.DataBindingContext in project eclipse-pmd by acanda.
the class SelectConfigurationTypeWizardPage method initDataBindings.
private DataBindingContext initDataBindings() {
final DataBindingContext bindingContext = new DataBindingContext();
//
final IObservableValue workspaceTypeView = WidgetProperties.selection().observe(workspaceRadioButton);
final IObservableValue workspaceTypeModel = BeanProperties.value("workspaceTypeSelected").observe(controller.getModel());
bindingContext.bindValue(workspaceTypeView, workspaceTypeModel, null, null);
//
final IObservableValue projectTypeView = WidgetProperties.selection().observe(projectRadioButton);
final IObservableValue projectTypeModel = BeanProperties.value("projectTypeSelected").observe(controller.getModel());
bindingContext.bindValue(projectTypeView, projectTypeModel, null, null);
//
final IObservableValue fileSystemTypeView = WidgetProperties.selection().observe(fileSystemRadioButton);
final IObservableValue fileSystemTypeModel = BeanProperties.value("fileSystemTypeSelected").observe(controller.getModel());
bindingContext.bindValue(fileSystemTypeView, fileSystemTypeModel, null, null);
//
final IObservableValue observeSelectionRemoteRadioButtonObserveWidget = WidgetProperties.selection().observe(remoteRadioButton);
final IObservableValue remoteTypeSelectedControllergetModelObserveValue = BeanProperties.value("remoteTypeSelected").observe(controller.getModel());
bindingContext.bindValue(observeSelectionRemoteRadioButtonObserveWidget, remoteTypeSelectedControllergetModelObserveValue, null, null);
//
return bindingContext;
}
Aggregations