Bug 506826 - [organize imports] specify wildcard policy for particular packages
Summary: [organize imports] specify wildcard policy for particular packages
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-01 08:10 EDT by jules CLA
Modified: 2016-11-02 04:43 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jules CLA 2016-11-01 08:10:19 EDT
It would be useful if, when using organize imports on files that use static imports from specific packages that are known to be relatively stable or to have naming policies that are unlikely to cause an issue when they change, we could add an exception that allows the use of wildcard imports even when the number is less than the threshold.  Perhaps the most common use case would be to provide exceptions for common unit testing library packages (e.g. org.junit.Assert, org.hamcrest.Matchers, and so on) where static imports are heavily used and where once you have used one in a file you are likely to use others, but I'm sure that once you have an ability to add a package to a list that will be treated this way people will find other ways to use it to.

To be clear, what I'm suggesting is a UI in the organize imports preferences dialog that looks something like this:

   Number of imports needed for .*        [      99]

   Number of static imports needed for .* [      99]

   [X] Allow exceptions for individual packages or classes
   +-------------------+---------+---------+  +----------+
   |Package/class      | imports | statics |  | Add...   |
   +-------------------+---------+---------+  +----------+
   |org.junit.Assert   |       - |       1 | 
   |                   |         |         |  +----------+
   |                   |         |         |  |Edit...   |
   |                   |         |         |  +----------+
   |                   |         |         |
   |                   |         |         |  +----------+
   |                   |         |         |  |Remove    |
   +-------------------+---------+---------+  +----------+
Comment 1 Jay Arthanareeswaran CLA 2016-11-02 04:43:38 EDT
Manoj, I am assuming this doesn't require any work on the core part and moving to UI for consideration.