Bug 239473 - [formatter] Override Ability at Specific Code Locations
Summary: [formatter] Override Ability at Specific Code Locations
Status: VERIFIED DUPLICATE of bug 27079
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-03 12:02 EDT by Don Leckie CLA
Modified: 2010-03-09 06:12 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Don Leckie CLA 2008-07-03 12:02:10 EDT
Please add the ability to override the Java Formatter.  Annotations would provide the flexibility required.

We have numerous cases where long arrays containing 2 or more columns per row are unreadable when the Java Formatter is enabled in "Preferences/Java/Code Style/Formatter".

We need the ability to disable formatting of this array.  Ideally, annotations would provide great flexibility in overriding the formatting preferences.

Two examples are below.  One is after formatting.  The other is before formatting.

Thank you,
Don Leckie


Here is an example after formatting
-----------------------------------
final Object[] defaults = {
"Button.font",
dialogBold11Font,

"Courier.font",
courierFont,

"Default.font",
dialogPlain11Font,
"Default.bold11Font",
dialogBold11Font,
"Default.bold14Font",
dialogBold14Font,
"Default.monospaced11Font",
monospaced11Font,
"Default.serif12Font",
serifPlain12Font,
"Default.serifBold14Font",
serifBold14Font,
"Default.mappedFont",
mappedFont,
"Default.unmappedCommentRuleFont",
unmappedCommentRuleFont,
"Default.unmappedFont",
unmappedFont,
"Default.enabledForeground",
black,
"Default.enabledBackground",
contivoDarkerCream,
"Default.disabledForeground",
disabledForeground,
"Default.disabledBackground",
disabledBackground,
"Default.disabledTreeBackground",
disabledBackground,
"Table.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] { "ctrl A", "selectAll", "ESCAPE", "cancel", "F2",
					"startEditing",

					"DOWN", "selectNextRow", "KP_DOWN", "selectNextRow", "shift DOWN",
					"selectNextRowExtendSelection", "shift KP_DOWN", "selectNextRowExtendSelection",

					"END", "selectLastColumn", "ctrl END", "selectLastRow", "ctrl shift END",
					"selectLastRowExtendSelection", "shift END", "selectLastColumnExtendSelection",

					"HOME", "selectFirstColumn", "ctrl HOME", "selectFirstRow", "ctrl shift HOME",
					"selectFirstRowExtendSelection", "shift HOME", "selectFirstColumnExtendSelection",

					"PAGE_DOWN", "scrollDownChangeSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection",
					"ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", "shift PAGE_DOWN",
					"scrollDownExtendSelection",

					"PAGE_UP", "scrollUpChangeSelection", "ctrl PAGE_UP", "scrollLeftChangeSelection",
					"ctrl shift PAGE_UP", "scrollRightExtendSelection", "shift PAGE_UP", "scrollUpExtendSelection",

					"LEFT", "selectPreviousColumn", "KP_LEFT", "selectPreviousColumn", "shift LEFT",
					"selectPreviousColumnExtendSelection", "shift KP_LEFT", "selectPreviousColumnExtendSelection",

					"RIGHT", "selectNextColumn", "KP_RIGHT", "selectNextColumn", "shift RIGHT",
					"selectNextColumnExtendSelection", "shift KP_RIGHT", "selectNextColumnExtendSelection",

					"UP", "selectPreviousRow", "KP_UP", "selectPreviousRow", "shift UP",
					"selectPreviousRowExtendSelection", "shift KP_UP", "selectPreviousRowExtendSelection", }),
"Tree.openIcon", IconUtil.getPlatformImageIcon("icons/TreeOpen.gif"), "Tree.closedIcon",
IconUtil.getPlatformImageIcon("icons/TreeClosed.gif"), "Tree.leafIcon",
IconUtil.getPlatformImageIcon("icons/TreeLeaf.gif"), "ToolBar.add16", IconUtil.getContivoImageIcon("icons/insert16.gif"), "ToolBar.apply", IconUtil.getContivoImageIcon("icons/apply.gif"), "ToolBar.Apply16", IconUtil.getContivoImageIcon("icons/apply16.gif"),
[more...]
};





Here is an example before formatting
------------------------------------
Object[] defaults =
{
    "Button.font", dialogBold11Font,

    "Courier.font", courierFont,

    "Default.font", dialogPlain11Font,
    "Default.bold11Font", dialogBold11Font,
    "Default.bold14Font", dialogBold14Font,
    "Default.monospaced11Font", monospaced11Font,
    "Default.serif12Font", serifPlain12Font,
    "Default.serifBold14Font", serifBold14Font,
    "Default.mappedFont", mappedFont,
    "Default.unmappedCommentRuleFont", unmappedCommentRuleFont,
    "Default.unmappedFont", unmappedFont,
    "Default.enabledForeground", black,
    "Default.enabledBackground", contivoDarkerCream,
    "Default.disabledForeground", disabledForeground,
    "Default.disabledBackground", disabledBackground,
    "Default.disabledTreeBackground", disabledBackground,
    "Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[]
    {
        "ctrl A", "selectAll",
        "ESCAPE", "cancel",
        "F2", "startEditing",

        "DOWN", "selectNextRow",
        "KP_DOWN", "selectNextRow",
        "shift DOWN", "selectNextRowExtendSelection",
        "shift KP_DOWN", "selectNextRowExtendSelection",

        "END", "selectLastColumn",
        "ctrl END", "selectLastRow",
        "ctrl shift END", "selectLastRowExtendSelection",
        "shift END", "selectLastColumnExtendSelection",

        "HOME", "selectFirstColumn",
        "ctrl HOME", "selectFirstRow",
        "ctrl shift HOME", "selectFirstRowExtendSelection",
        "shift HOME", "selectFirstColumnExtendSelection",

        "PAGE_DOWN", "scrollDownChangeSelection",
        "ctrl PAGE_DOWN", "scrollRightChangeSelection",
        "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
        "shift PAGE_DOWN", "scrollDownExtendSelection",

        "PAGE_UP", "scrollUpChangeSelection",
        "ctrl PAGE_UP", "scrollLeftChangeSelection",
        "ctrl shift PAGE_UP", "scrollRightExtendSelection",
        "shift PAGE_UP", "scrollUpExtendSelection",

        "LEFT", "selectPreviousColumn",
        "KP_LEFT", "selectPreviousColumn",
        "shift LEFT", "selectPreviousColumnExtendSelection",
        "shift KP_LEFT", "selectPreviousColumnExtendSelection",

        "RIGHT", "selectNextColumn",
        "KP_RIGHT", "selectNextColumn",
        "shift RIGHT", "selectNextColumnExtendSelection",
        "shift KP_RIGHT", "selectNextColumnExtendSelection",

        "UP", "selectPreviousRow",
        "KP_UP", "selectPreviousRow",
        "shift UP", "selectPreviousRowExtendSelection",
        "shift KP_UP", "selectPreviousRowExtendSelection",
    }),
    "Tree.openIcon", IconUtil.getPlatformImageIcon("icons/TreeOpen.gif"),
    "Tree.closedIcon", IconUtil.getPlatformImageIcon("icons/TreeClosed.gif"),
    "Tree.leafIcon", IconUtil.getPlatformImageIcon("icons/TreeLeaf.gif"),
    "ToolBar.add16", IconUtil.getContivoImageIcon("icons/insert16.gif"),
    "ToolBar.apply", IconUtil.getContivoImageIcon("icons/apply.gif"),
    "ToolBar.Apply16", IconUtil.getContivoImageIcon("icons/apply16.gif"),
[more...]
};
Comment 1 Markus Keller CLA 2008-08-13 11:00:24 EDT
See bug 27079, bug 76435, bug 103302, bug 193498 and others.

BTW: You should create 2 umbrella bugs (or use 2 of the existing bugs) for all these recurring requests:
1.) disable formatter in certain range
2.) add a setting to stop the formatter from touching line breaks (e.g. bug 198074)
Comment 2 Frederic Fusier CLA 2010-02-17 04:18:10 EST
Duplicate of bug 27079.

*** This bug has been marked as a duplicate of bug 27079 ***
Comment 3 Ayushman Jain CLA 2010-03-09 06:02:01 EST
Verified for 3.6M6 using build I20100305-1011.
Comment 4 Jay Arthanareeswaran CLA 2010-03-09 06:12:10 EST
Verified.