|
|
|
|
Re: set the aliases of metamodel in standalone [message #1771592 is a reply to message #1771572] |
Mon, 28 August 2017 08:10   |
Eclipse User |
|
|
|
Thanks a million.
As another questions,
1. I want to create a model via code and pass the "workspace path" of that to createEmfModelByURI, such as bellow. How can I do it?
models.add(createEmfModelByURI("Ecore", "output.model", "http://www.eclipse.org/emf/2002/Ecore", true, true));
The code has an "Internal error: java.io.FileNotFoundException: output.model [No such file or directory]" since the output.model file does not created at all.
2. I have the path of ecore metamodel such as "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore" in the metamodel variable. How can I set the METAMODEL_URI ?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EmfMetaModel emfMetaModel = new EmfMetaModel();
StringProperties properties = new StringProperties();
properties.put(EmfMetaModel.PROPERTY_METAMODEL_URI,
?);
And also how can I register it?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EPackage.Registry.INSTANCE.put(?, ?);
Thanks for your time
[Updated on: Mon, 28 August 2017 14:12] by Moderator
|
|
|
Re: set the aliases of metamodel in standalone [message #1771658 is a reply to message #1771592] |
Tue, 29 August 2017 04:08   |
Eclipse User |
|
|
|
Hi,
Quote:
1. I want to create a model via code and pass the "workspace path" of that to createEmfModelByURI, such as bellow. How can I do it?
models.add(createEmfModelByURI("Ecore", "output.model", "http://www.eclipse.org/emf/2002/Ecore", true, true));
The model does not exist so, you should set the "read on load" argument to false. As a result Epsilon will not try to locate it when loading it. Setting the "store on disposal" argument to true (as you do) will dictate Epsilon to create the file (if it doesn't exist) and write the result to it. So, I believe that this should work:
models.add(createEmfModelByURI("Ecore", "output.model", "http://www.eclipse.org/emf/2002/Ecore", false, true));
Quote:
I have the path of ecore metamodel such as "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore" in the metamodel variable. How can I set the METAMODEL_URI ?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EmfMetaModel emfMetaModel = new EmfMetaModel();
StringProperties properties = new StringProperties();
properties.put(EmfMetaModel.PROPERTY_METAMODEL_URI,
?);
If you open your .ecore metamodel with the ECore tree editor and navigate to the root node of it you will find the URI of the metamodel in the properties view of Eclipse (property: Ns URI).
Quote:And also how can I register it?
String metamodel = "/Users/apple/Desktop/runtime-EclipseApplication/Competition2TVApp/CompetitionDsl.ecore";
EPackage.Registry.INSTANCE.put(?, ?);
This SO post expalins how to do it.
Hope that helps,
Thanos
|
|
|
|
Powered by
FUDForum. Page generated in 0.05916 seconds