|
|
|
|
|
|
|
|
|
|
|
Re: Loading ecore model from a standalone java app [message #505556 is a reply to message #505544] |
Fri, 01 January 2010 15:09 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Dameer,
I see that resource references
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore so you'll need
to be able to load Ecore.ecore has well. You'll need to specify a URI
mapping from platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore to
wherever you put Ecore.ecore. It's located as source in
org.eclipse.emf.ecore/model/Ecore.ecore.
Dameer Joog wrote:
> I am loading the ecore file from src/test/UML_21.ecore and it is
> getting successfully loaded except that something is borked on the
> proxy *only* on a single class called ELement that derives from
> EmodelElement. All other classes are fine !
>
> Since EmodelElemnt is in Ecore.ecore it has to find it .
>
> Here is the modified code
>
> // Create a resource set to hold the resources.
> ResourceSet resourceSet = new ResourceSetImpl();
>
> EPackage.Registry reg1;
> reg1 = resourceSet.getPackageRegistry();
> reg1.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
>
> XMIResourceFactoryImpl xmiFactory = new XMIResourceFactoryImpl();
> EcoreResourceFactoryImpl ecoreFactory = new
> EcoreResourceFactoryImpl();
>
> Map<String, Object> options =
> resourceSet.getResourceFactoryRegistry()
> .getExtensionToFactoryMap();
>
> // Register the appropriate resource factory to handle all file
> // extensions.
> options.put("xmi", xmiFactory);
> options.put("ecore", ecoreFactory);
>
> URI uri = URI.createFileURI(resPath);
>
> resource = resourceSet.getResource(uri, true);
> System.out.println("Loaded " + uri);
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04044 seconds