Bug 309787 - Extension point "org.eclipse.jdt.core.codeFormatter" is ignored
Summary: Extension point "org.eclipse.jdt.core.codeFormatter" is ignored
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-20 07:06 EDT by Arno Unkrig CLA
Modified: 2010-04-27 06:01 EDT (History)
5 users (show)

See Also:


Attachments
Fix (5.45 KB, patch)
2010-04-21 03:38 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.