aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanh Liem PHAN2017-07-20 12:07:28 -0400
committervincent lorenzo2017-10-13 11:47:14 -0400
commitc29b31d0a4f2d765751027b02288f0fb7c77f91f (patch)
tree6f6e4805c65b618d257f709d994398a43ce23653
parentf7a646f5bb66bf67f2e43bd0f94fac42675c22f7 (diff)
downloadorg.eclipse.papyrus-c29b31d0a4f2d765751027b02288f0fb7c77f91f.zip
org.eclipse.papyrus-c29b31d0a4f2d765751027b02288f0fb7c77f91f.tar.gz
org.eclipse.papyrus-c29b31d0a4f2d765751027b02288f0fb7c77f91f.tar.xz
Bug 516882: [Table] Undoing the creation of the table doesn't work
properly, the table continues to be visible in the model explorer https://bugs.eclipse.org/bugs/show_bug.cgi?id=516882 - Fix the bug in Model Explorer and in the Welcome page Change-Id: I92b1b4743cf71946184b3f1d35ef5b3f9d725752 Signed-off-by: Thanh Liem PHAN <thanhliem.phan@all4tec.net> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableCommandHelper.java15
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetContainedTables.java9
2 files changed, 15 insertions, 9 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableCommandHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableCommandHelper.java
index c5f111d..ba1cae0 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableCommandHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableCommandHelper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,7 +9,7 @@
*
* Contributors:
* Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 516882
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.common.helper;
@@ -20,7 +20,6 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager;
import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentationKind;
-import org.eclipse.papyrus.infra.core.architecture.RepresentationKind;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage;
@@ -68,7 +67,11 @@ public class TableCommandHelper implements IViewTypeHelper {
return false;
}
Table table = (Table) view;
- return (table.getTableKindId() != null);
+ // Bug 516882: When undoing table creation, table kind ID is null leads to the fact that
+ // table view is not removed from the list of observables.
+ // As a consequence, the broken table view remains in the Welcome page / Notation Views.
+ // Checking also the table configuration could handle this problem.
+ return (table.getTableKindId() != null || table.getTableConfiguration() != null);
}
@Override
@@ -78,8 +81,8 @@ public class TableCommandHelper implements IViewTypeHelper {
}
PolicyChecker checker = PolicyChecker.getFor(view);
ArchitectureDomainManager manager = ArchitectureDomainManager.getInstance();
- PapyrusTable repKind = (PapyrusTable) manager.getRepresentationKindById(((Table)view).getTableKindId());
- if (checker.isInViewpoint(repKind))
+ PapyrusTable repKind = (PapyrusTable) manager.getRepresentationKindById(((Table) view).getTableKindId());
+ if (null != repKind && checker.isInViewpoint(repKind)) // null when we are destroying the table (undo after a creation for example), bug 516882
return getPrototypeFor(repKind);
return ViewPrototype.UNAVAILABLE_VIEW;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetContainedTables.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetContainedTables.java
index 79d1518..bb39291 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetContainedTables.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetContainedTables.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 516882
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.modelexplorer.queries;
@@ -37,8 +38,10 @@ public class GetContainedTables implements IJavaQuery2<EObject, Collection<Table
EObject usingElement = setting.getEObject();
if (usingElement instanceof Table) {
Table table = (Table) usingElement;
- EObject parent = table.getOwner() == null ? table.getContext() : table.getOwner();
- if (parent == source) {
+ // Bug 516882: When undoing table creation, table should not be added to the contained tables list.
+ // Otherwise, the broken table view remains in the Model explorer.
+ // Checking table owner not null could handles this problem.
+ if (null != table.getOwner() && table.getOwner() == source && !result.contains(table)) {
result.add(table);
}
}