本文整理汇总了Java中org.eclipse.core.databinding.observable.value.IValueChangeListener类的典型用法代码示例。如果您正苦于以下问题:Java IValueChangeListener类的具体用法?Java IValueChangeListener怎么用?Java IValueChangeListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IValueChangeListener类属于org.eclipse.core.databinding.observable.value包,在下文中一共展示了IValueChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
@Override
protected void bind ()
{
this.dbc.bindValue ( SWTObservables.observeText ( this.label ), this.model, null, new UpdateValueStrategy ().setConverter ( new VariantToStringConverter () ) );
this.model.addValueChangeListener ( new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
if ( !PlainDataItemLabel.this.label.isDisposed () )
{
PlainDataItemLabel.this.label.getParent ().layout ();
}
}
} );
}
示例2: setInput
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
@Override
protected void setInput ( final IEditorInput input )
{
final ConfigurationEditorInput configurationInput = (ConfigurationEditorInput)input;
if ( !this.nested )
{
configurationInput.performLoad ( new NullProgressMonitor () );
}
this.dirtyValue = configurationInput.getDirtyValue ();
this.dirtyValue.addValueChangeListener ( new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
firePropertyChange ( IEditorPart.PROP_DIRTY );
}
} );
super.setInput ( input );
}
示例3: attachListener
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的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);
}
});
}
示例4: bindValidatorDecoration
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的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);
}
示例5: observeValueAndRunOnChange
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的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);
}
});
}
示例6: createControl
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
super.createControl(parent);
Composite control = (Composite) getControl();
GridLayout layout = new GridLayout(1,false);
control.setLayout(layout);
PropertiesComposite composite = new PropertiesComposite(control, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
composite.bindValues(properties);
IValueChangeListener valueChangeListener = new IValueChangeListener() {
public void handleValueChange(ValueChangeEvent event) {
setPageComplete(validatePage());
}
};
properties.identifier.addValueChangeListener(valueChangeListener);
properties.version.addValueChangeListener(valueChangeListener);
}
示例7: observe
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的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);
}
示例8: myInitializations
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的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();
}
});
}
示例9: TimeShiftActionController
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的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;
}
}
示例10: bind
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
@Override
protected void bind ()
{
this.model.addValueChangeListener ( new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
if ( !SystemMessageLabel.this.label.isDisposed () )
{
process ( event.diff.getNewValue () );
}
}
} );
}
示例11: bindValues
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
/**
* Bind values.
*/
private void bindValues() {
List<String> existingNames = new ArrayList<String>();
// if (_attribute.getParent()!=null)
// for(Attribute attribute : _attribute.getParent().getChildren()) {
// existingNames.add(attribute.getName());
// }
bind(_nameText, _attribute, Attribute.PROP_NAME, new NotEmptyOrExistValidator(Collection.PROP_NAME, existingNames));
bind(_detailsText, _attribute, Attribute.PROP_DESCRIPTION, null);
final AggregateValidationStatus aggregateValidationStatus = new AggregateValidationStatus(_dbc.getValidationStatusProviders(), AggregateValidationStatus.MAX_SEVERITY);
aggregateValidationStatus.addValueChangeListener(new IValueChangeListener() {
public void handleValueChange(ValueChangeEvent event) {
// the invocation of the getValue method is necessary
// the further changes will be fired
aggregateValidationStatus.getValue();
for (Object o : _dbc.getBindings()) {
Binding binding = (Binding) o;
IStatus status = (IStatus) binding.getValidationStatus().getValue();
Control control = null;
if (binding.getTarget() instanceof ISWTObservable) {
ISWTObservable swtObservable = (ISWTObservable) binding.getTarget();
control = (Control) swtObservable.getWidget();
}
ControlDecoration decoration = decoratorMap.get(control);
if (decoration != null) {
if (status.isOK()) {
decoration.hide();
} else {
decoration.setDescriptionText(status.getMessage());
decoration.show();
}
}
}
}
});
}
示例12: bindValues
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
/**
* Bind values.
*/
private void bindValues() {
List<String> existingCollectionNames = new ArrayList<String>();
for (String collectionName : _existingCollectionNames) {
existingCollectionNames.add(collectionName);
}
bind(nameText, collection, Collection.PROP_NAME, new NotEmptyOrExistValidator(Collection.PROP_NAME, existingCollectionNames));
bind(detailsText, collection, Collection.PROP_DETAILS, null);
final AggregateValidationStatus aggregateValidationStatus = new AggregateValidationStatus(dbc.getValidationStatusProviders(), AggregateValidationStatus.MAX_SEVERITY);
aggregateValidationStatus.addValueChangeListener(new IValueChangeListener() {
public void handleValueChange(ValueChangeEvent event) {
// the invocation of the getValue method is necessary
// the further changes will be fired
aggregateValidationStatus.getValue();
for (Object o : dbc.getBindings()) {
Binding binding = (Binding) o;
IStatus status = (IStatus) binding.getValidationStatus().getValue();
Control control = null;
if (binding.getTarget() instanceof ISWTObservable) {
ISWTObservable swtObservable = (ISWTObservable) binding.getTarget();
control = (Control) swtObservable.getWidget();
}
ControlDecoration decoration = decoratorMap.get(control);
if (decoration != null) {
if (status.isOK()) {
decoration.hide();
} else {
decoration.setDescriptionText(status.getMessage());
decoration.show();
}
}
}
}
});
}
示例13: bindFields
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
@Override
public <S> void bindFields(final BFormInstance<S, ?> formInstance, final BForm<S> form, boolean immediate) {
Object context = formInstance.getBindingContext();
if (context != null) {
throw new UnsupportedOperationException("Binding context has been already set");
}
DataBindingContext dbCtx = createDataBindingContext(formInstance);
final WritableValue formValue = new WritableValue(formInstance.getValue(), Object.class);
final WritableValue presenterValue = new WritableValue(form.createPresenter(formInstance, formInstance.getValue()),
BPresenter.class);
formValue.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
presenterValue.setValue(form.createPresenter(formInstance, formInstance.getValue()));
}
});
bindFormValue(dbCtx, formValue, form, formInstance);
bindFormValidation(dbCtx, formValue, form, formInstance);
recursiveAddBindings(dbCtx, formValue, formInstance, form, presenterValue, immediate);
bindValidationSummaryError(dbCtx, formInstance);
formInstance.setBindingContext(new EclipseBindingContext(dbCtx));
}
示例14: ScaleActionController
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
public ScaleActionController ( final ControllerManager controllerManager, final ChartContext chartContext, final ScaleAction 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.SCALE_ACTION__TIMESPAN ) ) ); //$NON-NLS-1$
addBinding ( ctx.bindValue ( SWTObservables.observeText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.SCALE_ACTION__LABEL ) ) );
addBinding ( ctx.bindValue ( SWTObservables.observeTooltipText ( this.button ), EMFObservables.observeValue ( controller, ChartPackage.Literals.SCALE_ACTION__DESCRIPTION ) ) );
this.layoutListener = new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
space.layout ();
}
};
this.labelProperty = EMFObservables.observeValue ( controller, ChartPackage.Literals.SCALE_ACTION__LABEL );
this.labelProperty.addValueChangeListener ( this.layoutListener );
space.layout ();
}
else
{
this.button = null;
}
}
示例15: createDataModel
import org.eclipse.core.databinding.observable.value.IValueChangeListener; //导入依赖的package包/类
protected void createDataModel ( final TreeViewer viewer )
{
final DataBindingContext dbc = new DataBindingContext ();
final IObservableFactory listFactory = new IObservableFactory () {
@Override
public IObservable createObservable ( final Object target )
{
if ( target instanceof IObservableList )
{
return (IObservableList)target;
}
else if ( target instanceof World )
{
return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.WORLD__NODES );
}
else if ( target instanceof SystemNode )
{
return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.SYSTEM_NODE__DRIVERS );
}
return null;
}
};
final AdapterFactory adapterFactory = new InfrastructureItemProviderAdapterFactory ();
final AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider ( adapterFactory );
final ObservableListTreeContentProvider cp = new ObservableListTreeContentProvider ( listFactory, null );
viewer.setContentProvider ( cp );
viewer.setLabelProvider ( labelProvider );
viewer.setInput ( EMFObservables.observeList ( this.world, InfrastructurePackage.Literals.WORLD__NODES ) );
dbc.bindValue ( ViewersObservables.observeSingleSelection ( viewer ), this.driverValue );
this.driverValue.addValueChangeListener ( new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
update ();
}
} );
viewer.getControl ().addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
dbc.dispose ();
}
} );
}