Bug 113027 - [open type] Provide a option to disable find type in jar file in Open Type dialog.
Summary: [open type] Provide a option to disable find type in jar file in Open Type di...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 536210 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-18 22:10 EDT by Pan Feng CLA
Modified: 2020-07-23 06:59 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pan Feng CLA 2005-10-18 22:10:45 EDT
When I press CTRL+SHIFT+T to open OpenType dialog and type sth. to find a type.
If the type has both in source file and jar file, it will display twice. But we
always find the type in source file. 
Would you please provide a option checkbox to disable find type in jar file in
Open Type dialog.
Thanks!
Comment 1 Jerome Lanneluc CLA 2005-10-19 04:16:46 EDT
Moving to JDT UI for comment
Comment 2 Martin Aeschlimann CLA 2005-10-19 07:07:35 EDT
What you suggest seems a bit too specific to me.
Did you see that you select a working set in the open type dialog's view menu?
You could for example create a working set that contains everything except the
JAR's you don't like.

Setting to remind.
Comment 3 Denis Roy CLA 2009-08-30 02:07:26 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 4 Dani Megert CLA 2018-06-25 04:41:51 EDT
Still valid.
Comment 5 Dani Megert CLA 2018-06-25 04:42:11 EDT
*** Bug 536210 has been marked as a duplicate of this bug. ***
Comment 6 Juergen Baier CLA 2019-07-25 08:23:36 EDT
This is still open (and relevant) in 4.12.

I think we probably need more than a checkbox to filter classes from JAR files. Instead the "Open Type" dialog should be a bit more intelligent.

1. Consider only Java classes of my most recently used project
2. Consider only Java classes of dependent projects of my most recently used project
3. ...
...
20. Consider Java classes from the java.* namespace
21. Consider Java classes from the sun.* namespace
...

Example of the current behavior:

We have a class "Entity" in our project. When I try to open "Entity" then the first hits I get are:

- com.sun.tools.doclint [adoptopenjdk11]
- com.sun.xml.internal.stream [adoptopenjdk11]
- java.swing.text.html.parser [adoptopenjdk11]
- javax.ws.rs.client [java.ws.rs-api-2.1.1.jar]
...
- my own Entity class

I think this should be somehow improved.
Comment 7 Juergen Baier CLA 2020-06-18 07:13:24 EDT
I was just looking for an enum "Action" in my workspace (yes, probably not a really good name), was scared about the order of the results and remembered this bug ...

Any progress on that?

The point is that my "Action" enum appeared at the 37th position (I had to scroll down).

Some of the "Action" classes shown before my workspace "Action" come from transitive dependencies of libraries I'm using (something like org.apache.commons.math3.ode.events.Action).

Another idea how to improve the user experience for "Open Type": 

Maybe show matches from JAR files in a different color or style (= highlight the classes from the workspace). This could already improve the situation a lot, even without improved ordering.
Comment 8 Johan Compagner CLA 2020-07-22 09:52:12 EDT
i guess this case is also describing the bit that i like to have
that when searching for something that the sort order is always "workspace/source types first"

for example in our source we have a class called "Row"

but there are are lot more people that think "Row" is a good name ;)

So there are many Row classes in all the binary jars, so my Row class if i search for it is only 13th! position.. 
I would love to have an option (or could be completely default) that source stuff are always sorted first and then library/binary classes.
Comment 9 Julian Honnen CLA 2020-07-22 10:03:07 EDT
I like IntelliJ's behavior: Initially the dialog only shows types from the opened project. To include everything else, there's a "include non-project items" checkbox - which is triggered by the same key binding as the dialog.
Comment 10 Johan Compagner CLA 2020-07-22 10:08:11 EDT
is this the place where the current sorting is done?

https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java#n1157

Not sure if we have there enough info that i can decide this is a source thing or a class? Because then i could easily make a quick gerrit patch
Comment 11 Julian Honnen CLA 2020-07-22 10:32:14 EDT
(In reply to Johan Compagner from comment #10)
> is this the place where the current sorting is done?
> 
> https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui/ui/
> org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java#n1157
> 
> Not sure if we have there enough info that i can decide this is a source
> thing or a class? Because then i could easily make a quick gerrit patch
Apparently that compare already checks for source types (getElementTypeCategory). But only if the fully qualified names are equal.

Might make sense to bump the source comparison before compareTypeContainerName, i.e.

1) simple name
2) deprecation
3) from sources
4) package name
5) container name
Comment 12 Johan Compagner CLA 2020-07-22 10:59:55 EDT
ahh right.. i didn't notice that but i think the only thing we want is that he lines:

https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java#n1169

until 1174 are just done first...
so source is always on top and sorted by itself.
Comment 13 Eclipse Genie CLA 2020-07-23 03:58:34 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/166692
Comment 14 Johan Compagner CLA 2020-07-23 04:00:34 EDT
i made that patch and updated my own 4.16 install with that.
For me that works perfectly, now the once i really search for are really on top (for the most part i am wanting to open source files, not searching for binaries)
Comment 15 Johan Compagner CLA 2020-07-23 06:10:49 EDT
created another bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=565467