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 186368 - Ordering Class suggestions in Fix Imports
Summary: Ordering Class suggestions in Fix Imports
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Jan Becicka
Depends on:
Reported: 2010-05-19 09:54 UTC by alexmilowski
Modified: 2010-09-23 08:50 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description alexmilowski 2010-05-19 09:54:03 UTC
I often use the same libraries in my projects and "Fix Imports" often suggests the "wrong" class from that perspective.  I'd like to be able to configure an ordering of classes so the "right" class comes up first.  That would save me a lot of time.

For example, I use the Restlet ( libraries and they use the class "Resource" a lot.  Resource comes up with the following choices in this order:


which is just sorted lexicographically.  I'd prefer the ability to configure in my preferences that is the class selected.

In addition, there seems to be some obvious general tweaks that would be good to implement overall
selection choice:

  * org.*, com.*, java.*, and javax.* packages should come before others.  This helps
    distinguish between things like "apple.laf.CoreUIConstraints.Variant" and classes
    like org.restlet.representation.Variant.  The apple.* is probably, statistically speaking, almost
    always the wrong choice.

  * java.* before org.*
  * org.* before com.*

I think some set of default rules like the above would give a better outcome to the average user.  Afterwards, they could change that selection.

In addition, the UI could keep track of such selections and ask the user whether they want to remember that ordering preference.  In my first example, when I choose, it could ask (or have a checkbox) to remember that choice and then the next time the class would come up first.  It should still present the options via the same interface but just the selected class would be different.

It might be a good idea to keep the list of possible classes sorted lexicographically and then just use the rules to determine which should be selected by default.

I use the "fix imports" feature all the time and this would be a big time-saving improvement for me.