summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-04-23 04:20:07 (EDT)
committerBenoit Maggi2014-04-23 04:29:18 (EDT)
commit73b7c7574c3d4cf61621ce47e0c5d57dbd75e003 (patch)
treeac3a49da621e0ad00ff6b5dc7b7b9fb10f603631
parentac6ed01aec9b40bcf5402147964f1d68b4691cb1 (diff)
downloadorg.eclipse.papyrus-73b7c7574c3d4cf61621ce47e0c5d57dbd75e003.zip
org.eclipse.papyrus-73b7c7574c3d4cf61621ce47e0c5d57dbd75e003.tar.gz
org.eclipse.papyrus-73b7c7574c3d4cf61621ce47e0c5d57dbd75e003.tar.bz2
Bug 433274 - [Model explorer] Duplicate diagram linkrefs/changes/91/25391/1
Use == instead of equals to validate the owner of a diagram in the model explorer Change-Id: If284b7e9765e16587ccb0e64a418acfb84ffa618 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetContainedDiagrams.java8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/IsDiagramContainer.java97
2 files changed, 51 insertions, 54 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetContainedDiagrams.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetContainedDiagrams.java
index c9ebb4e..967aeec 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetContainedDiagrams.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetContainedDiagrams.java
@@ -18,13 +18,12 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
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.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
@@ -42,8 +41,9 @@ public class GetContainedDiagrams extends AbstractEditorContainerQuery implement
while(roots.hasNext()) {
EObject root = roots.next();
if(root instanceof Diagram) {
- if (EcoreUtil.equals(DiagramUtils.getOwner((Diagram) root), source)) {
- result.add((Diagram)root);
+ Diagram diagram = (Diagram)root;
+ if (DiagramUtils.getOwner(diagram) == source) {
+ result.add(diagram);
}
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/IsDiagramContainer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/IsDiagramContainer.java
index 8eab806..223a6b5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/IsDiagramContainer.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/IsDiagramContainer.java
@@ -1,50 +1,47 @@
-/**
- * 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.gmfdiag.modelexplorer.queries;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-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.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
-import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
-
-public class IsDiagramContainer extends AbstractEditorContainerQuery implements IJavaQuery2<EObject, Boolean> {
-
- /**
- * Return true if the element is a Diagram Container
- */
- public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
- Iterator<EObject> roots = NavigatorUtils.getNotationRoots(source);
-
- if(roots != null) {
- while(roots.hasNext()) {
- EObject root = roots.next();
- if(root instanceof Diagram) {
- if(EcoreUtil.equals(DiagramUtils.getOwner((Diagram)root), source)) {
- return true;
- }
- }
- }
- }
-
- return false; //Return super...
- }
-
-}
+/**
+ * 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.gmfdiag.modelexplorer.queries;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+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.gmfdiag.common.utils.DiagramUtils;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
+
+public class IsDiagramContainer extends AbstractEditorContainerQuery implements IJavaQuery2<EObject, Boolean> {
+
+ /**
+ * Return true if the element is a Diagram Container
+ */
+ public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
+ Iterator<EObject> roots = NavigatorUtils.getNotationRoots(source);
+
+ if(roots != null) {
+ while(roots.hasNext()) {
+ EObject root = roots.next();
+ if(root instanceof Diagram) {
+ return DiagramUtils.getOwner((Diagram)root) == source;
+ }
+ }
+ }
+
+ return false; //Return super...
+ }
+
+}