Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-07-26 13:28:39 +0000
committervlorenzo2012-07-26 13:28:39 +0000
commit3ac3bbda397f432dd74a3a2163b6a957a6fcb4b2 (patch)
treeecd712082ef66e2b4a114a787280c853cec582ac /extraplugins
parentb64837c50e99b41701e7a8de86abffdfe2500517 (diff)
downloadorg.eclipse.papyrus-3ac3bbda397f432dd74a3a2163b6a957a6fcb4b2.tar.gz
org.eclipse.papyrus-3ac3bbda397f432dd74a3a2163b6a957a6fcb4b2.tar.xz
org.eclipse.papyrus-3ac3bbda397f432dd74a3a2163b6a957a6fcb4b2.zip
384490: [UML Compare] Comparison between stereotyped elements doesn't work in the nested Compare Editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=384490 386042: [UML Compare] The nested Compare Editor should allow to do comparison between an element owned by a resource and an element not owned in a resource https://bugs.eclipse.org/bugs/show_bug.cgi?id=386042
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java19
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java35
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java4
3 files changed, 42 insertions, 16 deletions
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java
index 74d7798be0c..189020080bb 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java
@@ -18,6 +18,7 @@ import java.util.List;
import org.eclipse.emf.compare.match.engine.DefaultMatchScope;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.uml2.uml.util.UMLUtil;
/**
@@ -35,18 +36,28 @@ public class NestedUMLStereotypeApplicationMatchScope extends DefaultMatchScope
/**
*
* Constructor.
+ *
+ * @param el
+ * @param stereotypeApplication
+ */
+ public NestedUMLStereotypeApplicationMatchScope(final EObject el, final List<EObject> stereotypeApplication) {
+ super(el);
+ this.stereotypeApplication = new ArrayList<EObject>(stereotypeApplication);
+ }
+
+ /**
+ *
+ * Constructor.
*
* @param el
* the element
* @param stereotypeApplication
* the list of the stereotype application known by this scope
*/
- public NestedUMLStereotypeApplicationMatchScope(final EObject el, final List<EObject> stereotypeApplication) {
- super(el.eResource());
+ public NestedUMLStereotypeApplicationMatchScope(final Resource res, final List<EObject> stereotypeApplication){
+ super(res);
this.stereotypeApplication = new ArrayList<EObject>(stereotypeApplication);
-
}
-
/**
*
* @see org.eclipse.emf.compare.match.engine.GenericMatchScope#isInScope(org.eclipse.emf.ecore.EObject)
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java
index dd3d9bd5d28..510ce45f437 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java
@@ -28,7 +28,7 @@ import org.eclipse.uml2.uml.Element;
/**
*
* Created to resolve the bug 384490: [UML Compare] Comparison between stereotyped elements doesn't work in the nested Compare Editor
- *
+ *
*/
public class NestedUMLStereotypeApplicationMatchScopeProvider implements IMatchScopeProvider {
@@ -37,14 +37,14 @@ public class NestedUMLStereotypeApplicationMatchScopeProvider implements IMatchS
*
* @since 1.3
*/
- protected IMatchScope leftScope;
+ final protected IMatchScope leftScope;
/**
* The match scope used for the right side of comparison.
*
* @since 1.3
*/
- protected IMatchScope rightScope;
+ final protected IMatchScope rightScope;
/**
* The match scope used for the ancestor side of comparison.
@@ -63,18 +63,31 @@ public class NestedUMLStereotypeApplicationMatchScopeProvider implements IMatchS
* the {@link EObject}, which will be used to construct the right scope
*/
public NestedUMLStereotypeApplicationMatchScopeProvider(EObject leftObject, EObject rightObject) {
- List<EObject> leftSte = new ArrayList<EObject>();
- List<EObject> rightSte = new ArrayList<EObject>();
- if(leftObject instanceof Element){
+ final List<EObject> leftSte = new ArrayList<EObject>();
+ final List<EObject> rightSte = new ArrayList<EObject>();
+ if(leftObject instanceof Element) {
leftSte.addAll(((Element)leftObject).getStereotypeApplications());
- leftSte.addAll(((Element)leftObject).getNearestPackage().getAllProfileApplications());
+ if(((Element)leftObject).getNearestPackage() != null) {
+ leftSte.addAll(((Element)leftObject).getNearestPackage().getAllProfileApplications());
+ }
}
- if(rightObject instanceof Element){
+ if(rightObject instanceof Element) {
rightSte.addAll(((Element)rightObject).getStereotypeApplications());
- rightSte.addAll(((Element)leftObject).getNearestPackage().getAllProfileApplications());
+ if(((Element)rightObject).getNearestPackage() != null) {
+ rightSte.addAll(((Element)rightObject).getNearestPackage().getAllProfileApplications());
+ }
+ }
+ if(leftObject.eResource() != null) {
+ this.leftScope = new NestedUMLStereotypeApplicationMatchScope(leftObject.eResource(), leftSte);
+ } else {
+ this.leftScope = new NestedUMLStereotypeApplicationMatchScope(leftObject, leftSte);
+ }
+
+ if(rightObject.eResource() != null) {
+ this.rightScope = new NestedUMLStereotypeApplicationMatchScope(rightObject.eResource(), rightSte);
+ } else {
+ this.rightScope = new NestedUMLStereotypeApplicationMatchScope(rightObject, rightSte);
}
- this.leftScope = new NestedUMLStereotypeApplicationMatchScope(leftObject, leftSte);
- this.rightScope = new NestedUMLStereotypeApplicationMatchScope(rightObject, rightSte);
}
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java
index 18bd0375f40..a84fcb3074c 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java
@@ -61,7 +61,9 @@ public class UMLMatchEngine extends UMLStandaloneMatchEngine {//GenericMatchEngi
this.leftObject = leftObject;
this.rightObject = rightObject;
final MatchModel matchModel = super.contentMatch(leftObject, rightObject, optionMap);
- completeMatchModelWithUMLDifferences(matchModel, leftObject, rightObject, optionMap);
+ if(this.leftObject.eResource() != null && this.rightObject.eResource() != null) {
+ completeMatchModelWithUMLDifferences(matchModel, leftObject, rightObject, optionMap);
+ }
return matchModel;
}

Back to the top