Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Loading a model where some values (used in this model) are defined by the another model
Loading a model where some values (used in this model) are defined by the another model [message #554446] Mon, 23 August 2010 04:32 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Code generation from editor
Next Topic:Determining DSL location from AST
Goto Forum:
  


Current Time: Mon Jul 07 21:16:23 EDT 2025

Powered by FUDForum. Page generated in 0.03196 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top