Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Generator Problems with xtext 2.1.1
Generator Problems with xtext 2.1.1 [message #762914] Thu, 08 December 2011 20:01 Go to next message
egger is currently offline eggerFriend
Messages: 13
Registered: November 2011
Junior Member
Hello everyone,

i have some problems with the code generation. when i run my project as an eclipse application, add the src-gen folder - there is no code generate at all. I have generatet a new xtext project, added code to the .xtext file and also to the StatemachineGenerator.xtend. I don't know where to start to find out the problem? Every hint would be appreciated. i have also added a copy of my project-folders (wsp_sn2.zip).

thanks and best regards

My Files

My Statemaschine.xtext
grammar at.xne.sn.Statemachine with org.eclipse.xtext.common.Terminals
 //no link restriction of the forum
generate statemachine "http ://www.xne.at/sn/Statemachine"

Model:
	modules+= Modul+
;
	
Modul:
	'modul' name= ID ';'
	actions+= Action*
	states+= State*	
	transitionconditions+= Transitioncondition*
	transitions += Transition*
;
	
Action:
	'action' name= ID ';'
;

State:
	'state' name= ID '[' 
	action=[Action] '];'
;

Transition:
	start=[State] '-(' transitCondition=[Transitioncondition]')->' ende=[State] ';'
;

Transitioncondition:
	'transitioncondition' name= ID ';'
;

My StatemachineGenerator.xtend
/*
 * generated by Xtext
 */
package at.xne.sn.generator

import at.xne.sn.statemachine.Modul
import com.google.inject.Inject
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
import org.eclipse.xtext.naming.IQualifiedNameProvider

import static extension org.eclipse.xtext.xtend2.lib.ResourceExtensions.*


class StatemachineGenerator implements IGenerator {
	
	@Inject extension IQualifiedNameProvider nameProvider 
	
	override void doGenerate(Resource resource, IFileSystemAccess fsa) {
		
		    for(e: resource.allContentsIterable.filter(typeof(Modul))) {
		        fsa.generateFile(
		            e.fullyQualifiedName.toString.replace(".", "/") + ".java",
		            e.compile)
		    }
  	}
  	def compile(Modul e) '''
        public class «e.name» { 

        }
    '''
}

In my eclipse environment i have installed the following:
Eclipse 3.7.1
  xtext: 2.1.1.v201111141332
  Eclipse SDK	3.7.1.M20110909-1335	org.eclipse.sdk.ide	null
  Xbase	2.1.1.v201111141332	org.eclipse.xtext.xbase.feature.group	Eclipse Modeling Project
  Xtend2 SDK	2.1.1.v201111141332	org.eclipse.xtext.xtend2.sdk.feature.group	Eclipse Modeling Project
  Xtext Documentation	2.1.1.v201111141332	org.eclipse.xtext.docs.feature.group	Eclipse.org
  Xtext Examples	2.1.1.v201111141332	org.eclipse.xtext.examples.feature.group	Eclipse Modeling Project
  Xtext Runtime	2.1.1.v201111141332	org.eclipse.xtext.runtime.feature.group	Eclipse Modeling Project
  Xtext SDK	2.1.1.v201111141332	org.eclipse.xtext.sdk.feature.group	Eclipse Modeling Project
  Xtext UI	2.1.1.v201111141332	org.eclipse.xtext.ui.feature.group	Eclipse Modeling Project
  • Attachment: wsp_sn2.zip
    (Size: 1.54MB, Downloaded 151 times)
Re: Generator Problems with xtext 2.1.1 [message #762926 is a reply to message #762914] Thu, 08 December 2011 20:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

works for me. how does your test project + model file look like

P.S: i had to recompile the generator.xtend

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 08 December 2011 20:25]

Report message to a moderator

Re: Generator Problems with xtext 2.1.1 [message #762930 is a reply to message #762926] Thu, 08 December 2011 20:33 Go to previous messageGo to next message
egger is currently offline eggerFriend
Messages: 13
Registered: November 2011
Junior Member
Hi Christian,

attached you find the test project.

thanks and best regards
Re: Generator Problems with xtext 2.1.1 [message #762931 is a reply to message #762930] Thu, 08 December 2011 20:34 Go to previous messageGo to next message
egger is currently offline eggerFriend
Messages: 13
Registered: November 2011
Junior Member
Hi Christian,

how have you recompiled which file?

best regards
Re: Generator Problems with xtext 2.1.1 [message #762933 is a reply to message #762930] Thu, 08 December 2011 20:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hmmm i get a prozess.java. did you deactivate the compiler in your runtime workspace
window -> prefs -> statemachine -> compiler?
do you have build automatically on in your runtime workspace?
do you get any error messages in your host eclipse console?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generator Problems with xtext 2.1.1 [message #762940 is a reply to message #762933] Thu, 08 December 2011 20:55 Go to previous message
egger is currently offline eggerFriend
Messages: 13
Registered: November 2011
Junior Member
OMG, now it works Smile thanks christian for your hint.

in the meantime i did two steps:
1. i setup a clean eclipse 3.7.1 ide + xtext (described at: http ://www.eclipse.org/Xtext/documentation/2_1_0/005-installation.php). this time i only ticked the Xtext SDK check box, before i had installed the whole package.
2. i did a clean up in my project Wink and the generated file appeared

thanks again and best regard
Previous Topic:Column oriented editors
Next Topic:Define own scope: Reference C methods
Goto Forum:
  


Current Time: Fri Mar 29 08:07:43 GMT 2024

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

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

Back to the top