Skip to main content

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
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

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

Current Time: Wed Jun 07 05:59:49 GMT 2023

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

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

Back to the top