I want to open *.umlclass file (class diagram created by uml2tools) by prgorammatically:
EPackage p1 = NotationPackage.eINSTANCE;
EPackage p2 = UMLPackage.eINSTANCE;
URI uri = URI.createURI("33.umlclass");
Resource res = new GMFResourceFactory().createResource(uri);
res.load(GMFResourceFactory.getDefaultLoadOptions());
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http:||www.eclipse.org|gmf|runtime|1.0.2|notation' not found.
I added EPackage p1 = NotationPackage.eINSTANCE; to fix this error.
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http:||www.eclipse.org|uml2|3.0.0|UML' not found.
I added EPackage p2 = UMLPackage.eINSTANCE; to fix this error.
But what about org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http:||www.eclipse.org|mdt|uml2tools|gmf|notation|ext|2008' not found. (file:///E:/33.umlclass, 93, 100)
I have no idea to fix this error.
But if I delete line93<styles xmi:type="uml2tools.notation:U2TDiagramCanonicalStyle" xmi:id="_U_jeU5jvEeG6_bluuoQvfw"/>
in 33.umlclass, I can run my code sucessfully. And it seems 33.umlclass still can open as editor by uml2tools plugin.
But I can NOT use this way to make my code run.
How can I fix this error?
Thanks a lot!