Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem migrating Standalone generator to 2.3(Linked resources do not load when running 'standalone')
Problem migrating Standalone generator to 2.3 [message #885210] Tue, 12 June 2012 16:07 Go to next message
Andrew Clark is currently offline Andrew ClarkFriend
Messages: 23
Registered: June 2010
Junior Member
Hi,

I am trying to migrate some Xtext projects to 2.3 and I have encountered the following problem.

When trying to run the Main class I load a resource I wish to link to via the resource set as follows

Resource resource2 = set.getResource(URI.createURI("src/xxx.mydsl"), true);
i.e.


	protected void runGenerator(String string) {
		// load the resource
		ResourceSet set = resourceSetProvider.get();
		Resource resource2 = set.getResource(URI.createURI("src/xxx.mydsl"), true);		Resource resource = set.getResource(URI.createURI(string), true);
		
		// validate the resource
		List<Issue> list = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl);
		if (!list.isEmpty()) {
			for (Issue issue : list) {
				System.err.println(issue);
			}
			return;
		}
		
		// configure and start the generator
		fileAccess.setOutputPath("src-gen/");
		generator.doGenerate(resource, fileAccess);
		
		System.out.println("Code generation finished.");
	}



This code runs with our current Xtext installation (Xtext SDK 2.2.1.v201112130541) but not with Xtext SDK 2.3.0.v201206051055 .

I have tried to track down the problem and it seems the new code modifies the StateBasedContainer created by the DefaultGlobalScopeProvider to a DescriptionAddingContainer, which then leads to a SelectableBasedScope with a selectable of FilterUriContainer (old code selectable = StateBasedContainer).

Now I am out of my depth Sad I have no idea why this is not working.

I have attached a couple of example projects, the Main in MyDsl1 runs with Xtext 2.2 and not with 2.3 (linking error).

Any help/hints as to what I am doing wrong would be appreciated.

Note : Everything works fine inside Eclipse.

  • Attachment: example.zip
    (Size: 331.80KB, Downloaded 167 times)
Re: Problem migrating Standalone generator to 2.3 [message #885247 is a reply to message #885210] Tue, 12 June 2012 17:17 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Andrew,

could you please add information about the actual problem that you face?
What does not work for you? Do you get exceptions?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 12.06.12 18:07, schrieb Andrew Clark:
> Hi,
>
> I am trying to migrate some Xtext projects to 2.3 and I have encountered the following problem.
>
> When trying to run the Main class I load a resource I wish to link to via the resource set as follows
>
> Resource resource2 = set.getResource(URI.createURI("src/xxx.mydsl"), true);
> i.e.
>
>
> protected void runGenerator(String string) {
> // load the resource
> ResourceSet set = resourceSetProvider.get();
> Resource resource2 = set.getResource(URI.createURI("src/xxx.mydsl"), true); Resource resource = set.getResource(URI.createURI(string), true);
>
> // validate the resource
> List<Issue> list = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl);
> if (!list.isEmpty()) {
> for (Issue issue : list) {
> System.err.println(issue);
> }
> return;
> }
>
> // configure and start the generator
> fileAccess.setOutputPath("src-gen/");
> generator.doGenerate(resource, fileAccess);
>
> System.out.println("Code generation finished.");
> }
>
>
>
> This code runs with our current Xtext installation (Xtext SDK 2.2.1.v201112130541) but not with Xtext SDK 2.3.0.v201206051055 .
>
> I have tried to track down the problem and it seems the new code modifies the StateBasedContainer created by the DefaultGlobalScopeProvider to a DescriptionAddingContainer, which then leads to a SelectableBasedScope with a selectable of FilterUriContainer (old code selectable = StateBasedContainer).
>
> Now I am out of my depth :( I have no idea why this is not working.
>
> I have attached a couple of example projects, the Main in MyDsl1 runs with Xtext 2.2 and not with 2.3 (linking error).
>
> Any help/hints as to what I am doing wrong would be appreciated.
>
> Note : Everything works fine inside Eclipse.
>
>
Re: Problem migrating Standalone generator to 2.3 [message #885257 is a reply to message #885247] Tue, 12 June 2012 17:34 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13641
Registered: July 2009
Senior Member
Hi Sebastian,

the Cross reference does not get resolved. (simply run main from the attached code)
i have no explaination for this

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem migrating Standalone generator to 2.3 [message #885349 is a reply to message #885247] Tue, 12 June 2012 21:14 Go to previous messageGo to next message
Andrew Clark is currently offline Andrew ClarkFriend
Messages: 23
Registered: June 2010
Junior Member
Hi Sebastian,

I guess I buried this line a little too deep in the post.

> I have attached a couple of example projects, the Main in MyDsl1 runs with Xtext 2.2 and not with 2.3 (linking error).

i.e. When using Xtext 2.3, if you run the Main class in the MyDsl1 project (see the attachment) an error is reported by the verification e.g. "ERROR: Couldn't resolve reference to ..." and the generator does not run (no text file is created), when I use Xtext 2.2. (and regenerate the code of course) I get no errors (the generator runs and creates the text file).

cheers,

Andrew
Re: Problem migrating Standalone generator to 2.3 [message #885920 is a reply to message #885349] Wed, 13 June 2012 21:29 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13641
Registered: July 2009
Senior Member
Hi,

i filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=382555
arround this area.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem migrating Standalone generator to 2.3 [message #886169 is a reply to message #885920] Thu, 14 June 2012 11:26 Go to previous message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
I've fixed this in our master branch. However, this fix came to late to make it into Xtext 2.3. Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=382555#c5 for a workaround.

regards,
Moritz
Previous Topic:Antlr equivalent to the '&' operator
Next Topic:Juno, xtext 2.3 and RCP
Goto Forum:
  


Current Time: Tue Oct 27 06:59:15 GMT 2020

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

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

Back to the top