-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1301] Add support for inter model references #1303
Conversation
8e40211
to
c31aa7b
Compare
808999e
to
04af067
Compare
I don't have any issue with the content of this specific pull request (apart from the minor issues detected by @pcdavid) but the Sirius Web side of this pull request still need too much work to be part of 2022.9.0. It will thus be rescheduled for 2022.11.0. |
a4dbaf1
to
688eee5
Compare
688eee5
to
039c91e
Compare
1c21955
to
79636c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not actually tested yet in practice, but I publish my remarks anyway. More may come after testing.
...ain/java/org/eclipse/sirius/components/emf/services/EditingContextCrossReferenceAdapter.java
Outdated
Show resolved
Hide resolved
...ain/java/org/eclipse/sirius/components/emf/services/EditingContextCrossReferenceAdapter.java
Outdated
Show resolved
Hide resolved
...ain/java/org/eclipse/sirius/components/emf/services/EditingContextCrossReferenceAdapter.java
Outdated
Show resolved
Hide resolved
Collection<Setting> settings = this.getInverseReferences(referencedObject); | ||
|
||
if (settings != null) { | ||
Collection<Setting> nonContainmentReferences = this.getNonContainmentReferences(settings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method (removeProxyFromInverseReference
) will be called a lot. It should be as efficient as possible. It should do the iteration and test on the references itself instead of calling getNonContainmentReferences
which allocates a new ArrayList
every time.
Maybe it should even avoid calling getInverseReferences
(which does quite a lot of work, some which may not be needed in our case) and use ECrossReferenceAdapter.inverseCrossReferencer
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to ECrossReferenceAdapter.inverseCrossReferencer
directly but it fails for the EOpposite
features.
It is actually, the aim of getNonContainmentReferences
to manage the EOpposite
...ain/java/org/eclipse/sirius/components/emf/services/EditingContextCrossReferenceAdapter.java
Show resolved
Hide resolved
...onents-emf/src/main/java/org/eclipse/sirius/components/emf/services/JSONResourceFactory.java
Show resolved
Hide resolved
...onents-emf/src/main/java/org/eclipse/sirius/components/emf/services/JSONResourceFactory.java
Outdated
Show resolved
Hide resolved
79636c6
to
397e410
Compare
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
Bug: #1300 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
...onents-emf/src/main/java/org/eclipse/sirius/components/emf/services/JSONResourceFactory.java
Outdated
Show resolved
Hide resolved
397e410
to
827b461
Compare
...onents-emf/src/main/java/org/eclipse/sirius/components/emf/services/JSONResourceFactory.java
Outdated
Show resolved
Hide resolved
The referenced object concrete type is now serialized in JSON resource JSON resources should now be created with the right scheme Bug: #1301 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
This adapter specializes ECrossReferenceAdapter in case of deletion of an EObject or a Resource in order to: * clean the proxies of the inverse references * clean the ECrossReferenceAdapter itself Bug: #1301 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
a465a59
to
bc4002c
Compare
...es/src/main/java/org/eclipse/sirius/web/services/explorer/RenameDocumentTreeItemHandler.java
Outdated
Show resolved
Hide resolved
boolean eObjectcontainsAProxy = eObject.eClass().getEAllReferences().stream() | ||
.filter(ref -> !ref.isContainment() && eObject.eIsSet(ref)) | ||
.filter(ref -> { | ||
boolean containsAProxy = false; | ||
Object value = eObject.eGet(ref); | ||
if (ref.isMany()) { | ||
List<?> list = (List<?>) value; | ||
containsAProxy = list.stream() | ||
.filter(EObject.class::isInstance) | ||
.map(EObject.class::cast) | ||
.filter(EObject::eIsProxy) | ||
.findFirst() | ||
.isPresent(); | ||
} else { | ||
containsAProxy = ((EObject) value).eIsProxy(); | ||
} | ||
return containsAProxy; | ||
}) | ||
.findFirst() | ||
.isPresent(); | ||
|
||
return eObjectcontainsAProxy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screams for a separate helper method, and just:
.filter(this::hasProxyReferences)
bc4002c
to
34eeb0d
Compare
* Use a correct URI to instantiate a JSONResource. The URI should have a scheme "sirius" * Only resources with "sirius" scheme are persisted and displayed in the Explorer * This commit also ensures that, if a specific resource factory has been registered, it will be used to instantiate the XMI resource at download * Forbid the upload of a single document that contains proxies. The check is not done when uploading a project. #1301 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
34eeb0d
to
adbf143
Compare
ticket #1300 and #1301