Skip to main content

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: 458
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: Sun Dec 04 03:25:26 GMT 2022

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

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

Back to the top