use of org.eclipse.core.databinding.observable.IObservable 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);
}
}
}
use of org.eclipse.core.databinding.observable.IObservable in project jbosstools-openshift by jbosstools.
the class FormPresenterSupport method handleUIChanged.
/**
* @noreference This method is not intended to be referenced by clients.
*/
protected void handleUIChanged() {
uiChanged = true;
if (currentStatus != null) {
handleStatusChanged();
}
dbc.getValidationStatusProviders().removeListChangeListener(validationStatusProvidersListener);
for (Iterator it = dbc.getValidationStatusProviders().iterator(); it.hasNext(); ) {
ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) it.next();
IObservableList targets = validationStatusProvider.getTargets();
targets.removeListChangeListener(validationStatusProviderTargetsListener);
for (Iterator iter = targets.iterator(); iter.hasNext(); ) {
((IObservable) iter.next()).removeChangeListener(uiChangeListener);
}
}
}
use of org.eclipse.core.databinding.observable.IObservable in project jbosstools-openshift by jbosstools.
the class FormPresenterSupport method dispose.
/**
* Disposes of this wizard page support object, removing any listeners it
* may have attached.
*/
public void dispose() {
if (aggregateStatusProvider != null)
aggregateStatusProvider.dispose();
if (dbc != null && !uiChanged) {
for (Iterator it = dbc.getValidationStatusProviders().iterator(); it.hasNext(); ) {
ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) it.next();
IObservableList targets = validationStatusProvider.getTargets();
if (targets != null) {
targets.removeListChangeListener(validationStatusProviderTargetsListener);
for (Iterator iter = targets.iterator(); iter.hasNext(); ) {
((IObservable) iter.next()).removeChangeListener(uiChangeListener);
}
}
}
dbc.getValidationStatusProviders().removeListChangeListener(validationStatusProvidersListener);
}
aggregateStatusProvider = null;
dbc = null;
uiChangeListener = null;
validationStatusProvidersListener = null;
validationStatusProviderTargetsListener = null;
formPresenter = null;
}
Aggregations