Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » File header not propagated to generated ecore model
File header not propagated to generated ecore model [message #1714213] Tue, 10 November 2015 18:39 Go to next message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 181
Registered: July 2009
Senior Member
I use the fileHeader attribute in the mwe2 workflow to insert a copyright text into the generated code. However the file header is not propagated to the ecore genmodel file (copyright field), and as a result none of the java files generated form the ecore model has a copyright header.
Is there anything I can do to make it work, or is this a bug?
Re: File header not propagated to generated ecore model [message #1714219 is a reply to message #1714213] Tue, 10 November 2015 19:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
sound more like a missing feature. can you file a enhancement request into bugzilla.

as a workaround (using xtext 2.9)

		language = StandardLanguage {
			
			name = "org.xtext.example.mydsl4.MyDsl"
			fileExtensions = "mydsl4"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
			
			emfGenerator = EMFGeneratorFragment2Custom {
				copyRightText = "Das ist ein Test"
			}
		}


package org.xtext.example.mydsl4;

import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.xtext.generator.ecore.EMFGeneratorFragment2;

@SuppressWarnings("restriction")
public class EMFGeneratorFragment2Custom extends EMFGeneratorFragment2 {
	
	private String copyRightText;
	
	public String getCopyRightText() {
		return copyRightText;
	}

	public void setCopyRightText(String copyRightText) {
		this.copyRightText = copyRightText;
	}

	@Override
	protected GenModel getGenModel(ResourceSet rs, Grammar grammar) {
		GenModel result = super.getGenModel(rs, grammar);
		result.setCopyrightText(copyRightText);
		return result;
	}
	
	

}





Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: File header not propagated to generated ecore model [message #1714345 is a reply to message #1714219] Thu, 12 November 2015 00:02 Go to previous message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 181
Registered: July 2009
Senior Member
I found a related bug report (https://bugs.eclipse.org/bugs/show_bug.cgi?id=368296) and added a comment.
Previous Topic:Running Xtext on Karaf Felix
Next Topic:Disable whitespace and line wrapping for all AST elemets
Goto Forum:
  


Current Time: Thu Apr 25 21:16:13 GMT 2024

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

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

Back to the top