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 128077

Summary: [65cat] Indent lines in groups to be easily read
Product: java Reporter: franci <franci>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: blocker CC: gabriel.burceanu, markiewb, mkrauskopf, ris, zdro
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description franci 2008-02-21 22:52:18 UTC
This is an example of code from Calendar.java 

    final static int ERA_MASK		= (1 << ERA);
    final static int YEAR_MASK		= (1 << YEAR);
    final static int MONTH_MASK		= (1 << MONTH);
    final static int WEEK_OF_YEAR_MASK	= (1 << WEEK_OF_YEAR);
    final static int WEEK_OF_MONTH_MASK	= (1 << WEEK_OF_MONTH);
    final static int DAY_OF_MONTH_MASK	= (1 << DAY_OF_MONTH);

As you can see it's well indented so you can easily understand it in just a glance. But when you use the "Format" option
of netbeans you get this code 

    final static int ERA_MASK = (1 << ERA);
    final static int YEAR_MASK = (1 << YEAR);
    final static int MONTH_MASK = (1 << MONTH);
    final static int WEEK_OF_YEAR_MASK = (1 << WEEK_OF_YEAR);
    final static int WEEK_OF_MONTH_MASK = (1 << WEEK_OF_MONTH);
    final static int DAY_OF_MONTH_MASK = (1 << DAY_OF_MONTH);

yes it's well indented but you can't understand as easily as before.

So I'd like an option to tell Netbeans to indent lines of code in groups of lines. So you'll get different indentations
depending on the way you group the lines of code.

1) if you put all code together

    final static int ERA_MASK		= (1 << ERA);
    final static int YEAR_MASK		= (1 << YEAR);
    final static int MONTH_MASK		= (1 << MONTH);
    final static int WEEK_OF_YEAR_MASK	= (1 << WEEK_OF_YEAR);
    final static int WEEK_OF_MONTH_MASK	= (1 << WEEK_OF_MONTH);
    final static int DAY_OF_MONTH_MASK	= (1 << DAY_OF_MONTH);

2) if you put the code in two groups

    final static int ERA_MASK	= (1 << ERA);
    final static int YEAR_MASK	= (1 << YEAR);
    final static int MONTH_MASK	= (1 << MONTH);

    final static int WEEK_OF_YEAR_MASK	= (1 << WEEK_OF_YEAR);
    final static int WEEK_OF_MONTH_MASK	= (1 << WEEK_OF_MONTH);
    final static int DAY_OF_MONTH_MASK	= (1 << DAY_OF_MONTH);

Even more I'd like some other features in Netbeans to easily understand some kind of code 

Arrays

    String[][] months = 
    {
        {"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"},
        {"mon",    "tue",     "wed",       "thu",      "fri",    "sat",      "sun"}
    };

or 

    String[] monthsL = {"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"};
    String[] monthsS = {"mon",    "tue",     "wed",       "thu",      "fri",    "sat",      "sun"};

Comments like this

        String type = "Book";   // Is a book
        String name = "1984";   // the Orwell's book
        int    price = 55.6;    // the price of the book
        int    num   = 1;       // number of books 

better than

        String type = "Book";   // Is a book
        String name = "1984";   // the Orwell's book
        int price = 55.6;    // the price of the book
        int num = 1;       // number of books 

I think these features shouldn't be enabled by default but should be there to use.

Thanks.
Comment 1 Petr Dvorak 2008-11-18 14:10:41 UTC
*** Issue 153271 has been marked as a duplicate of this issue. ***
Comment 2 Petr Dvorak 2008-11-18 14:11:53 UTC
*** Issue 151456 has been marked as a duplicate of this issue. ***
Comment 3 Petr Dvorak 2008-12-04 12:36:52 UTC
*** Issue 154590 has been marked as a duplicate of this issue. ***