Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » After parsing model syntax error occurs
After parsing model syntax error occurs [message #651220] Fri, 28 January 2011 13:03 Go to next message
goerkem is currently offline goerkemFriend
Messages: 20
Registered: October 2009
Junior Member
I parse my model and saves changed information into:

ResourceSet rs = new XtextResourceSet();
Resource res = null;
		
try {
res = rs.getResource(URI.createFileURI("myfile"), true);
}
catch(RuntimeException rte) {...}
...
res.save(null);


Before parsing there are no error in file.
But after parsing all cross-references can't be found.
Whats wrong?
Re: After parsing model syntax error occurs [message #651240 is a reply to message #651220] Fri, 28 January 2011 14:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

are this local (same file) or nonlocal (onther file) cross-references? for nonlocal references you have to add all modelfiles to the resourceset

ResourceSet rs = new XtextResourceSet();
Resource res = null;
		
try {
 rs.getResource(URI.createFileURI("myfile2"), true);
 rs.getResource(URI.createFileURI("myfile3"), true);
res = rs.getResource(URI.createFileURI("myfile"), true);
}
catch(RuntimeException rte) {...}
...



~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: After parsing model syntax error occurs [message #651241 is a reply to message #651240] Fri, 28 January 2011 14:13 Go to previous messageGo to next message
goerkem is currently offline goerkemFriend
Messages: 20
Registered: October 2009
Junior Member
There are cross-references to another files.
Is there any method to get all referenced files?
Re: After parsing model syntax error occurs [message #651244 is a reply to message #651241] Fri, 28 January 2011 14:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

no out of the box method since xtext does not know anything about files at this point. but you can take a look at the Xtext MWE Reader to get an Idea on how to scan e.g. a dir for model files

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: After parsing model syntax error occurs [message #651603 is a reply to message #651220] Mon, 31 January 2011 20:28 Go to previous message
goerkem is currently offline goerkemFriend
Messages: 20
Registered: October 2009
Junior Member
Thanks for reply. I have still 2 problems:
1. After modifying document the content gets other formatting. e.g.: Some part of content moved from the top to the end of document. Is it possible to keep the current formating?
2. I have in my grammar some optional attributes. After modification of the document these optional attributes appear, although they haven't been defined explicitely before. Does it depend with formating also?

Hope to get help.
Thanks in advance

P.S. using xtext 1.0
Previous Topic:odd formatting issue in 2.0 serialization tests
Next Topic:XText 2.0 and Eclipse 3.6.1
Goto Forum:
  


Current Time: Sat Apr 20 04:15:49 GMT 2024

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

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

Back to the top