Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Extending existing files with Xtend
Extending existing files with Xtend [message #1689352] Mon, 23 March 2015 11:40 Go to next message
Ferdinand von den Eichen is currently offline Ferdinand von den EichenFriend
Messages: 9
Registered: March 2015
Junior Member
Hi everyone,

I basically want to modify classes of an already existing project. I would have to insert a number of lines of code at certain points in the existing files.

1) What's a good approach, design-wise? Are there any reference implementations I could look at? Currently I'm thinking to have markers in the files that indicate where I can safely insert code.

2) In terms of implementation: The IFileSystemAccess of the overwritten doGenerate seems basic at best (only create & delete file). What is a good/more powerful way of accessing and modifying files in Xtend?

Greetings & thanks for bearing with me! Smile

Ferdinand
Re: Extending existing files with Xtend [message #1689496 is a reply to message #1689352] Mon, 23 March 2015 18:12 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Ferdinand,

perhaps you can use another approach with some "placeholders".

During the generator phase, just read in the existing file
and replace the placeholder with the placeholder (so you can use it next time)
and the additional code.

At the end of the generation, just rewrite the complete existing file.

Uli
Previous Topic:Cannot Create datatype XYZ
Next Topic:Serializing an unordered group?
Goto Forum:
  


Current Time: Thu Apr 25 06:32:18 GMT 2024

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

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

Back to the top