Skip to main content



      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 13:39 Go to next message
Eclipse UserFriend
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 14:13 Go to previous messageGo to next message
Eclipse UserFriend
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;
	}
	
	

}



Re: File header not propagated to generated ecore model [message #1714345 is a reply to message #1714219] Wed, 11 November 2015 19:02 Go to previous message
Eclipse UserFriend
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: Sat Jul 05 04:37:41 EDT 2025

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

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

Back to the top