Adopting JDT Mars (4.5) mechanisms and APIs
This section describes changes that are required if you are trying to change
your 4.4 plug-in to adopt the 4.5 mechanisms and APIs.
- Formatter Extension Point
- Import Rewrite Cleanup
A new extension point with id org.eclipse.jdt.core.JavaCore.JAVA_FORMATTER_EXTENSION_POINT_ID
has been added which can be used
to provide a custom formatter. By default, the formatter is org.eclipse.jdt.core.JavaCore.DEFAULT_JAVA_FORMATTER
.
Import rewrite has been cleaned up to provide consistent behavior and has the following features:
- All unmatched imports are placed together in a single match-all group.
- The behavior of removing comments has been made consistent between the two rewrite modes - incremental mode and "Organize Imports" mode -
if there is a corresponding on-demand import for a removed single import or vice-versa, comments are moved there;
otherwise they are removed entirely.
- Comments (trailing comments included) relocated from single import(s) to an on-demand import or vice-versa are now always placed on line(s) preceding the destination import.
- Comments after a package declaration are no longer treated as file header comments.
- Blank lines around and between comments are now preserved, and consequently preserving existing
formatting and also preventing comments from becoming associated with different imports.