Eclipse Lyo code generation templates


Could someone please suggest how can I change default behaviour for “Start of user code” and “End user code” templates in Eclipse Lyo?
I mean is it possible to configure it somehow in order to make Lyo put these comments in those places I want? So that after code regeneration these places stay unchanged?

I tried to write these comments by my own in the places I want, but it just doesn’t work - they are overwritten.

At the same time I saw some projects in the internet (GitHub) and some custom comments were presented there so it seems to be working somehow.

Thank you!


These user code blocks are predefined and part of the code generation templates. It is not something you - as an end user of the generated code - can manually change.

The code generator is done here GitHub - eclipse/lyo.designer: lyo.designer

So, I see 2 options:

  1. create an issue under github to clarify where you want the change.
  2. Have a go at changing the code generator (templates are written in Eclipse Acceleo) yourself, and then make a pull request.

As long as it’s reasonable, I (since it’s been mainly me developing Lyo Designer) don’t see a problem with many user code blocks.

If you see other projects with different locations of code blocks, it’s most likely because they are based on other/later versions of Lyo Designer.

What version of Lyo Designer are you using? Consider updating with the latest changes through this update site.

Hi Jad,

Actually I just would like to have an ability to add my own binding in the ApplicationBinder class.
Like this:

    protected void configure() {"HK2 contract binding start");


There are a number of “user code” comments blocks in that class but they seems to not suitable for this particular task.

As for version I’m using Lyo Code Generator 5.0.0.Final version.


So the ApplicationBinder is one of the newest classes, and it indeed lacks many use code blocks. To get started, just indicate where in the code you want to have them, and I can add them.

For you to get these changes, you will need to use the edge update site above.

Hi Jad,

It would be good to have it like this:

    protected void configure() {"HK2 contract binding start");

        // Start of user code configure
        // End of user code

Thank you.


It seems that the change you need is already in place. It’s just that you need to work against the latest version of LyoDesigner.
Please update LyoDesigner as suggested here:

See for example, generated code for the lyo referenceImplementation

Hi Jad!

Yeah, thanks a lot, this is exactly what I needed.
I successfully updated Lyo with Bleeding edge link, so now everything is OK!

Thank you

Glad to hear.