本文整理汇总了Java中org.eclipse.emf.databinding.EMFObservables类的典型用法代码示例。如果您正苦于以下问题:Java EMFObservables类的具体用法?Java EMFObservables怎么用?Java EMFObservables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMFObservables类属于org.eclipse.emf.databinding包,在下文中一共展示了EMFObservables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的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;
}
示例2: ButtonProfileEntry
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的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 () );
};
} );
}
示例3: XAxisViewer
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的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$
}
示例4: YAxisViewer
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的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$
}
示例5: observeTextContent
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
/**
* Adds a change listener to each sentence in this text in order to update
* sentence translations in translation part representation.
* In case there are active listeners on observables from previous input,
* those are unregistered beforehand.
* @param text
*/
private void observeTextContent(BTSText text) {
try {
// unregister any listeners on previously known text contents
unobserveTextContent();
for (BTSTextItems ti : text.getTextContent().getTextItems()) {
if (ti instanceof BTSSenctence) {
BTSSenctence sentence = (BTSSenctence)ti;
IObservableValue<?> valProp =
EMFObservables.observeValue(sentence, BtsmodelPackage.Literals.BTS_TRANSLATION__VALUE);
valProp.addChangeListener(getSentenceTranslationChangeListener());
observableSentences.add(valProp);
}
}
} catch (NullPointerException e) {
//
}
}
示例6: attachListener
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public void attachListener(EObject target, final DetailProviderParameter parameter, final UniqueMultiselectWidget widget) {
EStructuralFeature feature = (EStructuralFeature) parameter.getPropertyDescriptor().getFeature(target);
final IObservableValue modelObservable = EMFObservables.observeValue(target, feature);
final IValueChangeListener listener = new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
widget.updateWidget(getValues(parameter));
}
};
modelObservable.addValueChangeListener(listener);
widget.getControl().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
modelObservable.removeValueChangeListener(listener);
}
});
}
示例7: bindValidatorDecoration
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public static void bindValidatorDecoration(DetailProviderParameter parameter, final Control control) {
final EObject target = parameter.getTarget();
IItemPropertyDescriptor pd = parameter.getPropertyDescriptor();
final EStructuralFeature feature = (EStructuralFeature) pd.getFeature(target);
addControl(target, feature, control);
final IObservableValue modelObservable = EMFObservables.observeValue(target, feature);
final IValueChangeListener listener = new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
Object value = event.getObservableValue().getValue();
validateFeatureValue(target, feature, value, control, true);
}
};
modelObservable.addValueChangeListener(listener);
control.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
modelObservable.removeValueChangeListener(listener);
modelObservable.dispose();
removeControl(target, feature, control);
control.removeDisposeListener(this);
}
});
validateFeatureValue(target, feature, modelObservable.getValue(), control, false);
}
示例8: observeValueAndRunOnChange
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
private void observeValueAndRunOnChange(final Widget widget, EObject object, EStructuralFeature feature, final Runnable runnable) {
final IObservableValue valueObservable = EMFObservables.observeValue(object, feature);
final IValueChangeListener valueChangeListener = new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
WidgetUtils.runInDisplayThread(widget, runnable);
}
};
valueObservable.addValueChangeListener(valueChangeListener);
widget.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
valueObservable.removeValueChangeListener(valueChangeListener);
}
});
}
示例9: observe
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public void observe(EObject eobject, EStructuralFeature sf){
long id = (((long)eobject.hashCode()) << 32) + sf.getFeatureID();
if(externalObservables.containsKey(id)){
return;
}
IObservableValue ov = EMFObservables.observeValue(eobject, sf);
ov.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
if(treeRow != null){
treeRow.update();
}
}
});
externalObservables.put(id, ov);
}
示例10: myInitializations
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
private void myInitializations() {
Resource metamodelResource = this.manager.getConceptResource(this.metamodel);
conceptTreeViewer.setInput(metamodelResource);
// treeMetamodelUsageViewer.setInput(this.manager.computeStaticAnalysis(this.metamodel));
// Get Dirty flag...
IObservableValue revengModelTransformationObserveValue = EMFObservables.observeValue(manager.getModel(),
Literals.REVENG_MODEL__TRANSFORMATION);
revengModelTransformationObserveValue.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
markAsDirty();
}
});
}
示例11: initDataBindings
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeTextTxtAtlFileObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtAtlFile);
IObservableValue revengModelTransformationObserveValue = EMFObservables.observeValue(revengModel, Literals.REVENG_MODEL__TRANSFORMATION);
UpdateValueStrategy strategy_1 = new UpdateValueStrategy();
strategy_1.setConverter(new TransformationToTextConverter());
bindingContext.bindValue(observeTextTxtAtlFileObserveWidget, revengModelTransformationObserveValue, null, strategy_1);
//
IObservableValue observeTextTxtTemplatePathObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtTemplatePath);
IObservableValue revengModelTemplateObserveValue = EMFObservables.observeValue(revengModel, Literals.REVENG_MODEL__TEMPLATE);
UpdateValueStrategy strategy_2 = new UpdateValueStrategy();
strategy_2.setConverter(new TransformationToTextConverter());
bindingContext.bindValue(observeTextTxtTemplatePathObserveWidget, revengModelTemplateObserveValue, null, strategy_2);
//
IObservableValue observeTextTxtComponentNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtComponentFile);
IObservableValue revengModelComponentPathObserveValue = EMFObservables.observeValue(revengModel, Literals.REVENG_MODEL__COMPONENT_PATH);
bindingContext.bindValue(observeTextTxtComponentNameObserveWidget, revengModelComponentPathObserveValue, null, null);
//
return bindingContext;
}
示例12: AbstractInputViewer
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public AbstractInputViewer ( final DataBindingContext dbc, final DataSeries element, final ChartViewer viewer, final ResourceManager resourceManager, final AxisLocator<XAxis, XAxisViewer> xLocator, final AxisLocator<YAxis, YAxisViewer> yLocator )
{
this.element = element;
this.viewer = viewer;
this.dbc = dbc;
this.resourceManager = new LocalResourceManager ( resourceManager );
this.xLocator = xLocator;
this.yLocator = yLocator;
addBinding ( dbc.bindValue ( PojoObservables.observeValue ( this, "x" ), EMFObservables.observeValue ( element, ChartPackage.Literals.DATA_SERIES__X ) ) ); //$NON-NLS-1$
addBinding ( dbc.bindValue ( PojoObservables.observeValue ( this, "y" ), EMFObservables.observeValue ( element, ChartPackage.Literals.DATA_SERIES__Y ) ) ); //$NON-NLS-1$
}
示例13: DataItemSeriesViewer
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public DataItemSeriesViewer ( final DataBindingContext dbc, final DataItemSeries element, final ChartViewer viewer, final ResourceManager resourceManager, final AxisLocator<XAxis, XAxisViewer> xLocator, final AxisLocator<YAxis, YAxisViewer> yLocator )
{
super ( dbc, element, viewer, resourceManager, xLocator, yLocator );
this.inputObservable = BeansObservables.observeValue ( this, PROP_INPUT );
this.linePropertiesObservable = EMFObservables.observeValue ( element, ChartPackage.Literals.DATA_ITEM_SERIES__LINE_PROPERTIES );
addBindings ( LinePropertiesBinder.bind ( dbc, this.inputObservable, this.linePropertiesObservable ) );
setInputObserable ( this.inputObservable );
}
示例14: ScriptSeriesViewer
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public ScriptSeriesViewer ( final DataBindingContext dbc, final ScriptSeries element, final ChartViewer viewer, final ResourceManager resourceManager, final AxisLocator<XAxis, XAxisViewer> xLocator, final AxisLocator<YAxis, YAxisViewer> yLocator )
{
super ( dbc, element, viewer, resourceManager, xLocator, yLocator );
this.inputObservable = BeansObservables.observeValue ( this, PROP_INPUT );
this.linePropertiesObservable = EMFObservables.observeValue ( element, ChartPackage.Literals.SCRIPT_SERIES__LINE_PROPERTIES );
addBinding ( dbc.bindValue ( PojoObservables.observeDetailValue ( this.inputObservable, "script", null ), EMFObservables.observeValue ( element, ChartPackage.Literals.SCRIPT_SERIES__SCRIPT ) ) ); //$NON-NLS-1$
addBindings ( LinePropertiesBinder.bind ( dbc, this.inputObservable, this.linePropertiesObservable ) );
setInputObserable ( this.inputObservable );
}
示例15: CheckProfileEntry
import org.eclipse.emf.databinding.EMFObservables; //导入依赖的package包/类
public CheckProfileEntry ( 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.CHECK );
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 ( CheckProfileEntry.this.widget.getSelection () );
};
} );
}