本文整理汇总了Java中org.eclipse.emf.databinding.EMFObservables.observeValue方法的典型用法代码示例。如果您正苦于以下问题:Java EMFObservables.observeValue方法的具体用法?Java EMFObservables.observeValue怎么用?Java EMFObservables.observeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.databinding.EMFObservables
的用法示例。
在下文中一共展示了EMFObservables.observeValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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) {
//
}
}
示例2: 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);
}
});
}
示例3: 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);
}
示例4: 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);
}
});
}
示例5: 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);
}
示例6: 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();
}
});
}
示例7: 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;
}
示例8: 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 );
}
示例9: 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 );
}
示例10: TimeShiftActionController
import org.eclipse.emf.databinding.EMFObservables; //导入方法依赖的package包/类
public TimeShiftActionController ( final ControllerManager controllerManager, final ChartContext chartContext, final TimeShiftAction controller )
{
super ( controllerManager.getContext (), chartContext, controller );
final DataBindingContext ctx = controllerManager.getContext ();
final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace ();
if ( space != null )
{
this.button = new Button ( space, SWT.PUSH );
this.button.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
action ();
};
} );
addBinding ( ctx.bindValue ( PojoObservables.observeValue ( this, "milliseconds" ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DIFF ) ) ); //$NON-NLS-1$
addBinding ( ctx.bindValue ( SWTObservables.observeText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL ) ) );
addBinding ( ctx.bindValue ( SWTObservables.observeTooltipText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DESCRIPTION ) ) );
this.layoutListener = new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
space.layout ();
}
};
this.labelProperty = EMFObservables.observeValue ( controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL );
this.labelProperty.addValueChangeListener ( this.layoutListener );
space.layout ();
}
else
{
this.button = null;
}
}
示例11: initDataBindings
import org.eclipse.emf.databinding.EMFObservables; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
bindingContext = new DataBindingContext();
//
IObservableValue observeTagsObserveWidget = WidgetProperties.text(SWT.Modify).observe(text);
IObservableValue solutionTagsObserveValue = EMFObservables.observeValue(solution, Literals.NODE__IUS);
UpdateValueStrategy solutionTagsToModelStrategy = new UpdateValueStrategy();
solutionTagsToModelStrategy.setConverter(new StringToFeatureConverter());
UpdateValueStrategy solutionModelToTagsStrategy = new UpdateValueStrategy();
solutionModelToTagsStrategy.setConverter(new FeatureToStringConverter());
bindingContext.bindValue(observeTagsObserveWidget, solutionTagsObserveValue, solutionTagsToModelStrategy, solutionModelToTagsStrategy);
//
return bindingContext;
}
示例12: initDataBindings
import org.eclipse.emf.databinding.EMFObservables; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
bindingContext = new DataBindingContext();
//
IObservableValue observeTextTxtLogoFilePathObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtLogoFilePath);
IObservableValue solutionImageObserveValue = EMFObservables.observeValue(solution, Literals.NODE__IMAGE);
bindingContext.bindValue(observeTextTxtLogoFilePathObserveWidget, solutionImageObserveValue, null, null);
//
IObservableValue observeTextTxtScreenshotFilePathObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtScreenshotFilePath);
IObservableValue solutionScreenshotObserveValue = EMFObservables.observeValue(solution,Literals.NODE__SCREENSHOT);
bindingContext.bindValue(observeTextTxtScreenshotFilePathObserveWidget, solutionScreenshotObserveValue, null, null);
//
return bindingContext;
}
示例13: initDataBindings
import org.eclipse.emf.databinding.EMFObservables; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeTextTextObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtShortDescription);
IObservableValue solutionShortdescriptionObserveValue = EMFObservables.observeValue(solution, Literals.NODE__SHORTDESCRIPTION);
bindingContext.bindValue(observeTextTextObserveWidget, solutionShortdescriptionObserveValue, null, null);
//
return bindingContext;
}
示例14: initDataBindings
import org.eclipse.emf.databinding.EMFObservables; //导入方法依赖的package包/类
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeTextTxtLogoFilePathObserveWidget = WidgetProperties.text(SWT.Modify).observe(markupViewer.getTextWidget());
IObservableValue solutionImageObserveValue = EMFObservables.observeValue(solution, Literals.NODE__RAW_BODY);
bindingContext.bindValue(observeTextTxtLogoFilePathObserveWidget, solutionImageObserveValue, null, null);
//
return bindingContext;
}
示例15: createObservable
import org.eclipse.emf.databinding.EMFObservables; //导入方法依赖的package包/类
@Override
public IObservable createObservable(Object target, String path) {
EObject eObject = (EObject) target;
EClass eClass = eObject.eClass();
EStructuralFeature feature = eClass.getEStructuralFeature(path);
if (feature == null) {
throw new IllegalArgumentException("Feature not found: eClass=" + eClass.getName() + ", name=" + path);
}
return EMFObservables.observeValue(eObject, feature);
}