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 - [65cat] Indent lines in groups to be easily read
Summary: [65cat] Indent lines in groups to be easily read
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC All
: P3 blocker with 18 votes (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 151456 153271 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-21 22:52 UTC by franci
Modified: 2016-09-13 16:52 UTC (History)
5 users (show)

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 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. ***