diff options
Diffstat (limited to 'common')
10 files changed, 33 insertions, 37 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BaseCompoundPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BaseCompoundPropertyValueModelAdapter.java index 94487a307e..7b3c9d6606 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BaseCompoundPropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BaseCompoundPropertyValueModelAdapter.java @@ -125,17 +125,18 @@ public abstract class BaseCompoundPropertyValueModelAdapter<V, IM extends Proper return this.value = this.innerModel.getValue(); } - public void disengageModel() { - this.disengageInnerModel(); + public V disengageModel() { this.outerModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.outerValueListener); + return this.disengageInnerModel(); } - private void disengageInnerModel() { - if (this.innerModel != null) { - this.value = null; - this.innerModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.innerValueListener); - this.innerModel = null; + private V disengageInnerModel() { + if (this.innerModel == null) { + return null; } + this.innerModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.innerValueListener); + this.innerModel = null; + return this.value = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePluggablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePluggablePropertyValueModel.java index 644fa3a73d..78797ba15f 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePluggablePropertyValueModel.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePluggablePropertyValueModel.java @@ -204,9 +204,10 @@ public abstract class BasePluggablePropertyValueModel<V, A extends BasePluggable AV engageModel(); /** - * Stop listening to the adapted model. + * Stop listening to the adapted model + * and return its current value. */ - void disengageModel(); + AV disengageModel(); /** * Callback interface. diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePropertyPluggablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePropertyPluggablePropertyValueModelAdapter.java index 955c987aad..5fe90d0f48 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePropertyPluggablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BasePropertyPluggablePropertyValueModelAdapter.java @@ -80,10 +80,10 @@ public abstract class BasePropertyPluggablePropertyValueModelAdapter<V1, V2, M e return this.value = this.buildValue(); } - public void disengageModel() { - this.value = null; - this.propertyModelValue = null; + public V2 disengageModel() { this.propertyModel.removePropertyChangeListener(PropertyValueModel.VALUE, this); + this.propertyModelValue = null; + return this.value = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java index f8f5baa5a6..5c4e1279e2 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedPropertyValueModelAdapter.java @@ -155,12 +155,12 @@ public class BufferedPropertyValueModelAdapter<V> return this.wrappedValue = this.wrappedValueModel.getValue(); } - public void disengageModel() { + public V disengageModel() { this.trigger.removeListener(this.triggerListener); + this.wrappedValueModel.removePropertyChangeListener(PropertyValueModel.VALUE, this); this.setBuffering(false); this.bufferedValue = null; - this.wrappedValue = null; - this.wrappedValueModel.removePropertyChangeListener(PropertyValueModel.VALUE, this); + return this.wrappedValue = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPluggablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPluggablePropertyValueModelAdapter.java index ab84fbcf44..72c68f8c63 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPluggablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPluggablePropertyValueModelAdapter.java @@ -91,10 +91,10 @@ public final class CollectionPluggablePropertyValueModelAdapter<E, V> return this.value = this.buildValue(); } - public void disengageModel() { - this.value = null; - this.collection.clear(); + public V disengageModel() { this.collectionModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this); + this.collection.clear(); + return this.value = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java index e54aabccea..f33893187f 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModelAdapter.java @@ -118,13 +118,10 @@ public final class CompositePropertyValueModelAdapter<E, V> return this.value = this.buildValue(); } - public void disengageModel() { - this.value = null; - this.removeComponentPVMs(this.collectionModel); - if ( ! this.values.isEmpty()) { - throw new IllegalStateException("extraneous values: " + this.values); //$NON-NLS-1$ - } + public V disengageModel() { this.collectionModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this); + this.removeCachedPVMs(); + return this.value = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java index 7f17c43d79..c17456942d 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCompositePropertyValueModelAdapter.java @@ -114,13 +114,10 @@ public final class ListCompositePropertyValueModelAdapter<E, V> return this.value = this.buildValue(); } - public void disengageModel() { - this.value = null; - this.removeComponentPVMs(0, this.listModel.size(), this.listModel); - if ( ! this.values.isEmpty()) { - throw new IllegalStateException("extraneous values: " + this.values); //$NON-NLS-1$ - } + public V disengageModel() { this.listModel.removeListChangeListener(ListValueModel.LIST_VALUES, this); + this.removeCachedPVMs(); + return this.value = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPluggablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPluggablePropertyValueModelAdapter.java index 5aded2744b..1d7edd3ac9 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPluggablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPluggablePropertyValueModelAdapter.java @@ -95,10 +95,10 @@ public final class ListPluggablePropertyValueModelAdapter<E, V> return this.value = this.buildValue(); } - public void disengageModel() { - this.value = null; - this.list.clear(); + public V disengageModel() { this.listModel.removeListChangeListener(ListValueModel.LIST_VALUES, this); + this.list.clear(); + return this.value = null; } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java index 97a8e7613d..ff2f905a05 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggableModifiablePropertyValueModelAdapter.java @@ -52,8 +52,8 @@ public class PluggableModifiablePropertyValueModelAdapter<V> return this.adapter.engageModel(); } - public void disengageModel() { - this.adapter.disengageModel(); + public V disengageModel() { + return this.adapter.disengageModel(); } diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyValueModelToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyValueModelToolsTests.java index 57db49690c..b0d53cd2c7 100644 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyValueModelToolsTests.java +++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyValueModelToolsTests.java @@ -1183,9 +1183,9 @@ public class PropertyValueModelToolsTests this.stringModel.setValue(value + value); } - public void disengageModel() { - this.value = null; + public String disengageModel() { this.stringModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.stringListener); + return this.value = null; } void stringChanged(String newStringValue) { |