summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-04-23 11:14:00 (EDT)
committerBenoit Maggi2014-04-23 11:14:57 (EDT)
commit875d6ff47c03bb985acc9eb6329a7add1ea39a7e (patch)
tree1ee6bcad1eb14fa721de97e98afb1ca772ba6cfe
parent403f4eca218593c7ddcc3c0992861115b8df1650 (diff)
downloadorg.eclipse.papyrus-875d6ff47c03bb985acc9eb6329a7add1ea39a7e.zip
org.eclipse.papyrus-875d6ff47c03bb985acc9eb6329a7add1ea39a7e.tar.gz
org.eclipse.papyrus-875d6ff47c03bb985acc9eb6329a7add1ea39a7e.tar.bz2
Bug 433274 - [Model explorer] Duplicate diagram linkrefs/changes/28/25428/2
Same problem with table. Use == instead of equals to validate the owner of a table in the model explorer Change-Id: I8d65db26189a73d4fec6ef0f9998fe9763497bec Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetContainedTables.java6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/IsTableContainer.java97
2 files changed, 51 insertions, 52 deletions
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 23bef14..2a40f70 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
@@ -17,7 +17,6 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
@@ -39,8 +38,9 @@ public class GetContainedTables extends AbstractEditorContainerQuery implements
while(roots.hasNext()) {
EObject root = roots.next();
if (root instanceof Table) {
- if (EcoreUtil.equals(((Table) root).getOwner(), source)) {
- result.add((Table) root);
+ Table table = (Table) root;
+ if (table.getOwner() == source) {
+ result.add(table);
}
}
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/IsTableContainer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/IsTableContainer.java
index 21de422..73a6cdb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/IsTableContainer.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/IsTableContainer.java
@@ -1,49 +1,48 @@
-/**
- * Copyright (c) 2011 Atos.
- *
- * 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
- *
- * Contributors:
- * Atos - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.infra.nattable.modelexplorer.queries;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
-import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
-import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
-
-public class IsTableContainer extends AbstractEditorContainerQuery implements IJavaQuery2<EObject, Boolean> {
-
- /**
- * Return true if the element is a Table Container
- */
- @Override
- public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- Iterator<EObject> roots = NavigatorUtils.getNotationRoots(source);
- if(roots == null) {
- return false;
- }
-
- while(roots.hasNext()) {
- EObject root = roots.next();
- if(root instanceof Table) {
- if(EcoreUtil.equals(((Table)root).getOwner(), source)) {
- return true;
- }
- }
- }
- return false;
- }
-}
+/**
+ * Copyright (c) 2011 Atos.
+ *
+ * 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
+ *
+ * Contributors:
+ * Atos - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.nattable.modelexplorer.queries;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
+
+public class IsTableContainer extends AbstractEditorContainerQuery implements IJavaQuery2<EObject, Boolean> {
+
+ /**
+ * Return true if the element is a Table Container
+ */
+ @Override
+ public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
+ Iterator<EObject> roots = NavigatorUtils.getNotationRoots(source);
+ if(roots == null) {
+ return false;
+ }
+
+ while(roots.hasNext()) {
+ EObject root = roots.next();
+ if(root instanceof Table) {
+ if(((Table)root).getOwner() == source) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}