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 110177 - Provide separate formatting/placement options for empty braces
Summary: Provide separate formatting/placement options for empty braces
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Rastislav Komara
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-18 16:09 UTC by matthies
Modified: 2009-02-03 10:57 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 2007-07-18 16:09:09 UTC
Under Tools -> Options -> Java Code -> Formatting -> Alignment and Braces -> Braces Placement, provide additional 
options for empty pairs of braces. For example I'd like to have empty classes/methods to be formatted like

    class X { }

    void f() { }

not like

    class X
    {
    }

    void f()
    {
    }

as they currently do with my settings.
Comment 1 hazgod 2008-11-19 14:32:45 UTC
I'd also like separate options for the braces. Currently it's got Class Declaration, Method Declaration and Other. Other
includes all the if/else etc as well as array initializers and all the other things. I want most of them on, however
when I have a [][], it gets really messy with new lines all over the place. For example it gets formatted like this:

cssLinks = new String[][]
{
    {
        "screen, projection, print", PageParts.siteContext + "CSS/coreFonts.css"
    },
    {
        "screen, projection, print", PageParts.siteContext + "CSS/login.css"
    },
    {
        "screen, projection, print", PageParts.siteContext + "CSS/adminFonts.css"
    },
    {
        "screen, projection, print", PageParts.siteContext + "CSS/adminStyle.css"
    },
    {
        "screen, projection, print", PageParts.siteContext + "CSS/menu.css"
    },
    {
        "screen, projection, print", PageParts.siteContext + "CSS/buttons.css"
    },
    {
        "screen, projection, print", PageParts.siteContext + "CSS/ShoppingBasket.css"
    }
};


And I want it to stay like this

cssLinks = new String[][]
{
    {"screen, projection, print", PageParts.siteContext + "CSS/coreFonts.css"},
    {"screen, projection, print", PageParts.siteContext + "CSS/login.css"},
    {"screen, projection, print", PageParts.siteContext + "CSS/adminFonts.css"},
    {"screen, projection, print", PageParts.siteContext + "CSS/adminStyle.css"},
    {"screen, projection, print", PageParts.siteContext + "CSS/menu.css"},
    {"screen, projection, print", PageParts.siteContext + "CSS/buttons.css"},
    {"screen, projection, print", PageParts.siteContext + "CSS/ShoppingBasket.css"}
};


Currently the only way to do that is to set the Other option in "Braces Placement" to be "Same Line", which does this to
the rest of my code:

try {

if() {

else {

catch(Exception e) {

}finally {

Which I don't like, and I can't mix the 2 at the moment. Other should be expanded as much as possible into as many
different options as you can
Comment 2 Rastislav Komara 2009-02-03 10:57:24 UTC
Overtake.