Bug 128077 - [65cat] Indent lines in groups to be easily read
[65cat] Indent lines in groups to be easily read
Status: NEW
Product: java
Classification: Unclassified
Component: Editor
6.x
PC All
: P3 with 18 votes (vote)
: TBD
Assigned To: Dusan Balek
issues@java
:
: 151456 153271 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
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
:


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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo