本文整理汇总了Java中org.eclipse.jface.databinding.swt.WidgetProperties类的典型用法代码示例。如果您正苦于以下问题:Java WidgetProperties类的具体用法?Java WidgetProperties怎么用?Java WidgetProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WidgetProperties类属于org.eclipse.jface.databinding.swt包,在下文中一共展示了WidgetProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupBindings
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void setupBindings() {
// Final property binding
if (null != finalAnnotationBox) {
@SuppressWarnings("unchecked")
IObservableValue<Boolean> finalValue = BeanProperties
.value(N4JSClassWizardModel.class, N4JSClassWizardModel.FINAL_ANNOTATED_PROPERTY)
.observe(model);
@SuppressWarnings("unchecked")
IObservableValue<Boolean> finalUI = WidgetProperties.selection().observe(finalAnnotationBox);
getDataBindingContext().bindValue(finalUI, finalValue);
}
// n4js annotation property binding
@SuppressWarnings("unchecked")
IObservableValue<Boolean> n4jsValue = BeanProperties
.value(N4JSClassWizardModel.class, N4JSClassifierWizardModel.N4JS_ANNOTATED_PROPERTY)
.observe(model);
@SuppressWarnings("unchecked")
IObservableValue<Boolean> n4jsUI = WidgetProperties.selection().observe(n4jsAnnotationBox);
getDataBindingContext().bindValue(n4jsUI, n4jsValue);
}
示例2: createVendorIdControls
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void createVendorIdControls(DataBindingContext dbc, Composite parent) {
final Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Label vendorIdLabel = new Label(composite, SWT.NONE);
vendorIdLabel.setText("Vendor id:");
Text vendorIdText = new Text(composite, SWT.BORDER);
vendorIdText.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create());
projectInfo.addPropertyChangeListener(event -> {
if (event.getPropertyName().equals(N4MFProjectInfo.VENDOR_ID_PROP_NAME)) {
setPageComplete(validatePage());
}
});
dbc.bindValue(WidgetProperties.text(Modify).observe(vendorIdText),
BeanProperties.value(N4MFProjectInfo.class, N4MFProjectInfo.VENDOR_ID_PROP_NAME).observe(projectInfo));
}
示例3: createStandardLinkText
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
public void createStandardLinkText ( final Composite parent, final String linkFactory, final String attributeName, final String label, final String textMessage, final ConfigurationEditorInput input, final Object valueType )
{
this.toolkit.createLabel ( parent, label + ":" );
final Text text = this.toolkit.createText ( parent, "" );
text.setMessage ( textMessage );
text.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, true ) );
text.setToolTipText ( textMessage );
final IObservableValue value = Observables.observeMapEntry ( input.getDataMap (), attributeName, valueType );
this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );
final Hyperlink link = this.toolkit.createHyperlink ( parent, "link", SWT.NONE );
link.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, false, false ) );
link.addHyperlinkListener ( new HyperlinkAdapter () {
@Override
public void linkActivated ( final HyperlinkEvent e )
{
EditorHelper.handleOpen ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getActivePage (), input.getConnectionUri (), linkFactory, text.getText () );
}
} );
}
示例4: createStandardCombo
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
public void createStandardCombo ( final Composite parent, final String attributeName, final String label, final String[] items, final IObservableMap data, final Object valueType )
{
this.toolkit.createLabel ( parent, label + ":" );
final Combo combo = new Combo ( parent, SWT.DROP_DOWN );
combo.setItems ( items );
this.toolkit.adapt ( combo );
final GridData gd = new GridData ( GridData.FILL, GridData.BEGINNING, true, true );
gd.horizontalSpan = 2;
combo.setLayoutData ( gd );
final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType );
this.dbc.bindValue ( WidgetProperties.text ().observe ( combo ), value );
}
示例5: createComposite
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
@PostConstruct
public void createComposite(Composite parent) {
GridLayoutFactory.fillDefaults().applyTo(parent);
Checkbox checkbox = new Checkbox(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(checkbox);
checkbox.setSelection(true);
checkbox.setText("Custom checkbox with databinding");
Label label = new Label(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(label);
DataBindingContext dbc = new DataBindingContext();
IObservableValue checkboxProperty = CustomWidgetProperties.selection().observe(checkbox);
ISWTObservableValue labelProperty = WidgetProperties.text().observe(label);
dbc.bindValue(labelProperty, checkboxProperty);
Button checkButton = new Button(parent, SWT.CHECK);
checkButton.setSelection(true);
checkButton.setText("Usual SWT check button");
}
示例6: bind
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void bind(IWidgetValueProperty prop, String expr) {
Object dataContext = findTagged(DATA_CONTEXT, null);
Binder dbc = findTagged(Binder.class);
ISWTObservableValue observableValue = prop.observe(control());
org.eclipse.core.databinding.Binding binding = dbc.bind(observableValue, dataContext, expr);
if (binding == null) {
// no observables have been parsed, just use the value
prop.setValue(control(), expr);
} else {
// set non editable if this was a multi binding
if (binding.getModel() instanceof ComputedValue) {
try {
WidgetProperties.editable().setValue(control(), false);
} catch (Exception e) {
// ignore, not a supported editable widget
}
}
}
}
示例7: initializeRoleDescBindings
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private DataBindingContext initializeRoleDescBindings(BTSDBCollectionRoleDesc dBRoleDesc)
{
getEditingDomain(dBRoleDesc);
if (dbRoleDesc_bindingContext != null)
{
dbRoleDesc_bindingContext.dispose();
}
DataBindingContext bindingContext = new DataBindingContext();
// db collection name - cannot be changed
IObservableValue model_na = EMFProperties.value(BtsmodelPackage.Literals.BTSDB_COLLECTION_ROLE_DESC__ROLE_NAME)
.observe(dBRoleDesc);
bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, roles_rolesDesc_name_text),
model_na, null, null);
return bindingContext;
}
示例8: initCustomDataBindings
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void initCustomDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
UpdateValueStrategy defaultStrategy = new UpdateValueStrategy();
IObservableValue<String> observedNewName = WidgetProperties.text(SWT.Modify).observe(textNewName);
IObservableValue<String> observedNewAlias = new WritableValue<String>("", String.class);
if (aliasIsAvailable) {
observedNewAlias = WidgetProperties.text(SWT.Modify).observe(textNewAlias);
}
MultiValidator nameAndAliasValidator = new NameAndAliasValidator(observedNewName, observedNewAlias,
elementNameMightBeEmpty);
bindingContext.addValidationStatusProvider(nameAndAliasValidator);
IObservableValue<String> validatedNewName = nameAndAliasValidator.observeValidatedValue(observedNewName);
IObservableValue<String> validatedNewAlias = nameAndAliasValidator.observeValidatedValue(observedNewAlias);
bindingContext.bindValue(validatedNewName, newName, defaultStrategy, defaultStrategy);
bindingContext.bindValue(validatedNewAlias, newAlias, defaultStrategy, defaultStrategy);
aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
aggregatedStatus.addChangeListener(aggregatedStatusListener);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:RenameUMLElementRefactoringWizardUserPageComposite.java
示例9: initDataBindings
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeSelectionScaleObserveWidget = WidgetProperties.selection().observe(scale);
IObservableValue observeSelectionSpinnerObserveWidget = WidgetProperties.selection().observe(spinner);
bindingContext.bindValue(observeSelectionScaleObserveWidget, observeSelectionSpinnerObserveWidget, null, null);
//
IObservableValue observeMaxScaleObserveWidget = WidgetProperties.maximum().observe(scale);
IObservableValue sizeLogObserveValue = BeanProperties.value("size").observe(log);
bindingContext.bindValue(observeMaxScaleObserveWidget, sizeLogObserveValue, null,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
//
IObservableValue observeMaxSpinnerObserveWidget = WidgetProperties.maximum().observe(spinner);
// IObservableValue sizeLogObserveValue = BeanProperties.value("size").observe(log);
bindingContext.bindValue(observeMaxSpinnerObserveWidget, sizeLogObserveValue, null,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
return bindingContext;
}
示例10: addSshComboDataBinding
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void addSshComboDataBinding(ArrayList<SshProfileModel> profileList) {
// bind sshmodellist to combobox content
WritableList input = new WritableList(profileList, SshProfileModel.class);
this.statusModel.setWritableProfileList(input);
ComboViewer cv = this.editor.getSshComboViewer();
ViewerSupport.bind(cv, input, BeanProperties.values(new String[] { Constants.PROFILE_NAME_MODEL }));
// bind selectionIndex to model
// selectionIndex == profileListIndex, use it to match selection to
// actual model
IObservableValue selection = WidgetProperties.singleSelectionIndex().observe(cv.getCombo());
IObservableValue modelValue = BeanProperties.value(UiStatusModel.class, Constants.SSH_COMBO_SELECTION_INDEX)
.observe(this.statusModel);
if (!input.isEmpty())
cv.getCombo().select(0);
this.ctx.bindValue(modelValue, selection);
}
示例11: addTableDataBinding
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void addTableDataBinding(ArrayList<LaunchConfigurationModel> modelList) {
WritableList input = new WritableList(modelList, LaunchConfigurationModel.class);
this.statusModel.setWritableModelList(input);
ViewerSupport
.bind(this.editor.getTableViewer(), input,
BeanProperties.values(new String[] { Constants.LaunchName, Constants.APP_NAME_MODEL,
Constants.APP_RUNNING_MODEL, Constants.PLATFORM_MODEL,
Constants.CLIENT_CONTROLLER_MODEL, Constants.PORT_MODEL, Constants.FLAG_BACKEND, Constants.FLAG_APP }));
// bind selectionIndex to model
// selectionIndex == profileListIndex, use it to match selection to
// actual model
IObservableValue selection = WidgetProperties.singleSelectionIndex()
.observe(this.editor.getTableViewer().getTable());
IObservableValue modelValue = BeanProperties.value(UiStatusModel.class, Constants.LAUNCH_TABLE_INDEX)
.observe(this.statusModel);
this.ctx.bindValue(modelValue, selection);
}
示例12: addDataBinder
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void addDataBinder(Widget toObserve, IValidator validator, Class<?> observableClass,
String propertyName, Object observedProperty, boolean textDecorationEnabled) {
IObservableValue textObservable = WidgetProperties.text(SWT.Modify).observe(toObserve);
UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setBeforeSetValidator(validator);
ValidationStatusProvider binding = this.ctx.bindValue(textObservable,
PojoProperties.value(observableClass, propertyName).observe(observedProperty), strategy,
null);
if (textDecorationEnabled) {
ControlDecorationSupport.create(binding, SWT.LEFT);
}
final IObservableValue errorObservable = WidgetProperties.text()
.observe(this.addDialog.getErrorLabel());
ctx.bindValue(errorObservable, new AggregateValidationStatus(ctx.getBindings(),
AggregateValidationStatus.MAX_SEVERITY),
null, null);
}
示例13: bindClusteredComputingEnvironment
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void bindClusteredComputingEnvironment (DataBindingContext bindingContext)
{
bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observe(txtInitialSize),
EMFProperties.value(DeploymentPackage.Literals.CLUSTERED_COMPUTING_ENVIRONMENT__SIZE).observeDetail(valueComputingEnvironment)
);
// Scheduling policy (enum!)
cvLoadBalancer.setContentProvider(ArrayContentProvider.getInstance());
cvLoadBalancer.setInput(SchedulingPolicy.VALUES);
bindingContext.bindValue(
ViewerProperties.singleSelection().observe(cvLoadBalancer),
EMFProperties.value(DeploymentPackage.Literals.CLUSTERED_COMPUTING_ENVIRONMENT__LOAD_BALANCER).observeDetail(valueComputingEnvironment)
);
}
示例14: bindComputingResourceDescriptor
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
private void bindComputingResourceDescriptor (EMFDataBindingContext bindingContext) {
bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observe(txtCpu),
EMFProperties.value(SpecificationPackage.Literals.COMPUTING_RESOURCE_DESCRIPTOR__CPU).observeDetail(valueComputingResourceDescriptor)
);
bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observe(txtCores),
EMFProperties.value(SpecificationPackage.Literals.COMPUTING_RESOURCE_DESCRIPTOR__CPU_UNITS).observeDetail(valueComputingResourceDescriptor)
);
bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observe(txtMemory),
EMFProperties.value(SpecificationPackage.Literals.COMPUTING_RESOURCE_DESCRIPTOR__MEMORY).observeDetail(valueComputingResourceDescriptor)
);
bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observe(txtStorage),
EMFProperties.value(SpecificationPackage.Literals.COMPUTING_RESOURCE_DESCRIPTOR__STORAGE).observeDetail(valueComputingResourceDescriptor)
);
}
示例15: createDataBindings
import org.eclipse.jface.databinding.swt.WidgetProperties; //导入依赖的package包/类
protected void createDataBindings(SensidlProjectDTO sensidlProjectDTO) {
DataBindingContext bindingContext = new DataBindingContext();
UpdateValueStrategy strategyAtomicStringToModel = new UpdateValueStrategy();
strategyAtomicStringToModel.setAfterGetValidator(new NonEmptyStringValidator());
UpdateValueStrategy strategyAtomicStringToTarget = new UpdateValueStrategy();
IObservableValue observeTextTxtSensidlFileNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSensidlFileName);
IObservableValue atomicValidatedProjectName = new WritableValue(null, String.class);
bindingContext.bindValue(observeTextTxtSensidlFileNameObserveWidget, atomicValidatedProjectName, strategyAtomicStringToModel, strategyAtomicStringToTarget);
IObservableValue model = BeanProperties.value("sensidlFileName").observe(sensidlProjectDTO);
bindingContext.bindValue(observeTextTxtSensidlFileNameObserveWidget, model);
aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
aggregatedStatus.addChangeListener(sensidlProjectStatusListener);
}