This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 129677 - Let formatting of opening brace depend on the placement of the closing brace
Summary: Let formatting of opening brace depend on the placement of the closing brace
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-10 16:17 UTC by matthies
Modified: 2008-03-10 17:16 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2008-03-10 16:17:49 UTC
I'd like the settings under Tools -> Options -> Java Code -> Formatting -> Alignment and Braces -> Braces Placement to 
be applied only when the closing brace is already on a different line than the respective element. In other words, 
braces placed like this

    <whatever> { ... }  // <- closing brace on the same line as <whatever>

wouldn't be reformatted to different lines. (Horizontal formatting rules defined elsewhere would still apply.)

The rationale is that sometimes one wants single-line instead of multi-line formatting for an element with braces, for 
example in the case of short or trivial brace contents. The decision of multi-line vs. single-line usually can't be 
automated (or the rules would be exceedingly complex, and still not please everyone), so it's best to just keep that 
aspect of the formatting as it was found in the source code.

There are several ways to implement this enhancement:
- Just replace the old behavior with this, and document it. (I suspect most users would be happy with this.)
- Add one checkbox in the "Braces Placement" tab to activate this behavior for all kinds of braces.
- Add a checkbox for each selection box in the "Braces Placement" tab to selectively activate this behavior for 
different kinds of braces.

Product Version: NetBeans IDE 6.1 Beta (Build 200803050202)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)