Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367020

Summary: EMF code generator formats code but not comments
Product: [Modeling] EMF Reporter: Gregor Bonifer <g.bonifer>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: g.bonifer
Version: unspecifiedFlags: Ed.Merks: iplog+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch adding the FormatComment flag to GenModel none

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.