Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Inserting copyright information in generated code
Inserting copyright information in generated code [message #760074] Thu, 01 December 2011 08:51 Go to next message
Arvind Sharma is currently offline Arvind SharmaFriend
Messages: 17
Registered: December 2011
Junior Member
Hi,

I am new to XText and created my grammer. I want to know how to configure Xtext to insert a copyright message when classes are generated when we run generate XText Artifacts command.

Thanks
Arvind
Re: Inserting copyright information in generated code [message #760828 is a reply to message #760074] Mon, 05 December 2011 11:56 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
The Xtext generator fires up a bunch of AbstractGeneratorFragment instances, each of which generate source (text) by means of an Xpand template file with the same name as the generator fragment's class. E.g., the (org.eclipse.xtext.generator.ecore.)EcoreGeneratorFragment class has an Xpand template EcoreGeneratorFragment.xpt next to it which does the actual (text) generation.

To override its behavior you can subclass the generator fragments whose generation behavior you need to customize and provide your own Xpand template which overrides the behavior of the original template in the desired way. More about this: http://dslmeinte.wordpress.com/2010/09/02/configuring-local-and-global-scope-providers-at-the-same-time/ It's written for Xtext 1.0.1 but still seems valid enough for current Xtext.


Re: Inserting copyright information in generated code [message #762794 is a reply to message #760828] Thu, 08 December 2011 16:20 Go to previous message
Arvind Sharma is currently offline Arvind SharmaFriend
Messages: 17
Registered: December 2011
Junior Member
Thanks for your reply. I will try this.

Thanks
Arvind
Previous Topic:[Xtend/mwe2] Disable model validation
Next Topic:Null Pointer Exception while opening xtext editor with a non workspace file
Goto Forum:
  


Current Time: Sat Mar 06 02:41:21 GMT 2021

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

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

Back to the top