Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367020 - EMF code generator formats code but not comments
Summary: EMF code generator formats code but not comments
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-17 13:33 EST by Gregor Bonifer CLA
Modified: 2012-03-31 14:24 EDT (History)
1 user (show)

See Also:
Ed.Merks: iplog+


Attachments
Patch adding the FormatComment flag to GenModel (8.40 KB, text/plain)
2011-12-17 13:33 EST, Gregor Bonifer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Bonifer CLA 2011-12-17 13:33:35 EST
Created attachment 208519 [details]
Patch adding the FormatComment flag to GenModel

The Code Formatting flag causes the code formatter to be invoked in a way that does not format comments. I.e. the method CodeFormatter.format requires the bitmask parameter "kind" to have the bit CodeFormatter.F_INCLUDE_COMMENTS set. Otherwise it will not attend to formatting comments.
To enable the formatting of comments in an backward compatible way I propose the addition of a flag "Format Comments", whose setting is delegated to the format-method. I have attached a patch that realizes this. I did not include the generated portion of the code. So in addition to applying the patch, the model and edit code requires regeneration.
Comment 1 Ed Merks CLA 2012-01-18 09:37:12 EST
When experimenting with this, it looks like the resulting format is unspeakably hideous.

/**
 * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!--
 * end-user-doc -->
 * 
 * @generated
 */

Do you really want/need results that look like this?  Have you done something with your options for comment formatting that doesn't result in this kind of hideousness?
Comment 2 Ed Merks CLA 2012-02-04 06:16:14 EST
Slightly modified changes have been committed to git for 2.8.  I wanted to make sure that we didn't break API by changing the formatCode signature, so I added an overload and make sure that the old one is called when comment formatting is enabled.
Comment 3 Ed Merks CLA 2012-03-31 14:24:11 EDT
The changes are available in the M6 build.