Create a new model (instance) that conforms to my metamodel in Java class [message #1441084] |
Thu, 09 October 2014 04:35  |
Eclipse User |
|
|
|
Hi,
i have a metamodel EMF (test.ecore). Now,
1. I want to create an instance (or model) that conforms to this metamodel by Java class.
2. If I have a model (my.test) that conforms to this metamodel (test.ecore).
I want to delete any objects of model (my.test) in java class
HOW I CAN IMPLEMENT THIS JAVA CLASS, PLEASE?
Thanks advance,
|
|
|
|
|
|
|
|
|
|
|
Re: Create a new model (instance) that conforms to my metamodel in Java class [message #1685236 is a reply to message #1685198] |
Wed, 18 March 2015 15:18  |
Eclipse User |
|
|
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
m.put("ecore", new XMIResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
[b]Ramified mm = new Ramified(resourceSet);
resourceSet.getPackageRegistry().put(
"RamRoot", mm.getRoot()
);[/b]
Resource resource = (Resource) resourceSet.createResource(URI.createFileURI("models/MyInstance.xmi"));
resource.load(null);
Registering the package explicitly from the "instance" I've built from the .ecore (and more precisly, its root EPackage).
This looks like what changed this day in a beautyfull one !
Thanks a lot Ed for your support !
Edouard
[Updated on: Wed, 18 March 2015 15:18] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.12571 seconds