Loading a model where some values (used in this model) are defined by the another model [message #554446] |
Mon, 23 August 2010 04:32  |
Eclipse User |
|
|
|
Hi,
I have the problem which relates to loading a file which depends on another file. For example, I created two models in xtext: A.mydsl and B.mydsl where A.mydsl uses some references defined by B.mydsl. But when I loaded the A.mydsl model as the following:
String xtextModel="path/to/A.mydsl";
XtextResourceSet resourceSet = injector.getInstance(
XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL,
Boolean.TRUE);
InputStream in = new FileInputStream(new File(xtextModel));
URI fileURI = URI.createURI(xtextModel);
Resource resource = resourceSet.createResource(fileURI);
resource.load(in, resourceSet.getLoadOptions());
EcoreUtil.resolveAll(resource);
Some references defined by B.mydsl are not resolved. Could you have any idea to indicate that the model A.mydsl takes references from the model B.mydsl?
Thanks in advance
|
|
|
Re: Loading a model where some values (used in this model) are defined by the another model [message #554543 is a reply to message #554446] |
Mon, 23 August 2010 10:00  |
Eclipse User |
|
|
|
What "kind" of cross file linking do you use?
Do you use global namespaces or explicit refernces via importedURI
mechanism?
What does the import look like?
Sven
Am 8/23/10 10:32 AM, schrieb Cong Kinh NGUYEN:
> Hi,
>
> I have the problem which relates to loading a file which depends on
> another file. For example, I created two models in xtext: A.mydsl and
> B.mydsl where A.mydsl uses some references defined by B.mydsl. But when
> I loaded the A.mydsl model as the following:
>
> String xtextModel="path/to/A.mydsl";
> XtextResourceSet resourceSet = injector.getInstance(
> XtextResourceSet.class);
> resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL,
> Boolean.TRUE);
> InputStream in = new FileInputStream(new File(xtextModel));
> URI fileURI = URI.createURI(xtextModel);
> Resource resource = resourceSet.createResource(fileURI);
> resource.load(in, resourceSet.getLoadOptions());
> EcoreUtil.resolveAll(resource);
>
> Some references defined by B.mydsl are not resolved. Could you have any
> idea to indicate that the model A.mydsl takes references from the model
> B.mydsl?
> Thanks in advance
--
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.03196 seconds