Ecore model not properly registered [message #1725048] |
Mon, 29 February 2016 05:56  |
Eclipse User |
|
|
|
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 06:10] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24566 seconds