Bug 21194 - Filtered organize imports and code assist [code manipulation] [editor]
Summary: Filtered organize imports and code assist [code manipulation] [editor]
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement with 6 votes (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
: 16300 37829 39267 46559 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-03 00:49 EDT by Konstantin Scheglov CLA
Modified: 2003-12-10 04:32 EST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Scheglov CLA 2002-07-03 00:49:42 EDT
Fairly often I need to import SWT classes, which have same names as classes 
from other libraries, for example Color. And often I know, that I want SWT 
class, not from other libraries. So it would be nice to have possibility to 
limit next selection from several choices in dialog one or two, most usefull 
and when I will press Ctrl+Shift+O I will see only these choices. And have 
another hot key for displaying all choices.
Comment 1 Dirk Baeumer CLA 2002-07-29 08:52:22 EDT
If we provide such a filter then it should also be honored by code assist and 
add import
Comment 2 Martin Aeschlimann CLA 2002-09-30 10:52:30 EDT
*** Bug 16300 has been marked as a duplicate of this bug. ***
Comment 3 Dirk Baeumer CLA 2003-05-19 10:31:20 EDT
*** Bug 37829 has been marked as a duplicate of this bug. ***
Comment 4 Dirk Baeumer CLA 2003-06-24 11:16:18 EDT
*** Bug 39267 has been marked as a duplicate of this bug. ***
Comment 5 Omry Yadan CLA 2003-06-24 11:56:56 EDT
From Bug 39267:
Two useful way of defining unwanted packages are to say what I do allow, for
example:
allow only:
com.mycompany.*

or to say what I do deny.
deny any
com.ms.*

I suggest to have UI for both options.

such setting should be workspace wide, but should be overrideable at the
project level.
Comment 6 Jon Skeet CLA 2003-06-24 12:03:19 EDT
Yup, this is something I've often wanted, when dealing with lots of 3rd party
libraries, each of which seems to have a lot of similarly named classes to mine :)

And indeed that would be another option for the UI of the filter: be able to
say, "I want to be able to import automatically from the project's source code
and the JRE itself." (etc)

Of course, it shouldn't screw up when you've deliberately imported something
from another library...
Comment 7 Omry Yadan CLA 2003-06-25 03:11:43 EDT
good point..
Comment 8 David Corbin CLA 2003-08-21 10:45:47 EDT
I think that these configuration parameters should be "workspace wide" and
"project specific".  Furthermore, browser dialogs that pay attention to these
should offer a "local one-time-override" if practical.
Comment 9 Martin Kersten CLA 2003-08-28 09:58:08 EDT
I don't know if I may add it here but I also wish to filter my code assistant 
and I was pointed here.

I was thinking if it is possible to give it some more 'intelligence'. I was 
thinking about the sorting and what's the first suggestion at all. I know it's 
dealing type assoziates and closest guess and stuff (and it works well). But 
mostly when a new import statement is needed (type unknown) it missguesses 
every time. For example if I import Map or List I get many guesses but I only 
constantly need them from java.util.*. 

Therefore it would be great if the code assistant would be able to store some 
statistic informations. A simple mapping from input to type would save me most 
of scrolling, pointing, and clicking stuff (just hit enter - it was the first 
guess - yipey). And if this mapping is persistantly stored it would ease 
everything for me ;). 

Summery:
Add simple mapping of input to type. Type 'List' and select the java.util.List 
and the next time 'List' is typed, the code assist's first guess will be 
java.util.List rather then *.swt.List or *.awt.List. To limit memory footprint 
the map may only contain the latest and the most often used inputs.

If this is already implemented I would like to say sorry ;) I am using Eclipse 
2.1
Comment 10 Dirk Baeumer CLA 2003-11-13 16:21:29 EST
*** Bug 46559 has been marked as a duplicate of this bug. ***
Comment 11 Martin Aeschlimann CLA 2003-12-08 04:36:22 EST
Added a 'Type Filter' preference page where you can select package names with 
wild cards to specify types you don't want to show up in 'all types', 'code 
assist' and quick fix proposals.

This is experimental so far. Filters are defined workbench global and should 
not really be implemented in the UI but in the core.
> 20031205
Comment 12 Konstantin Scheglov CLA 2003-12-10 04:32:22 EST
Would be great to have this filter not only global for all workspace, but also
for project and for individual packages. 
  I.e. if you set filter for project, it should be used for all packages of this
project. But you can also set different filter for any package (and all
sub-packages, yes, I know, that there is not such thing as package hierarhy, but
this would be useful), so for this package only package filter will be used.
  For example, if you write application that uses SWT and Draw2d, for some
packages you want to use Point/Rectangle from SWT, but for another - from draw2d.