Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:32 Go to next message
Cong Kinh NGUYEN is currently offline Cong Kinh NGUYENFriend
Messages: 47
Registered: February 2010
Member
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 14:00 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
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: Thu Apr 25 01:51:04 GMT 2024

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

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

Back to the top