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 203007 - editor:format:java:imports can't disable "count to use star import"
Summary: editor:format:java:imports can't disable "count to use star import"
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-03 23:02 UTC by err
Modified: 2011-10-07 14:35 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description err 2011-10-03 23:02:00 UTC
Seems like there should be a checkbox in front of the lines,
something like the following. Otherwise there is no convenient way to disable this feature.

|X| Class Count To Use Star Import              Integer-Slider
|X| Member Count To Use Static Star Import      Integer-Slider

It's true you can bump the slider up to a huge number, but that's kind of a user hack.

(PS great new feature)

Some of the following might be bugs, if you want seperate bug reports for any of them, let me know
- "Packages to use star import" has two columns, one label'd "*" is boolean
  Does this do something?
- When something is changed, the preview window scrolls to the bottom
  (probably missing a setCaretPosition(0) after all text is replaced)
- "Separate Static Imports"
  - allowed to move the table columns around.
  - The Add button is enable when "Separate Static Imports" not checked
Comment 1 err 2011-10-03 23:06:49 UTC
Maybe this should be filed against editor,options
Comment 2 err 2011-10-04 02:04:34 UTC
Is there a shortcut for organize imports?
Comment 3 err 2011-10-04 04:13:48 UTC
Cc'ing JanB since I noticed he is the one that fixed the organize imports Bug 198488
Comment 4 err 2011-10-04 04:24:12 UTC
Forgot this

Product Version: NetBeans IDE 7.1 Beta (Build 201109252201)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
User directory: C:\Documents and Settings\erra\.netbeans\7.1beta
Cache directory: C:\Documents and Settings\erra\.netbeans\7.1beta\var\cache
Comment 5 Dusan Balek 2011-10-04 13:41:50 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/41efa312b464

> "Packages to use star import" has two columns, one label'd "*" is boolean
> Does this do something?

'*' means 'including subpackages'

> When something is changed, the preview window scrolls to the bottom
> (probably missing a setCaretPosition(0) after all text is replaced)

Unfortunately, I cannot reproduce

> allowed to move the table columns around

Fixed.

> The Add button is enable when "Separate Static Imports" not checked
???
Comment 6 err 2011-10-04 15:21:57 UTC
I'm going out of town soon so I don't know if I'll be able to take this change for a test drive in a dev build before I leave. After using the feature for a while last night I got some clarity on what I really meant to say about this issue. I think the fix is too simple (but I didn't dig into the code very deep, so I'm not certain). It looks like the code is simply using MAX_VALUE.

If "Member Count To Use Static Star Import" is disabled/not-checked, then NB should not change several "static import" to/from a single "static import *'. The static imports should only be sorted.

For example, for static imports from my own project's classes I may want to do 
        import static com.raelity.logman.LogginProps.*;
even though I'm currently referencing only a single static member.  By doing "static import ...*", then code completion will work for other statics from my class.

But for an external class, like some random java package, I'd prefer to list the individual static imports rather than using '*'.

=====

> > When something is changed, the preview window scrolls to the bottom
> > (probably missing a setCaretPosition(0) after all text is replaced)
> 
> Unfortunately, I cannot reproduce

I can reproduce by doing
- mouse click on one of the first few lines of the preview window
- Change checkbox for "separate static imports"
Observe the window scrolls.
    (I'm running jVi, that may make a difference since when I click on the
     Preview window I see the jVi caret. (new feature in jVi, when the
     caret is in a read-only window you see an empty rectangle))

=====

> > The Add button is enable when "Separate Static Imports" not checked
> ???

I'm seeing some interrelated issues around this, not sure what might be a bug
Starting with the following

        Import Layout:
            |X| Separate Static Imports
                | |     java
                | |     javax
                | |     org
                | |     <all other imports>
                | |     com.raelity
                |X|     <all other imports>
                |X|     com.raelity

            |X| Separate Groups

If I uncheck Separate Static Imports I see

        Import Layout:
            | | Separate Static Imports
                java
                javax
                <all other imports>
                org
                com.raelity

            |X| Separate Groups

Observe: - now single column
         - some rows are dropped
         - the order of org and <all other> is changed.

In this "unusual" state, the Add button is still enabled.
Press Add, add something, check "Separate Static Imports" Some of the original rows are not there anymore.
Comment 7 Quality Engineering 2011-10-05 14:13:32 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/41efa312b464
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #203007: editor:format:java:imports can't disable "count to use star import" - fixed.
Comment 8 Dusan Balek 2011-10-06 08:43:01 UTC
> If "Member Count To Use Static Star Import" is disabled/not-checked, then NB
> should not change several "static import" to/from a single "static import *'.
> The static imports should only be sorted.

I see your point - fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/a5bee380f63b

> I can reproduce by doing
> - mouse click on one of the first few lines of the preview window
> - Change checkbox for "separate static imports"
> Observe the window scrolls.
>     (I'm running jVi, that may make a difference since when I click on the
>      Preview window I see the jVi caret. (new feature in jVi, when the
>      caret is in a read-only window you see an empty rectangle))

Are you able to observe the same behavior without jVi?

> If I uncheck Separate Static Imports I
> Observe: - now single column

As designed - unchecked 'Separate Static Imports' means that IDE does not distinguish static imports from other imports when reordering them, so there is no need to mark them in the Import Layout options.

>          - some rows are dropped

As designed - rows with static imports are dropped.

>          - the order of org and <all other> is changed.

Unfortunately, I cannot reproduce.
Comment 9 err 2011-10-06 16:45:25 UTC
Thanks.

I'll exercise the remaining issue with new dev build and with/without jVi.
Comment 10 Quality Engineering 2011-10-07 14:35:34 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a5bee380f63b
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #203007: editor:format:java:imports can't disable "count to use star import" - fix cont.