Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EGL] Append output to existing file
[EGL] Append output to existing file [message #1272615] Tue, 18 March 2014 10:39 Go to next message
Esteban Loiseau is currently offline Esteban LoiseauFriend
Messages: 5
Registered: September 2013
Location: Laval, France
Junior Member
Hi,
I would like to run the same M2T transformation several times, with different inputs, and append the output to the same file.
Here is an example snippet from an EGL file:

	var f = new Native("org.eclipse.epsilon.egl.formatter.language.JavaFormatter");
	TemplateFactory.setDefaultFormatter(f);
	for(binding in Binding.all) {
		var template:Template = TemplateFactory.load("binding.egl");
		template.populate("binding",binding);
		template.generate("generated/out.txt");
	}

The out.txt file will be overwritten each time, is there an option to only append to file?

I considered using
template.process()
to get a string of the generated content and append to it, but could not find a way to write it to a file.

thanks for your help,
Esteban
Re: [EGL] Append output to existing file [message #1272857 is a reply to message #1272615] Tue, 18 March 2014 23:56 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 918
Registered: July 2009
Senior Member
Hi Esteban,

Instead of template.generate() you should be able to invoke template.append().

Cheers,
Dimitris
Re: [EGL] Append output to existing file [message #1273161 is a reply to message #1272857] Wed, 19 March 2014 16:25 Go to previous messageGo to next message
Esteban Loiseau is currently offline Esteban LoiseauFriend
Messages: 5
Registered: September 2013
Location: Laval, France
Junior Member
Hi,
using this code:
[%
	var f = new Native("org.eclipse.epsilon.egl.formatter.language.JavaFormatter");
	TemplateFactory.setDefaultFormatter(f);
	var template:Template = TemplateFactory.load("binding.egl");
	for(binding in Binding.all) {
		template.populate("binding",binding);
		template.append("generated/out.txt");
	}

%]

I get this error:
Method 'append' not found for: org.eclipse.epsilon.egl.EglFileGeneratingTemplate


I checked the javadoc here: http://download.eclipse.org/epsilon/javadoc/ and could not find this method.
I have everything from the interim update site (http://download.eclipse.org/epsilon/interim/) installed.

Cheers,
Esteban
Re: [EGL] Append output to existing file [message #1273186 is a reply to message #1273161] Wed, 19 March 2014 17:30 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 918
Registered: July 2009
Senior Member
Hi Esteban,

You're right - this hasn't made it to the interim update site yet. I plan to release a new interim version over the weekend but please let me know if this is a blocker and I'll try to do this sooner.

Cheers,
Dimitris
Re: [EGL] Append output to existing file [message #1274508 is a reply to message #1273186] Fri, 21 March 2014 15:20 Go to previous messageGo to next message
Esteban Loiseau is currently offline Esteban LoiseauFriend
Messages: 5
Registered: September 2013
Location: Laval, France
Junior Member
Hi,

there is no rush, I can wait Smile

Cheers,
Esteban
Re: [EGL] Append output to existing file [message #1282380 is a reply to message #1274508] Wed, 02 April 2014 07:59 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 918
Registered: July 2009
Senior Member
Hi Esteban,

This should now be available in the latest interim release.

Cheers,
Dimitris
Previous Topic:Add plugin dep to diagram generated code!
Next Topic:Collection Type Specification
Goto Forum:
  


Current Time: Wed Dec 17 20:09:38 GMT 2014

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

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