Ecore model not properly registered [message #1725048] |
Mon, 29 February 2016 10:56 |
Jose Ventura Roda Messages: 6 Registered: April 2014 |
Junior Member |
|
|
I've created a DSL with xtext 0.7
My goal is to parse a string with this dsl model, but i have some problem with the model registration.
When I try this code
URI dummy =URI.createURI("dummy:/example.cblData");
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = resourceSet.createResource(dummy);
InputStream in = new ByteArrayInputStream(preprocessedCode.getBytes());
try {
resource.load(in, resourceSet.getLoadOptions());
} catch (IOException e) {
e.printStackTrace();
}
createResource method always returns null.
When I try this code
URI uriEasyFile = URI.createURI("file://C:/FAST_BP/_work/workspace/pru.cblData");
ResourceSet rs = new ResourceSetImpl();
Resource r = rs.getResource(uriEasyFile, true);
GetResource method thows "Cannot create a resource for 'file://C:/FAST_BP/_work/workspace/pru.cblData'; a registered resource factory is needed"
When I use the "Generic EMF From Editor" the model is opened correctly, but not from my class. Why don't found the Factory if the generic emf editor can open it?.
Thanks in advance.
Jose
Quote:Edited for correct some copy/paste errors
[Updated on: Mon, 29 February 2016 11:10] Report message to a moderator
|
|
|
|
Re: Ecore model not properly registered [message #1725052 is a reply to message #1725048] |
Mon, 29 February 2016 11:28 |
|
I'm not sure if the standalone setup already existed in Xtext 0.7. Are you really sure that it is the ancient version 0.7 and not something more up to date? If you use Xtext nowadays, Christian's answer to call the setup class is correct.
Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03065 seconds