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

Bug 331425

Summary: Contributed Code Style Profile is added with wrong id
Product: [Tools] CDT Reporter: Rudolf Hornig <rudolf.hornig>
Component: cdt-editorAssignee: Project Inbox <cdt-editor-inbox>
Status: CLOSED WONTFIX QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, jamesblackburn+eclipse
Version: 8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Rudolf Hornig CLA 2010-11-30 08:33:12 EST
Build Identifier: 7.0.1

When a product contributes a profile to the Code Styles via the plugin_customization.ini file using org.eclipse.cdt.ui/org.eclipse.cdt.ui.formatterprofiles, the added profile is using the name of the profile as the ID

related to the patch in #138668

In org.eclipse.cdt.internal.ui.preferences.formatter.FormatterProfileManager:

- profMap.put(p.getID(), new BuiltInProfile(p.getName(), p.getName(), p.getSettings(), 2, profileVersioner.getCurrentVersion(), profileVersioner.getProfileKind()));
+ profMap.put(p.getID(), new BuiltInProfile(p.getID(), p.getName(), p.getSettings(), 2, profileVersioner.getCurrentVersion(), profileVersioner.getProfileKind()));

Reproducible: Always
Comment 1 Anton Leherbauer CLA 2010-11-30 08:37:58 EST
(In reply to comment #0)
> related to the patch in #138668

This bug seems unrelated.
Comment 2 James Blackburn CLA 2010-11-30 08:39:50 EST
Looks like he means bug 279607 (#138668 is the attachment ID there...).
Comment 3 Anton Leherbauer CLA 2010-11-30 08:44:04 EST
Thanks, what is the consequence of using the name as ID?
Comment 4 James Blackburn CLA 2010-11-30 08:47:32 EST
Just trying to work out what the effect is ;)


A quick look shows the loaded Profile is a CustomProfile and #getID()
 returns ID_PREFIX + fName
whereas builtin profile just returns getID.

Rudolf can you be more explicit on what's not working right here (other than it just looks incorrect)?
Comment 5 James Blackburn CLA 2010-11-30 09:33:21 EST
(In reply to comment #4)
>  returns ID_PREFIX + fName

And I think this is the reason why I did this.  The CustomProfile doesn't actually have an ID. ID is generated as '_' + fName. It didn't seem to make sense to require integrators to prepend _ when setting the org.eclipse.cdt.ui/formatter_profile key.

Rather they use the profile name directly as that's the only attribute they can change.

AFAICS it doesn't matter one way or the other, apart from the leading '_'.
Comment 6 Rudolf Hornig CLA 2010-12-01 06:22:41 EST
Ok, you are right. Sorry for the confusion. I did not check that the getID is actually returning the name. The only problem was that I had to specify 

org.eclipse.cdt.ui/formatter_profile= profilename 

where profilename might be localized. But it is not a big deal especially that there is no place to specify the ID inside the profile xml file.

I guess we should close this bug. Sorry guys.