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