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
Member
Hi

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 =
          formatter.format(CodeFormatter.K_COMPILATION_UNIT, 
            cu.getSource(), range.getOffset(), range.getLength(), 0, null);
        cu.applyTextEdit(indent_edit, null);
        cu.reconcile();


Any help is welcome.

TIA

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

Hi,

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.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Previous Topic:[Acceleo] Resource Factory issue
Next Topic:[Acceleo] generating current date/time
Goto Forum:
  


Current Time: Thu Mar 28 12:51:14 GMT 2024

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

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

Back to the top