Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2017-08-04 14:40:33 +0000
committervincent lorenzo2017-08-08 09:51:01 +0000
commita8eff70353f9eed43cef212267a0117c458ab575 (patch)
treebf45dce421caf8498e7482e74aec80e41a7cc3a2 /plugins/uml/nattable
parentdf6704233ea18a2485de2709a6647ab9205cdba9 (diff)
downloadorg.eclipse.papyrus-a8eff70353f9eed43cef212267a0117c458ab575.tar.gz
org.eclipse.papyrus-a8eff70353f9eed43cef212267a0117c458ab575.tar.xz
org.eclipse.papyrus-a8eff70353f9eed43cef212267a0117c458ab575.zip
Bug 520566: [Matrix][Table] the second columns sources for Matrix is not persisted
- fix the initial bug - fix the same bug for row sources - fix a bug when there are several column sources : we made list = new list instead of list.addAll(newList) - fix undo/redo refresh in the property view Change-Id: I68dcefbb931fc13c49204e67d7f0bf7b31e5e57b Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/nattable')
-rwxr-xr-xplugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java35
-rwxr-xr-xplugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java6
2 files changed, 28 insertions, 13 deletions
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java
index 0561ef638ae..a3c1b043762 100755
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixColumnSourcesEMFObservableList.java
@@ -8,7 +8,7 @@
*
* Contributors:
* Vincent LORENZO (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Vincent LORENZO (CEA-LIST) bug 520566
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.properties.observables;
@@ -19,6 +19,7 @@ import java.util.Collection;
import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
@@ -81,18 +82,29 @@ public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesE
* @return
*/
@Override
- public boolean addAll(Collection c) {
+ public boolean addAll(@SuppressWarnings("rawtypes") Collection c) {
// 1. we build EOBjectWrapper to wrap the element selected by the user and be able to store them in the Table as column context
final Collection<IWrapper> toAdd = new ArrayList<IWrapper>();
for (final Object current : c) {
if (current instanceof IWrapper) {
// we recreate a wrapper, because the previous one will be destroyed in few time by the remove all command previously executed
+ // not sure we enter in this if...
final EObjectWrapper wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper();
wrapper.setElement((EObject) ((IWrapper) current).getElement());
toAdd.add(wrapper);
} else if (current instanceof EObject) {
- final EObjectWrapper wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper();
- wrapper.setElement((EObject) current);
+ EObjectWrapper wrapper = null;
+ // 1. we check if the current EObject is already wrapped (it allow to avoid Undo/Redo bug
+ for (final Object current1 : this.concreteList.toArray()) {
+ if (current1 instanceof IWrapper && ((IWrapper) current1).getElement() == current) {
+ wrapper = (EObjectWrapper) current1;
+ break;
+ }
+ }
+ if (null == wrapper) {
+ wrapper = NattablewrapperFactory.eINSTANCE.createEObjectWrapper();
+ wrapper.setElement((EObject) current);
+ }
toAdd.add(wrapper);
}
}
@@ -197,9 +209,10 @@ public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesE
*/
@Override
public Command getRemoveAllCommand(Collection<?> values) {
- // 1. we edit the field column context
- Command cmd = super.getRemoveAllCommand(values);
- return cmd;
+ return RemoveCommand.create(this.editingDomain, this.source, this.feature, values); // bug 520566
+ // Command cmd = super.getRemoveAllCommand(values);
+ // return cmd;
+
}
@@ -266,7 +279,7 @@ public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesE
* @return
*/
@Override
- public boolean addAll(int index, Collection c) {
+ public boolean addAll(int index, @SuppressWarnings("rawtypes") Collection c) {
throw new UnsupportedOperationException();
}
@@ -278,7 +291,7 @@ public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesE
* @return
*/
@Override
- public boolean removeAll(Collection c) {
+ public boolean removeAll(@SuppressWarnings("rawtypes") Collection c) {
throw new UnsupportedOperationException();
}
@@ -290,7 +303,7 @@ public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesE
* @return
*/
@Override
- public boolean retainAll(Collection c) {
+ public boolean retainAll(@SuppressWarnings("rawtypes") Collection c) {
throw new UnsupportedOperationException();
}
@@ -339,7 +352,7 @@ public class MatrixColumnSourcesEMFObservableList extends AbstractMatrixSourcesE
* @return
*/
@Override
- public boolean containsAll(Collection c) {
+ public boolean containsAll(@SuppressWarnings("rawtypes") Collection c) {
throw new UnsupportedOperationException();
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java
index cea0fc0d392..a62b65efe9f 100755
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.properties/src/org/eclipse/papyrus/uml/nattable/properties/observables/MatrixRowSourcesEMFObservableList.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager;
@@ -222,8 +223,9 @@ public class MatrixRowSourcesEMFObservableList extends AbstractMatrixSourcesEMFO
@Override
public Command getRemoveAllCommand(Collection<?> values) {
// 1. we edit the field row context
- Command cmd = super.getRemoveAllCommand(values);
-
+// Command cmd = super.getRemoveAllCommand(values);
+ Command cmd = RemoveCommand.create(this.editingDomain, this.source, this.feature, values); // bug 520566
+
// 2. we are looking for the element represented by the deleted row contexts
final List<Object> toRemove = new ArrayList<Object>();
for (Object current : values) {

Back to the top