Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2018-07-11 10:11:18 +0000
committerCamille Letavernier2018-07-11 12:47:07 +0000
commit6e1e6f8aff622d6832ea9f9484de49c0bddad532 (patch)
treea5d528b4a7f6ce86dfdbc57eb401c4a3a2bb0d3f
parentb584d9ddccfe121cb8ef46308bcf30d2df372b6b (diff)
downloadorg.eclipse.papyrus-collaborativemodeling-6e1e6f8aff622d6832ea9f9484de49c0bddad532.tar.gz
org.eclipse.papyrus-collaborativemodeling-6e1e6f8aff622d6832ea9f9484de49c0bddad532.tar.xz
org.eclipse.papyrus-collaborativemodeling-6e1e6f8aff622d6832ea9f9484de49c0bddad532.zip
Change the ProxyingResourceList#contains method to take into account the
fact that we break the EMF rule for bidirectionnal reference between a Resource and its ResourceSet Change-Id: I888a207b6edf6a2594d0f6557a7301ace4a56a23 Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
-rw-r--r--plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/hook/migration/ModelSetWrapper.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/hook/migration/ModelSetWrapper.java b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/hook/migration/ModelSetWrapper.java
index 6b521eec..792683a9 100644
--- a/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/hook/migration/ModelSetWrapper.java
+++ b/plugins/compare/bundles/org.eclipse.papyrus.compare.uml2/src/org/eclipse/papyrus/compare/uml2/internal/hook/migration/ModelSetWrapper.java
@@ -335,6 +335,37 @@ public class ModelSetWrapper extends ModelSet {
}
}
+ @Override
+ public boolean contains(Object object) {
+ // XXX The super implementation only works up to the 5th element.
+ // Because we're cheating with proxies, the super impl will consider
+ // that we already contain this resource.
+ // Basically, we can't trust the bidirectionnal reference between Resource
+ // and ResourceSet because of the proxy; but EMF does trust it.
+ boolean result = super.contains(object);
+
+ if (result && object instanceof Resource && isProxy((Resource)object)) {
+ // Let's double-check... Copy the super-super implementation
+ if (useEquals()) {
+ for (int i = 0; i < size; ++i) {
+ if (object.equals(data[i])) {
+ return true;
+ }
+ }
+ } else {
+ for (int i = 0; i < size; ++i) {
+ if (data[i] == object) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ return result;
+ }
+
/**
* Removes my proxy for the given {@code resource} if I have one
*

Back to the top