Bug 309787

Summary: Extension point "org.eclipse.jdt.core.codeFormatter" is ignored
Product: [Eclipse Project] JDT Reporter: Arno Unkrig <arno>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, daniel_megert, markus.kell.r, Olivier_Thomann, srikanth_sankaran
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Arno Unkrig CLA 2010-04-20 07:06:43 EDT
Build Identifier: I20090611-1540

There is a family of "ToolFactory.create*CodeFormatter()" methods, part of which claim to honor the extension point "org.eclipse.jdt.core.codeFormatter", but the only one of them that does is "createCodeFormatter()", which is never called. Thus it is impossible to register a custom code formatter.

It seems like the bugs has been there for ages - has no one ever tried to use that extension point? The fix seems obvious...

Reproducible: Always

Steps to Reproduce:
1. Register a custom code formatter
2. Hit Ctrl+Shift+F
3. Custom code formatter is NOT invoked (not even instantiated)
Comment 1 Arno Unkrig CLA 2010-04-20 07:11:35 EDT
To be precise, it is source file line 169:

return new DefaultCodeFormatter(currentOptions);
Comment 2 Olivier Thomann CLA 2010-04-20 11:48:52 EDT
This extension point is deprecated as it must be defined through a deprecated interface.
What you really want is a new extension point that would reflect the new way to instantiate a code formatter.
This is an enhancement for 3.7.
Comment 3 Markus Keller CLA 2010-04-20 15:49:52 EDT
I'm not sure if it makes sense to support "pluggable" code formatters. We have a lot of references to DefaultCodeFormatterConstants and make assumptions about how the formatter works, so I doubt you would get happy with just an extension point.
Comment 4 Dani Megert CLA 2010-04-21 03:35:38 EDT
I agree with Markus.
We should clarify the Javadoc and mark the extension point deprecated.
Comment 5 Dani Megert CLA 2010-04-21 03:38:01 EDT
Created attachment 165534 [details]
Fix

Please mark the codeFormatter.exsd file as ASCII (Team > Change ASCII/Binary Property...).
Comment 6 Olivier Thomann CLA 2010-04-21 09:06:47 EDT
Released for 3.6M7.
Thanks for the patch.
Comment 7 Ayushman Jain CLA 2010-04-27 02:37:10 EDT
Verified for 3.6M7 through code inspection
Comment 8 Srikanth Sankaran CLA 2010-04-27 06:01:18 EDT
Verified.