Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » load uml model for java
load uml model for java [message #1716318] Wed, 02 December 2015 23:00
Danny Deina is currently offline Danny DeinaFriend
Messages: 7
Registered: December 2015
Junior Member
Hello,
i created class diagram by papyrus and i got *.uml file, i wanted to manipulate uml file by java code ,so how can i iterate through uml model elements by java code ?
i tried this cod:
ResourceSet resourceSet = new ResourceSetImpl();
	    	 resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);

	    	 resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
	    	 Map uriMap = resourceSet.getURIConverter().getURIMap();
	    	 URI uri = URI.createURI("jar:file:/H:/org.eclipse.uml2.uml.resources-3.1.0.v201005031530.jar!/"); // for example
	    	 uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
	    	 uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
	    	 uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));
	    	 
	    	 resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("uml", new UMLResourceFactoryImpl());
	    	 
	    	 URI uri2 = URI.createURI("file:/H:/firstModel.uml"); 
	    	 Resource resource = resourceSet.getResource(uri2, true);



but i got an exception:
Exception in thread "main" java.lang.NoSuchMethodError: org.eclipse.emf.ecore.resource.URIConverter.createInputStream(Lorg/eclipse/emf/common/util/URI;Ljava/util/Map;)Ljava/io/InputStream;



so how can i iterate through *.uml model file using java code

Thanks
Previous Topic:Performance with Stereotypes (UMLUtil.getNamedElement())
Next Topic:Copying a UML2 model including a deep copy of PackageImports
Goto Forum:
  


Current Time: Sun Jan 21 18:58:09 GMT 2018

Powered by FUDForum. Page generated in 0.01835 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software