Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2012-05-02 21:42:24 +0000
committerkmoore2012-05-02 21:42:24 +0000
commit84c442586a730e5c0de85dee621b1beeb8b9f668 (patch)
tree9f282e35578406890bde2fb9f806d9e8c7931f9a /common/plugins
parent3e33134e1204be2c12e220f05b1d829ab4a8c97c (diff)
downloadwebtools.dali-84c442586a730e5c0de85dee621b1beeb8b9f668.tar.gz
webtools.dali-84c442586a730e5c0de85dee621b1beeb8b9f668.tar.xz
webtools.dali-84c442586a730e5c0de85dee621b1beeb8b9f668.zip
Bug 342171 - join columns - choose 'Override Default' in Details and receive out-of-bounds error
Diffstat (limited to 'common/plugins')
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java42
1 files changed, 41 insertions, 1 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
index 870a36590f..1c2808c34d 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,15 @@
package org.eclipse.jpt.common.utility.internal.model.value;
import java.util.Arrays;
+import java.util.EventListener;
+import java.util.EventObject;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.model.ChangeSupport;
+import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport;
import org.eclipse.jpt.common.utility.model.Model;
+import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.common.utility.model.listener.ListChangeListener;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
@@ -81,4 +88,37 @@ public class ItemPropertyListValueModelAdapter<E>
}
}
+ /**
+ * bug 342171
+ * Override to just fire an itemReplaced event instead of a listChanged event.
+ * An aspect of the item has changed, so no reason to say that the entire list has changed.
+ * Added a LocalChangeSupport so that I can fire a ListReplacedEvent for an old list
+ * and new list containing the same item.
+ */
+ @Override
+ protected void itemAspectChanged(EventObject event) {
+ Object item = event.getSource();
+ this.getChangeSupport().fireItemsReplaced(
+ new ListReplaceEvent(this, LIST_VALUES, CollectionTools.indexOf(this.listHolder, item), item, item));
+ }
+
+ @Override
+ protected ChangeSupport buildChangeSupport() {
+ return new LocalChangeSupport(this, ListChangeListener.class, ListValueModel.LIST_VALUES);
+ }
+
+ private class LocalChangeSupport extends SingleAspectChangeSupport {
+ public LocalChangeSupport(Model source, Class<? extends EventListener> validListenerClass, String validAspectName) {
+ super(source, validListenerClass, validAspectName);
+ }
+ @Override
+ public boolean fireItemsReplaced(ListReplaceEvent event) {
+ this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName());
+ if (event.getItemsSize() != 0) {
+ this.fireItemsReplaced_(event);
+ return true;
+ }
+ return false;
+ }
+ }
}

Back to the top