From 6c7e19695c8978f635900ada6e8ceaadcdab337e Mon Sep 17 00:00:00 2001 From: Arthur Daussy Date: Mon, 8 Sep 2014 17:29:53 +0200 Subject: [PATCH] [443330] Load UML static profile using path map Improves the UMLLoadOnDemandPolicy in order to load static profile referenced by a URI using pathmap. The previous implementation did not resolve the URI using pathmap, it implies some use cases where the profile was not loaded because it was referenced using a pathmap URI whereas the profile was registered using a "platform:/plugin/" URI. Change-Id: Ib7a6c111dea9c4cf1c747ba661a8a483b9562a64 Signed-off-by: Arthur Daussy --- .../compare/uml2/rcp/internal/policy/UMLLoadOnDemandPolicy.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp/src/org/eclipse/emf/compare/uml2/rcp/internal/policy/UMLLoadOnDemandPolicy.java b/plugins/org.eclipse.emf.compare.uml2.rcp/src/org/eclipse/emf/compare/uml2/rcp/internal/policy/UMLLoadOnDemandPolicy.java index 6530200be..9ecd2a610 100644 --- a/plugins/org.eclipse.emf.compare.uml2.rcp/src/org/eclipse/emf/compare/uml2/rcp/internal/policy/UMLLoadOnDemandPolicy.java +++ b/plugins/org.eclipse.emf.compare.uml2.rcp/src/org/eclipse/emf/compare/uml2/rcp/internal/policy/UMLLoadOnDemandPolicy.java @@ -15,6 +15,8 @@ import java.util.Map; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.compare.rcp.policy.ILoadOnDemandPolicy; +import org.eclipse.emf.ecore.resource.URIConverter; +import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; import org.eclipse.uml2.uml.UMLPlugin; /** @@ -28,11 +30,16 @@ public class UMLLoadOnDemandPolicy implements ILoadOnDemandPolicy { * @see org.eclipse.emf.compare.ide.policy.ILoadOnDemandPolicy#isAuthorizing(org.eclipse.emf.compare.ide.policy.URI) */ public boolean isAuthorizing(URI uri) { + URIConverter uriConverter = new ExtensibleURIConverterImpl(); + // Need to normalize the URI in order to resolve URI using path map + URI normalizedURI = uriConverter.normalize(uri); Map nsURIToProfileLocationMap = UMLPlugin.getEPackageNsURIToProfileLocationMap(); Collection profileLocations = nsURIToProfileLocationMap.values(); for (URI profileLocation : profileLocations) { URI profileResourceLocation = profileLocation.trimFragment(); - if (profileResourceLocation.equals(uri)) { + // Need to normalize the URI in order to resolve URI using path map + URI profileResourceNormalizedURI = uriConverter.normalize(profileResourceLocation); + if (profileResourceNormalizedURI.equals(normalizedURI)) { return true; } } -- 2.11.4.GIT