Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » TMF Generator does not do anything
TMF Generator does not do anything [message #895918] Mon, 16 July 2012 13:46 Go to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
Hi @ all,

i am trying to implement a generator for my xtext language, but can't get it to work.
I added
fragment = builder.BuilderIntegrationFragment {}
			// generator API
            fragment = generator.GeneratorFragment {
                generateMwe = true
                generateJavaMain = true
            }

to my mwe file and regenerated.
Then I changed the MyDslGenerator, just to print a line

override void doGenerate(Resource resource, IFileSystemAccess fsa) {
		
		System::out.println("Hello World")
}


This line is not printed after saving my .mydsl text file. I read that there are some problems with that, if you use xbase, but this isnt the case for my language...

Is there anything I forgot?

Greetings
Amneris
Re: TMF Generator does not do anything [message #895925 is a reply to message #895918] Mon, 16 July 2012 13:56 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

have you merged the plugin.xml files after re-generating. As you might have made manual modifications, the initial plugin.xml is not overwritten.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: TMF Generator does not do anything [message #895930 is a reply to message #895925] Mon, 16 July 2012 14:17 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
Hi thanks for your fast reply...
I have a plugin.xml and a plugin.xml_gen file ...
Theire contents are the same.

Amneris
Re: TMF Generator does not do anything [message #895936 is a reply to message #895918] Mon, 16 July 2012 14:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi sure you looked into the right console?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: TMF Generator does not do anything [message #895945 is a reply to message #895918] Mon, 16 July 2012 15:29 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
actually I looked at both consoles, the one of my eclipse in which i develope and the runtime eclipse console...
in none is something printed :/
Can there be some other error sources?

Thank you for your replies Wink
Re: TMF Generator does not do anything [message #895949 is a reply to message #895945] Mon, 16 July 2012 15:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Have you enabled builderintegrationfragment? Did you try a project as
Xtext generates it with the wizard?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: TMF Generator does not do anything [message #895950 is a reply to message #895949] Mon, 16 July 2012 15:45 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
I used
fragment = builder.BuilderIntegrationFragment {}
in my mwe workflow...
the project has been created with the xtext wizard. Sometimes i don't understand xtext at all
Re: TMF Generator does not do anything [message #895953 is a reply to message #895950] Mon, 16 July 2012 15:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi can you describe step by step what you do creating a new Xtext
project by the wizard?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: TMF Generator does not do anything [message #895974 is a reply to message #895953] Mon, 16 July 2012 17:51 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
file -> new -> Xtext project from Ecore
select genmodel, select root element -> next -> finish

in .xtext file, I change the import of the existing ecore to a platform uri

then I create several uriMaps for the platform:/plugin... models to platform:/resource/... models and add

fragment = org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment {
referencedGenModels = "platform:/resource/uriOfMyDslGenModel.genmodel"
}
to the mwe workflow because i mix generated and imported ecore models.


So my mwe workflow looks like this:

module de.test.mydsl.MyDsl

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/de/test/mydsl/MyDsl.xtext"
var file.extensions = "mydsl"
var projectName = "de.test.mydsl"
var runtimeProject = "../${projectName}"

Workflow {
	bean = StandaloneSetup {
		scanClassPath = true
		platformUri = "${runtimeProject}/.."
		
				
		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
			to = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
		}
		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.ecore"
			to = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.ecore"
		}

		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
			to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
		}
		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel"
			to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
		}

		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.ecore"
			to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.ecore"
		}
		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
			to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
		}

		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
			to = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.genmodel"
		}
		uriMap = {
			from = "platform:/plugin/org.eclipse.emf.ecore/model/XMLNamespace.ecore"
			to = "platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.ecore"
		}


	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}/src-gen"
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}.ui/src-gen"
	}

	component = Generator {
		pathRtProject = runtimeProject
		pathUiProject = "${runtimeProject}.ui"
		projectNameRt = projectName
		projectNameUi = "${projectName}.ui"
		language = {
			uri = grammarURI
			fileExtensions = file.extensions

			// mixing generated and imported ecore models
			// compare: Using Resource URIs to Import Existing EPackages at:
			// http://www.eclipse.org/Xtext/documentation/2_0_0/020-grammar-language.php 
			fragment = org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment {
				referencedGenModels = "platform:/resource/uriOfMyDslGenModel.genmodel"
			}
			// Java API to access grammar elements (required by several other fragments)
			fragment = grammarAccess.GrammarAccessFragment {}

			// generates Java API for the generated EPackages
			// fragment = ecore.EcoreGeneratorFragment {}

			// the serialization component
			fragment = parseTreeConstructor.ParseTreeConstructorFragment {}

			// a custom ResourceFactory for use with EMF 
			fragment = resourceFactory.ResourceFactoryFragment {
				fileExtensions = file.extensions
			}

			// the Antlr parser
			fragment = parser.antlr.XtextAntlrGeneratorFragment {
				options = {
					classSplitting = true
				}
			}

			// the Ecore2Xtext specific terminal converter
			fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment {}

			// java-based API for validation 
			fragment = validation.JavaValidatorFragment {
			// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
			// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}

			// scoping and exporting API
			//fragment = scoping.ImportURIScopingFragment {}
			//fragment = exporting.SimpleNamesFragment {}

			// scoping and exporting API 
			fragment = scoping.ImportNamespacesScopingFragment {}
			fragment = exporting.QualifiedNamesFragment {}

			// formatter API 
			fragment = ecore2xtext.FormatterFragment {}

			// labeling API 
			fragment = labeling.LabelProviderFragment {}

			// outline API 
			fragment = outline.OutlineTreeProviderFragment {}
			fragment = outline.QuickOutlineFragment {}

			// java-based API for content assistance 
			fragment = contentAssist.JavaBasedContentAssistFragment {}

			// antlr parser generator tailored for content assist 
			fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
				options = {
					classSplitting = true
				}
			}

			fragment = builder.BuilderIntegrationFragment {}
			// generator API
            fragment = generator.GeneratorFragment {
                generateMwe = true
                generateJavaMain = true
            }

			// rename refactoring
			fragment = refactoring.RefactorElementNameFragment {}

			// provides the necessary bindings for java types integration
			fragment = types.TypesGeneratorFragment {}

			// generates the required bindings only if the grammar inherits from Xbase
			// fragment = xbase.XbaseGeneratorFragment {}

			// provides a preference page for template proposals
			fragment = templates.CodetemplatesGeneratorFragment {}

			// provides a compare view
			fragment = compare.CompareFragment {
				fileExtensions = file.extensions
			}

			// project wizard (optional) 

			// fragment = projectWizard.SimpleProjectWizardFragment {
			//		generatorProjectName = "${projectName}.generator" 
			//		modelFileExtension = file.extensions
			// }

			// quickfix API 
			fragment = quickfix.QuickfixProviderFragment {}
		}
	}
}


do you see the error in these lines? thank you for your time!

[Updated on: Mon, 16 July 2012 17:54]

Report message to a moderator

Re: TMF Generator does not do anything [message #895985 is a reply to message #895974] Mon, 16 July 2012 18:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

no it looks good. so everything is working besides the generator. so you maybe should debug
org.eclipse.xtext.builder.BuilderParticipant

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: TMF Generator does not do anything [message #895989 is a reply to message #895985] Mon, 16 July 2012 18:27 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
Okay, thank you for this hint, I will give this a try
Re: TMF Generator does not do anything [message #896073 is a reply to message #895989] Tue, 17 July 2012 07:24 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
While debugging, i found out, that getRelevantDeltas(context) called in the build method in the BuilderParticipant always returns an empty List.
In the getRelevantDeltas(IBuildContext) it is iterated over all deltas in the context.
then
if (resourceServiceProvider.canHandle(delta.getUri()))
                result.add(delta);
is never executed. The URI can not be handled, because the file extension of my dsl is not available...
Any ideas why this happens?

Greetings
Amneris
Re: TMF Generator does not do anything [message #896074 is a reply to message #896073] Tue, 17 July 2012 07:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Looks like a missconfig in your plugin.XML (UI project)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: TMF Generator does not do anything [message #896075 is a reply to message #896074] Tue, 17 July 2012 07:48 Go to previous messageGo to next message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
Hi Christian, thank you very much, this was the error.
I think, Alexander already mentioned merging the plugin.xml files but i did not look at the ui project.
After deleting (i didn't modify the plugin.xml manually) and regenerating everything works nicely!

Thanks again both of you =)
Re: TMF Generator does not do anything [message #896139 is a reply to message #896075] Tue, 17 July 2012 11:59 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Incredible, how many answers were given in how little time and
eventually the initial proposal was right. Kudos to you, Alex and Christian!


Am 17.07.12 09:48, schrieb Amneris T:
> Hi Christian, thank you very much, this was the error.
> I think, Alexander already mentioned merging the plugin.xml files but i
> did not look at the ui project.
> After deleting (i didn't modify the plugin.xml manually) and
> regenerating everything works nicely!
>
> Thanks again both of you =)


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


---
Get professional support from the Xtext committers at www.typefox.io
Re: TMF Generator does not do anything [message #896247 is a reply to message #895918] Tue, 17 July 2012 17:19 Go to previous message
Amneris T is currently offline Amneris TFriend
Messages: 15
Registered: June 2012
Junior Member
yes, thanks again for this nice support! sorry for my stupid question and for not understanding that the solution was already posted :/
Previous Topic:Easy way to get cross references?
Next Topic:Get all text for a node?
Goto Forum:
  


Current Time: Fri Apr 19 03:15:12 GMT 2024

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

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

Back to the top