/** * Clean up when disposing the details viewer * * @see org.eclipse.swt.widgets.Widget#dispose() * @see era.foss.typeeditor.common.Ui#dispose() */ @Override public void dispose() { super.dispose(); this.disposeDetails(); master.dispose(); dataBindingContext.dispose(); }
@Override public synchronized void dispose() { super.dispose(); for (IObservableValue observable : observableValues) { observable.removeChangeListener(this); observable.dispose(); } }
@Override public synchronized void dispose() { if (listener != null) { lastListenerRemoved(); } for (IObservableValue value : this.observableValueList) { value.dispose(); } super.dispose(); }
public void testDisposeMasterDisposesDetail() { IObservableValue master = new WritableValue(); WritableListFactory factory = new WritableListFactory(); master.setValue(""); IObservableList detailObservable = MasterDetailObservables.detailList(master, factory, null); DisposeEventTracker tracker = DisposeEventTracker.observe(detailObservable); master.dispose(); assertEquals(1, tracker.count); assertTrue(detailObservable.isDisposed()); }
void dispose() { target.dispose(); model.dispose(); binding.dispose(); }
@Override public void dispose() { if (ov != null) { ov.dispose(); } }
/** * Copies the values from one {@link VControl} to another. * * @param from the {@link VControl} holding the values * @param fromDomainModel The domain model belonging to the 'from control'. * @param to the {@link VControl} which values should be updated * @param toDomainModel The domain model belonging to the 'to control'. * @since 1.6 */ @SuppressWarnings("unchecked") public static void copyValues( VControl from, EObject fromDomainModel, VControl to, EObject toDomainModel) { final IObservableValue fromObservableValue; final IObservableValue toObservableValue; try { fromObservableValue = Activator.getDefault() .getEMFFormsDatabinding() .getObservableValue(from.getDomainModelReference(), fromDomainModel); toObservableValue = Activator.getDefault() .getEMFFormsDatabinding() .getObservableValue(to.getDomainModelReference(), toDomainModel); } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return; } final EObject fromEObject = (EObject) ((IObserving) fromObservableValue).getObserved(); final EStructuralFeature fromStructuralFeature = (EStructuralFeature) fromObservableValue.getValueType(); final EObject toEObject = (EObject) ((IObserving) toObservableValue).getObserved(); final EStructuralFeature toStructuralFeature = (EStructuralFeature) toObservableValue.getValueType(); fromObservableValue.dispose(); toObservableValue.dispose(); if (!toStructuralFeature.isChangeable()) { return; } final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(toEObject); if (toStructuralFeature.isMany()) { editingDomain .getCommandStack() .execute( RemoveCommand.create( editingDomain, toEObject, toStructuralFeature, (Collection<?>) toEObject.eGet(toStructuralFeature, true))); } if (EAttribute.class.isInstance(toStructuralFeature)) { if (toStructuralFeature.isMany()) { editingDomain .getCommandStack() .execute( AddCommand.create( editingDomain, toEObject, toStructuralFeature, (Collection<?>) fromEObject.eGet(fromStructuralFeature, true))); } else { editingDomain .getCommandStack() .execute( SetCommand.create( editingDomain, toEObject, toStructuralFeature, fromEObject.eGet(fromStructuralFeature, true))); } } if (EReference.class.isInstance(toStructuralFeature)) { if (toStructuralFeature.isMany()) { for (final EObject eObject : (Collection<EObject>) fromEObject.eGet(fromStructuralFeature, true)) { editingDomain .getCommandStack() .execute( AddCommand.create( editingDomain, toEObject, toStructuralFeature, EcoreUtil.copy(eObject))); } return; } editingDomain .getCommandStack() .execute( SetCommand.create( editingDomain, toEObject, toStructuralFeature, EcoreUtil.copy((EObject) fromEObject.eGet(fromStructuralFeature, true)))); } }