diff options
| author | Laurent Fasani | 2017-06-19 08:21:14 +0000 |
|---|---|---|
| committer | Laurent Fasani | 2017-07-07 15:49:51 +0000 |
| commit | cd18b3692fd9ff990108e17076dcd99d6e02e070 (patch) | |
| tree | 3aa7a35739ccef5a412806c1478367913123e2af | |
| parent | 6fbc16f1b938387bfa110ff79732abb14ae7b588 (diff) | |
| download | org.eclipse.sirius-cd18b3692fd9ff990108e17076dcd99d6e02e070.tar.gz org.eclipse.sirius-cd18b3692fd9ff990108e17076dcd99d6e02e070.tar.xz org.eclipse.sirius-cd18b3692fd9ff990108e17076dcd99d6e02e070.zip | |
[516669] Add DRD.isLoadedRepresentation and make DRD.getRepresentation
not lazy
* DRD.getRepresentation will load the representation except if
"forceRepLazyLoading" environment variable is set to true.
* To prepare the representation lazy loading, DRD.isLoadedRepresentation
is added to avoid calling DRD.getRepresentation if we don't want to load
the representation.
Bug: 516669
Change-Id: If04008f393d02016ae7eacdef21de368acc03d47
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
2 files changed, 15 insertions, 4 deletions
diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/DRepresentationDescriptor.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/DRepresentationDescriptor.java index be4d68072d..109dbc7abc 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/DRepresentationDescriptor.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/DRepresentationDescriptor.java @@ -124,6 +124,17 @@ public interface DRepresentationDescriptor extends DModelElement { DRepresentation getRepresentation(); /** + * Tells if the representation associated this {@link DRepresentationDescriptor} is loaded.</br> + * Knowing that {@code getRepresentation} will load the representation, the method is useful for client that would + * implement the representation lazy loading. + * + * @return true if the representation is loaded. + */ + default boolean isLoadedRepresentation() { + return eIsSet(ViewpointPackage.eINSTANCE.getDRepresentationDescriptor_Representation()); + } + + /** * Sets the value of the '{@link org.eclipse.sirius.viewpoint.DRepresentationDescriptor#getRepresentation * <em>Representation</em>}' reference. <!-- begin-user-doc -->If the newRepresentation value is not null, the * newRepresentation.eResource must not be null.<!-- end-user-doc --> @@ -142,7 +153,6 @@ public interface DRepresentationDescriptor extends DModelElement { * @param representation * the {@link DRepresentation} to update path. */ - default void updateRepresentation(DRepresentation representation) { Optional.ofNullable(representation).ifPresent(rep -> Assert.isNotNull(rep.eResource())); DRepresentationDescriptorToDRepresentationLinkManager pathManager = new DRepresentationDescriptorToDRepresentationLinkManager(this); diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/DRepresentationDescriptorImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/DRepresentationDescriptorImpl.java index 2dc57e357c..b976997f47 100644 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/DRepresentationDescriptorImpl.java +++ b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/viewpoint/impl/DRepresentationDescriptorImpl.java @@ -234,12 +234,13 @@ public class DRepresentationDescriptorImpl extends DModelElementImpl implements /** * <!-- begin-user-doc --> <!-- end-user-doc --> * - * @generated + * @generated NOT */ @Override public DRepresentation getRepresentation() { - DRepresentation representation = basicGetRepresentation(); - return representation != null && representation.eIsProxy() ? (DRepresentation) eResolveProxy((InternalEObject) representation) : representation; + DRepresentationDescriptorToDRepresentationLinkManager pathManager = new DRepresentationDescriptorToDRepresentationLinkManager(this); + Optional<DRepresentation> representation = pathManager.getRepresentation(true); + return representation.orElse(null); } /** |
