diff options
author | Brian Vosburgh | 2016-07-15 15:42:42 +0000 |
---|---|---|
committer | Brian Vosburgh | 2017-05-18 22:37:57 +0000 |
commit | 3f5eace0de56e0514b706a1099acceeeff122d86 (patch) | |
tree | 4d1f092316404ae19aa792cc75ca20abb3867a52 /common | |
parent | 8ff9fb95c56ff9fdc5bc534e0a78e3933e090241 (diff) | |
download | webtools.dali-3f5eace0de56e0514b706a1099acceeeff122d86.tar.gz webtools.dali-3f5eace0de56e0514b706a1099acceeeff122d86.tar.xz webtools.dali-3f5eace0de56e0514b706a1099acceeeff122d86.zip |
add return value to
BasePluggablePropertyValueModel.Adapter.engageModel()
Diffstat (limited to 'common')
10 files changed, 29 insertions, 28 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 8766552312..94487a307e 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 @@ -111,17 +111,18 @@ public abstract class BaseCompoundPropertyValueModelAdapter<V, IM extends Proper return this.value; } - public void engageModel() { + public V engageModel() { this.outerModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.outerValueListener); this.innerModel = this.outerModel.getValue(); - this.engageInnerModel(); + return this.engageInnerModel(); } - private void engageInnerModel() { - if (this.innerModel != null) { - this.innerModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.innerValueListener); - this.value = this.innerModel.getValue(); + private V engageInnerModel() { + if (this.innerModel == null) { + return null; } + this.innerModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.innerValueListener); + return this.value = this.innerModel.getValue(); } public void disengageModel() { 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 6b94a430d8..180a7d8692 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 @@ -138,10 +138,9 @@ public abstract class BasePluggablePropertyValueModel<V, A extends BasePluggable * Start listening to the underlying model and build the value. */ protected void engageModel() { - this.adapter.engageModel(); // sync our value *after* we start listening to the model, // since the model's value might change when a listener is added - this.value = this.adapter.getValue(); + this.value = this.adapter.engageModel(); } /** @@ -205,9 +204,10 @@ public abstract class BasePluggablePropertyValueModel<V, A extends BasePluggable AV getValue(); /** - * Start listening to the adapted model. + * Start listening to the adapted model + * and return its current value. */ - void engageModel(); + AV engageModel(); /** * Stop listening to the adapted model. 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 32a36fb358..955c987aad 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 @@ -74,10 +74,10 @@ public abstract class BasePropertyPluggablePropertyValueModelAdapter<V1, V2, M e return this.value; } - public void engageModel() { + public V2 engageModel() { this.propertyModel.addPropertyChangeListener(PropertyValueModel.VALUE, this); this.propertyModelValue = this.propertyModel.getValue(); - this.value = this.buildValue(); + return this.value = this.buildValue(); } public void disengageModel() { 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 8ac19c8530..f8f5baa5a6 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 @@ -149,16 +149,16 @@ public class BufferedPropertyValueModelAdapter<V> } } - public void engageModel() { - this.wrappedValueModel.addPropertyChangeListener(PropertyValueModel.VALUE, this); - this.wrappedValue = this.wrappedValueModel.getValue(); + public V engageModel() { this.trigger.addListener(this.triggerListener); + this.wrappedValueModel.addPropertyChangeListener(PropertyValueModel.VALUE, this); + return this.wrappedValue = this.wrappedValueModel.getValue(); } public void disengageModel() { + this.trigger.removeListener(this.triggerListener); this.setBuffering(false); this.bufferedValue = null; - this.trigger.removeListener(this.triggerListener); this.wrappedValue = null; this.wrappedValueModel.removePropertyChangeListener(PropertyValueModel.VALUE, this); } 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 71e2870afb..ab84fbcf44 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 @@ -85,10 +85,10 @@ public final class CollectionPluggablePropertyValueModelAdapter<E, V> return this.value; } - public void engageModel() { + public V engageModel() { this.collectionModel.addCollectionChangeListener(CollectionValueModel.VALUES, this); CollectionTools.addAll(this.collection, this.collectionModel); - this.value = this.buildValue(); + return this.value = this.buildValue(); } public void disengageModel() { 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 d37ce05cbc..e54aabccea 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 @@ -112,10 +112,10 @@ public final class CompositePropertyValueModelAdapter<E, V> return this.value; } - public void engageModel() { + public V engageModel() { this.collectionModel.addCollectionChangeListener(CollectionValueModel.VALUES, this); this.addComponentPVMs(this.collectionModel); - this.value = this.buildValue(); + return this.value = this.buildValue(); } public void disengageModel() { 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 f73480694f..7f17c43d79 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 @@ -108,10 +108,10 @@ public final class ListCompositePropertyValueModelAdapter<E, V> return this.value; } - public void engageModel() { + public V engageModel() { this.listModel.addListChangeListener(ListValueModel.LIST_VALUES, this); this.addComponentPVMs(0, this.listModel); - this.value = this.buildValue(); + return this.value = this.buildValue(); } public void disengageModel() { 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 5cc917eb2f..5aded2744b 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 @@ -89,10 +89,10 @@ public final class ListPluggablePropertyValueModelAdapter<E, V> return this.value; } - public void engageModel() { + public V engageModel() { this.listModel.addListChangeListener(ListValueModel.LIST_VALUES, this); ListTools.addAll(this.list, 0, this.listModel); - this.value = this.buildValue(); + return this.value = this.buildValue(); } public void disengageModel() { 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 98436a995a..eac83e2bf9 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> this.closure.execute(value); } - public void engageModel() { - this.adapter.engageModel(); + public V engageModel() { + return this.adapter.engageModel(); } public void 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 ce91c5575e..57db49690c 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 @@ -1168,10 +1168,10 @@ public class PropertyValueModelToolsTests this.value = null; } - public void engageModel() { + public String engageModel() { this.stringModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.stringListener); String v = this.stringModel.getValue(); - this.value = v.substring(v.length() / 2); + return this.value = v.substring(v.length() / 2); } public String getValue() { |