本文整理汇总了Java中org.eclipse.core.databinding.DataBindingContext类的典型用法代码示例。如果您正苦于以下问题:Java DataBindingContext类的具体用法?Java DataBindingContext怎么用?Java DataBindingContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataBindingContext类属于org.eclipse.core.databinding包,在下文中一共展示了DataBindingContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void createControl(Composite parent) {
Composite listComposite = new Composite(parent, NONE);
listComposite.setLayout(new FillLayout());
ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI);
projectListViewer.setContentProvider(ArrayContentProvider.getInstance());
projectListViewer.setInput(getNonTestProjects());
// Data binding
DataBindingContext databindingContext = new DataBindingContext();
parent.addDisposeListener(e -> databindingContext.dispose());
databindingContext.bindList(ViewersObservables.observeMultiSelection(projectListViewer),
PojoProperties.list(N4MFProjectInfo.class, N4MFProjectInfo.TESTED_PROJECT_PROP_NAME)
.observe(projectInfo));
setControl(listComposite);
}
示例2: createVendorIdControls
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的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: initTestProjectUI
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
private Composite initTestProjectUI(DataBindingContext dbc, Composite parent) {
// Additional test project options
final Group testProjectOptionsGroup = new Group(parent, NONE);
testProjectOptionsGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
final Button createTestGreeterFileButton = new Button(testProjectOptionsGroup, CHECK);
createTestGreeterFileButton.setText("Create a test project greeter file");
final Button addNormalSourceFolderButton = new Button(testProjectOptionsGroup, CHECK);
addNormalSourceFolderButton.setText("Also create a non-test source folder");
Label nextPageHint = new Label(testProjectOptionsGroup, NONE);
nextPageHint.setText("The projects which should be tested can be selected on the next page");
nextPageHint.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
initTestProjectBinding(dbc, addNormalSourceFolderButton, createTestGreeterFileButton);
return testProjectOptionsGroup;
}
示例4: bind
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
public static Collection<Binding> bind ( final DataBindingContext dbc, final IObservableValue lineInputObservable, final IObservableValue linePropertiesObservable )
{
final Collection<Binding> result = new LinkedList<Binding> ();
try
{
result.add ( dbc.bindValue ( PojoObservables.observeDetailValue ( lineInputObservable, "lineWidth", null ), EMFObservables.observeDetailValue ( dbc.getValidationRealm (), linePropertiesObservable, ChartPackage.Literals.LINE_PROPERTIES__WIDTH ) ) ); //$NON-NLS-1$
result.add ( dbc.bindValue ( PojoObservables.observeDetailValue ( lineInputObservable, "lineColor", null ), EMFObservables.observeDetailValue ( dbc.getValidationRealm (), linePropertiesObservable, ChartPackage.Literals.LINE_PROPERTIES__COLOR ) ) ); //$NON-NLS-1$
}
catch ( final Exception e )
{
logger.warn ( "Failed to bind line properties", e ); //$NON-NLS-1$
}
return result;
}
示例5: ButtonProfileEntry
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
public ButtonProfileEntry ( final DataBindingContext dbc, final Composite parent, final ProfileManager profileManager, final Profile profile, final ChartContext chartContext )
{
super ( dbc, profileManager, profile, chartContext );
this.widget = new Button ( parent, SWT.TOGGLE );
addBinding ( dbc.bindValue ( SWTObservables.observeText ( this.widget ), EMFObservables.observeValue ( profile, ChartPackage.Literals.PROFILE__LABEL ) ) );
this.widget.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
fireSelection ( ButtonProfileEntry.this.widget.getSelection () );
};
} );
}
示例6: InputManager
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
public InputManager ( final DataBindingContext dbc, final ChartViewer viewer, final ResourceManager resourceManager, final AxisLocator<XAxis, XAxisViewer> xLocator, final AxisLocator<YAxis, YAxisViewer> yLocator )
{
this.list = new WritableList ( dbc.getValidationRealm () );
this.dbc = dbc;
this.viewer = viewer;
this.resourceManager = resourceManager;
this.xLocator = xLocator;
this.yLocator = yLocator;
this.list.addListChangeListener ( this.listener = new IListChangeListener () {
@Override
public void handleListChange ( final ListChangeEvent event )
{
handleListeChange ( event.diff );
}
} );
}
示例7: XAxisViewer
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
public XAxisViewer ( final DataBindingContext dbc, final ChartRenderer manager, final XAxis axis, final boolean top )
{
super ( dbc, manager, axis );
this.axis = axis;
this.control = new org.eclipse.scada.chart.XAxis ();
this.renderer = new XAxisDynamicRenderer ( manager );
this.renderer.setAxis ( this.control );
this.renderer.setAlign ( top ? SWT.TOP : SWT.BOTTOM );
manager.addRenderer ( this.renderer, -2 );
addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "label" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__LABEL ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "min" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.XAXIS__MINIMUM ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "max" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.XAXIS__MAXIMUM ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "showLabels" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__LABEL_VISIBLE ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "format" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__FORMAT ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "textPadding" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__TEXT_PADDING ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "color" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__COLOR ) ) ); //$NON-NLS-1$
}
示例8: YAxisViewer
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
public YAxisViewer ( final DataBindingContext dbc, final ChartRenderer manager, final YAxis axis, final boolean left )
{
super ( dbc, manager, axis );
this.axis = axis;
this.control = new org.eclipse.scada.chart.YAxis ();
this.renderer = new YAxisDynamicRenderer ( manager );
this.renderer.setAxis ( this.control );
this.renderer.setAlign ( left ? SWT.LEFT : SWT.RIGHT );
manager.addRenderer ( this.renderer, -1 );
addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "label" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__LABEL ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "min" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.YAXIS__MINIMUM ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( BeansObservables.observeValue ( this.control, "max" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.YAXIS__MAXIMUM ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "showLabels" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__LABEL_VISIBLE ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "format" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__FORMAT ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "textPadding" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__TEXT_PADDING ) ) ); //$NON-NLS-1$
addBinding ( this.dbc.bindValue ( PojoObservables.observeValue ( this.renderer, "color" ), EMFObservables.observeValue ( this.axis, ChartPackage.Literals.AXIS__COLOR ) ) ); //$NON-NLS-1$
}
示例9: DataItemLabel
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
public DataItemLabel ( final Composite composite, final String connectionId, final String itemId )
{
this.label = new CLabel ( composite, SWT.NONE );
this.dataItem = new DataItemObservableValue ( Activator.getDefault ().getBundle ().getBundleContext (), connectionId, itemId );
this.label.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
handleDispose ();
}
} );
this.model = PojoObservables.observeDetailValue ( this.dataItem, "value", Variant.class ); //$NON-NLS-1$
this.dbc = new DataBindingContext ();
bind ();
}
示例10: createComposite
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
private Composite createComposite ( final Composite wrapper )
{
this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) );
wrapper.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
CallbackDialog.this.dbc.dispose ();
}
} );
final Composite composite = new Composite ( wrapper, SWT.NONE );
composite.setLayout ( new GridLayout ( 2, false ) );
for ( final CallbackWidgetFactory factory : this.factories )
{
factory.createGridWidgets ( this.dbc, composite );
}
return composite;
}
示例11: createComposite
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的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");
}
示例12: initializeRoleDescBindings
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的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;
}
示例13: initDataBindings
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
protected DataBindingContext initDataBindings()
{
DataBindingContext bindingContext = new DataBindingContext();
//
// IObservableValue observeTextTextObserveWidget =
// WidgetProperties.text(SWT.Modify).observe(text);
// IObservableValue mdCSpellingObserveValue =
// PojoProperties.value("mdC").observe(spelling);
// bindingContext.bindValue(observeTextTextObserveWidget,
// mdCSpellingObserveValue, null, null);
// //
// IObservableValue observeTextText_1ObserveWidget =
// WidgetProperties.text(SWT.Modify).observe(text_1);
// IObservableValue translitterationSpellingObserveValue =
// PojoProperties.value("translitteration").observe(
// spelling);
// bindingContext.bindValue(observeTextText_1ObserveWidget,
// translitterationSpellingObserveValue, null, null);
//
return bindingContext;
}
示例14: createDialogArea
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite cmp = (Composite) super.createDialogArea(parent);
cmp.setLayout(new GridLayout(5, false));
DataBindingContext bindingContext = new DataBindingContext();
new Label(cmp, SWT.NONE).setText(Messages.CreateParameterCommand_parameter_name);
Combo operator = new Combo(cmp, SWT.READ_ONLY);
JRDesignDataset ds = value.getRoot().getValue();
List<JRParameter> prms = ds.getParametersList();
String[] items = new String[prms.size()];
for (int i = 0; i < items.length; i++)
items[i] = prms.get(i).getName();
operator.setItems(items);
operator.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
bindingContext.bindValue(SWTObservables.observeSelection(operator), PojoObservables.observeValue(this, "prm")); //$NON-NLS-1$
return cmp;
}
示例15: createWidget
import org.eclipse.core.databinding.DataBindingContext; //导入依赖的package包/类
@Override
protected void createWidget(Composite parent) {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 2;
layout.marginWidth = 0;
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
setLayout(layout);
txt = new Text(this, SWT.BORDER);
txt.setText(getValue().toSQLString());
txt.setToolTipText(getValue().toSQLString());
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.minimumWidth = 250;
txt.setLayoutData(gd);
DataBindingContext bindingContext = new DataBindingContext();
bindingContext.bindValue(SWTObservables.observeText(txt, SWT.Modify), PojoObservables.observeValue(getValue(), "value")); //$NON-NLS-1$
}