Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] how to format generated java code?
[Acceleo] how to format generated java code? [message #717969] Mon, 22 August 2011 21:02 Go to next message
Leonardo Kenji Shikida is currently offline Leonardo Kenji ShikidaFriend
Messages: 37
Registered: July 2009

I can format programmaticaly an already existent java class, but I canĀ“t format a new java class generated by acceleo. Probably I am forgetting some step to refresh the project or some synchronization issue.

        CodeFormatter formatter = ToolFactory.createCodeFormatter(null);
        ISourceRange range = cu.getSourceRange();
        TextEdit indent_edit =
            cu.getSource(), range.getOffset(), range.getLength(), 0, null);
        cu.applyTextEdit(indent_edit, null);

Any help is welcome.


Leo K.
Re: [Acceleo] how to format generated java code? [message #719137 is a reply to message #717969] Fri, 26 August 2011 07:26 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 430
Registered: April 2010
Location: Nantes (France)
Senior Member


There are no "difference" between a "normal" Java class and a Java class generated by Acceleo, so there shouldn't be any problem to format it. You can have a look at this piece of code to do so. I used it in the past to format Acceleo generated Java class and it worked perfectly.


Stephane Begaudeau, Obeo

Twitter: @sbegaudeau
Google+: stephane.begaudeau
Acceleo Documentation:

Previous Topic:[Acceleo] Resource Factory issue
Next Topic:[Acceleo] generating current date/time
Goto Forum:

Current Time: Wed Oct 07 00:21:38 GMT 2015

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

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