Bug 6503 - Search page - should offer case sensitivity check box
Summary: Search page - should offer case sensitivity check box
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 6423
Blocks:
  Show dependency tree
 
Reported: 2001-12-03 09:42 EST by Philipe Mulet CLA
Modified: 2002-01-16 03:40 EST (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 Philipe Mulet CLA 2001-12-03 09:42:11 EST
Build 20011127

Due to bug 6423 fix, the API SearchEngine.search(IWorkspace, String, int, int, 
IJavaSearchScope, IJavaSearchResultCollector) is now performing a case 
insensitive search (more intuitive).

However, the UI page should offer a checkbox for case sensitivity, and rather 
use the following call to trigger the search:

SearchEngine.search(workspace, createSearchPattern(patternString, searchFor, 
limitTo, caseSensitiveFlag), scope, resultCollector);
Comment 1 Erich Gamma CLA 2001-12-04 03:46:44 EST
UI will add a checkbox for a case sensitive search.
However, changing the API contract to make SearchEngine.search
is a breaking API change that we cannot do now.
I strongly disagree that an insensitive search is more intuitive.

The UI should deal with the default setting of case sensitive
search, this should not be done at the API level.

However, the current API doesn't allow the UI to do so:
SearchEngine.search(IWorkspace, IJavaElement, int, IJavaSearchScope) doesn't 
provide support for setting whether the search should be done in a
case insensitive way.

Proposal:
- change the default back to the old one (case sensistive is the default)
- add support for defining case sensitivity consistently in the API
Once this is in place the UI will add the checkbox and offer
a case insensitive Java search. The default will be case sensisitive but
the setting will be remembered.

Moving back to Java Core
Comment 2 Dani Megert CLA 2001-12-04 03:49:51 EST
Add checkbox with "case-sensitive" as default.

The state of this checkbox must be be remembered.
Note: Text search checkbox should be enhanced accordingly
Comment 3 Jerome Lanneluc CLA 2001-12-04 04:13:26 EST
It doesn't make sense to search references to an IJavaElement in a case 
insensitive way. This is especially true when the user starts the search from 
the context menu (i.e. in the outline, in the package view etc.)

When the user starts the search from the search dialog, she doesn't have the 
impression of doing a search on an IJavaElement any more, but on a string 
pattern (since this is what is shown in the dialog.)

Having said that, I think the existing API is sufficient for the UI: when the 
user brings up the search dialog with an IJavaElement selected, if she doesn't 
do any change, then SearchEngine.search(IWorkspace, IJavaElement, int, 
IJavaSearchScope) can be used (as it is now). If she makes any change 
(including unchecking the "case-sensitive" checkbox), then SearchEngine.search
(workspace, createSearchPattern(patternString, searchFor, 
limitTo, caseSensitiveFlag), scope, resultCollector) should be used.


Comment 4 Jerome Lanneluc CLA 2001-12-04 04:17:26 EST
Forgot to CC you. Please see my previous comment.
Comment 5 Jerome Lanneluc CLA 2001-12-04 04:18:57 EST
Forgot to CC you. Please see my previous comment.
Comment 6 Dani Megert CLA 2001-12-04 10:17:37 EST
Switching case-sensitivity should not impact the accuracy. If I have to convert 
form a IJavaElement based search to string based search I will lose information.

Why should a user of the Search API not be allowed to use an IJavaElement (e.g. 
method "close" from the Outline or retrieved via code resolve) as input to a 
case-insensitive search i.e. why not offer such an option? Why does the client 
have to deal with the transformation into a string?

The API change was not commented. If the API is changed then I would also expect 
that search for declarations of method "x.close()" (= IJavaElement) would return 
methods like "Y.ClOse()" - just to be in synch.
Comment 7 Philipe Mulet CLA 2001-12-05 12:26:51 EST
API reverted to its old behavior.
Moving back to JUI for disposal.
Comment 8 Erich Gamma CLA 2001-12-05 16:42:43 EST
when the text input for the field comes from an IJavaElement then the case 
sensitive box should be disabled (but preserve its state). It doesn't make 
sense to do an case insensitive search in this case. The check box is enabled 
as soon as the user starts editing.
Comment 9 Dani Megert CLA 2001-12-06 01:58:08 EST
Yep, with this in place the user will then even be able to tell whether a string 
or the Java element is used to perform the search.

Comment 10 Dani Megert CLA 2001-12-12 08:51:54 EST
Fixed
Available in builds > 20011211