Search in sources :

Example 1 with IStaleListener

use of org.eclipse.core.databinding.observable.IStaleListener in project jbosstools-openshift by jbosstools.

the class FormPresenterSupport method init.

/**
 * @noreference This method is not intended to be referenced by clients.
 */
protected void init() {
    ObservableTracker.setIgnore(true);
    try {
        aggregateStatusProvider = new MaxSeverityValidationStatusProvider(dbc);
    } finally {
        ObservableTracker.setIgnore(false);
    }
    aggregateStatusProvider.addValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(ValueChangeEvent event) {
            statusProviderChanged();
        }
    });
    formPresenter.getControl().addListener(SWT.Dispose, new Listener() {

        @Override
        public void handleEvent(Event event) {
            dispose();
        }
    });
    aggregateStatusProvider.addStaleListener(new IStaleListener() {

        @Override
        public void handleStale(StaleEvent staleEvent) {
            currentStatusStale = true;
            handleStatusChanged();
        }
    });
    statusProviderChanged();
    dbc.getValidationStatusProviders().addListChangeListener(validationStatusProvidersListener);
    for (Iterator it = dbc.getValidationStatusProviders().iterator(); it.hasNext(); ) {
        ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) it.next();
        IObservableList targets = validationStatusProvider.getTargets();
        targets.addListChangeListener(validationStatusProviderTargetsListener);
        for (Iterator iter = targets.iterator(); iter.hasNext(); ) {
            ((IObservable) iter.next()).addChangeListener(uiChangeListener);
        }
    }
}
Also used : IValueChangeListener(org.eclipse.core.databinding.observable.value.IValueChangeListener) StaleEvent(org.eclipse.core.databinding.observable.StaleEvent) ValueChangeEvent(org.eclipse.core.databinding.observable.value.ValueChangeEvent) IValueChangeListener(org.eclipse.core.databinding.observable.value.IValueChangeListener) IChangeListener(org.eclipse.core.databinding.observable.IChangeListener) Listener(org.eclipse.swt.widgets.Listener) IStaleListener(org.eclipse.core.databinding.observable.IStaleListener) IListChangeListener(org.eclipse.core.databinding.observable.list.IListChangeListener) IStaleListener(org.eclipse.core.databinding.observable.IStaleListener) Iterator(java.util.Iterator) IObservable(org.eclipse.core.databinding.observable.IObservable) StaleEvent(org.eclipse.core.databinding.observable.StaleEvent) ValueChangeEvent(org.eclipse.core.databinding.observable.value.ValueChangeEvent) Event(org.eclipse.swt.widgets.Event) ListChangeEvent(org.eclipse.core.databinding.observable.list.ListChangeEvent) ChangeEvent(org.eclipse.core.databinding.observable.ChangeEvent) ValidationStatusProvider(org.eclipse.core.databinding.ValidationStatusProvider) IObservableList(org.eclipse.core.databinding.observable.list.IObservableList)

Aggregations

Iterator (java.util.Iterator)1 ValidationStatusProvider (org.eclipse.core.databinding.ValidationStatusProvider)1 ChangeEvent (org.eclipse.core.databinding.observable.ChangeEvent)1 IChangeListener (org.eclipse.core.databinding.observable.IChangeListener)1 IObservable (org.eclipse.core.databinding.observable.IObservable)1 IStaleListener (org.eclipse.core.databinding.observable.IStaleListener)1 StaleEvent (org.eclipse.core.databinding.observable.StaleEvent)1 IListChangeListener (org.eclipse.core.databinding.observable.list.IListChangeListener)1 IObservableList (org.eclipse.core.databinding.observable.list.IObservableList)1 ListChangeEvent (org.eclipse.core.databinding.observable.list.ListChangeEvent)1 IValueChangeListener (org.eclipse.core.databinding.observable.value.IValueChangeListener)1 ValueChangeEvent (org.eclipse.core.databinding.observable.value.ValueChangeEvent)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1