aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanh Liem PHAN2017-07-19 06:02:05 -0400
committervincent lorenzo2017-10-13 08:01:44 -0400
commit1170fefd83bfcfbbaa386dedaf0218fcc42f56dd (patch)
tree1ad12543edf66df39c4c368bb4fbdbd611982947
parent27d668fc3c136859772e10b92b59bc6df1cb9eb2 (diff)
downloadorg.eclipse.papyrus-1170fefd83bfcfbbaa386dedaf0218fcc42f56dd.zip
org.eclipse.papyrus-1170fefd83bfcfbbaa386dedaf0218fcc42f56dd.tar.gz
org.eclipse.papyrus-1170fefd83bfcfbbaa386dedaf0218fcc42f56dd.tar.xz
Bug 516314: [Table] DnD new objects in Generic Table when a boolean
filter is applied duplicate the display rows when the filter is removed https://bugs.eclipse.org/bugs/show_bug.cgi?id=516314 - Get and clear the sorted list instead of the filter list Change-Id: I7142794fc550a69788270f3b5c28d2f74fa43983 Signed-off-by: Thanh Liem PHAN <thanhliem.phan@all4tec.net>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java45
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java23
2 files changed, 45 insertions, 23 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java
index d4b2ac9..cd20c4e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,7 +10,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 469289, 504077
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 516314
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.axis;
@@ -300,7 +300,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#getAddAxisCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.util.Collection, int)
*
* @param domain
@@ -340,7 +340,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#getComplementaryAddAxisCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.util.Collection, int)
*
* @param domain
@@ -720,6 +720,19 @@ public abstract class AbstractAxisManager implements IAxisManager {
}
/**
+ * @return
+ * the list owning the elements sorted on the managed axis
+ * @since 4.0
+ */
+ protected final List<Object> getSortedElements() {
+ if (isUsedAsColumnManager()) {
+ return getTableManager().getColumnSortedList();
+ } else {
+ return getTableManager().getRowSortedList();
+ }
+ }
+
+ /**
*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*
@@ -751,7 +764,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* This allows to manage the managed objects during the add command.
- *
+ *
* @author Nicolas FAUVERGUE
*/
protected class AddCommandWrapper extends ReorderAxisCommandWrapper {
@@ -777,7 +790,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#execute()
*/
@Override
@@ -790,7 +803,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#undo()
*/
@Override
@@ -803,7 +816,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#redo()
*/
@Override
@@ -817,7 +830,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* This allows to manage the managed objects during the remove command.
- *
+ *
* @author Nicolas FAUVERGUE
*/
protected class RemoveCommandWrapper extends ReorderAxisCommandWrapper {
@@ -844,7 +857,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#execute()
*/
@Override
@@ -857,7 +870,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#undo()
*/
@Override
@@ -870,7 +883,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#redo()
*/
@Override
@@ -886,7 +899,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
* This allows to manage a wrapper after the reorder columns or rows.
* This can't me managed by the notification (in the NattableModelManager class)
* because the move action is managed as REMOVE and ADD notifications.
- *
+ *
* @author Nicolas FAUVERGUE
*/
protected class ReorderAxisCommandWrapper extends CommandWrapper {
@@ -922,7 +935,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#execute()
*/
@Override
@@ -933,7 +946,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#undo()
*/
@Override
@@ -944,7 +957,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.common.command.CommandWrapper#redo()
*/
@Override
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java
index 0919d52..20f69d6 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,7 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@cea.fr - Bug 516314
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.axis;
@@ -247,7 +247,7 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getAddAxisCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.util.Collection, int)
*
* @param domain
@@ -294,7 +294,7 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos
}
/**
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#getComplementaryAddAxisCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.util.Collection, int)
*
* @param domain
@@ -325,8 +325,17 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos
@Override
public synchronized void updateAxisContents() {
final List<Object> displayedElement = getElements();
+
+ // Bug 516314: As the filter list wraps the row sorted list (see NattableModelManager.createHorizontalElementList or createVerticcalElementList),
+ // adding element in the outer list implies the change in the inner list, which causes the double elements in the sorted list,
+ // which could be seen as the filter is not used anymore.
+ // So the clear the sorted list instead of the filter list could handle the bug.
+ final List<Object> sortedElement = getSortedElements();
+
+ // Clear the sorted list which also clear the filter list
+ sortedElement.clear();
+
synchronized (displayedElement) {
- displayedElement.clear();
displayedElement.addAll(this.managedObject);
if (this.subManagers != null) {
for (final IAxisManager current : this.subManagers) {
@@ -379,7 +388,7 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#sortAxisByName(boolean, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
*/
@Override
@@ -555,7 +564,7 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos
final List<Object> newAxisOrder = new ArrayList<Object>(getRepresentedContentProvider().getAxis());
newAxisOrder.remove(elementToMove);
newAxisOrder.add(newIndex, elementToMove);
-
+
domain.getCommandStack().execute(getSetNewAxisOrderCommand(newAxisOrder));
}
}