Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created February 6, 2013 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edipofederle/4725342 to your computer and use it in GitHub Desktop.
Save edipofederle/4725342 to your computer and use it in GitHub Desktop.
protected void registerPathmaps() {
String umlResourcePath = UMLResourcesUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
try {
umlResourcePath = URLDecoder.decode(umlResourcePath, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
URI umlResourcePluginURI = URI.createURI("jar:file:" + umlResourcePath + "!/");
RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
umlResourcePluginURI.appendSegment("libraries").appendSegment(""));
RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
umlResourcePluginURI.appendSegment("metamodels").appendSegment(""));
RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI),
umlResourcePluginURI.appendSegment("libraries").appendSegment("UMLPrimitiveTypes.library.uml"));
RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.UML_METAMODEL_URI),
umlResourcePluginURI.appendSegment("metamodels").appendSegment("UML.metamodel.uml"));
RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.UML2_PROFILE_URI),
umlResourcePluginURI.appendSegment("profiles").appendSegment("UML2.profile.uml"));
RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.STANDARD_L2_PROFILE_URI),
umlResourcePluginURI.appendSegment("profiles").appendSegment("StandardL2.profile.uml"));
Map<String, Object> extensionToFactoryMap = RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFactoryMap();
extensionToFactoryMap.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
extensionToFactoryMap.put(UMLResource.PROFILE_FILE_EXTENSION, UMLResource.Factory.INSTANCE );
extensionToFactoryMap.put("uml", XMI2UMLResource.Factory.INSTANCE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment