Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319852 - [Dialogs] Open Resource now interprets "." as "*.", unlike 3.5
Summary: [Dialogs] Open Resource now interprets "." as "*.", unlike 3.5
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows Server 2003
: P3 normal (vote)
Target Milestone: 3.7 M1   Edit
Assignee: Markus Keller CLA
QA Contact: Susan McCourt CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-14 09:32 EDT by Chris West (Faux) CLA
Modified: 2010-08-24 16:27 EDT (History)
4 users (show)

See Also:
daniel_megert: review+


Attachments
Fix for 3.6.1 (1.34 KB, patch)
2010-08-23 11:09 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris West (Faux) CLA 2010-07-14 09:32:29 EDT
Build Identifier: 20100617-1415

In 3.5, ctrl+shift+r Open Resource "A.java" would show only files called "A.java".

In 3.6, it shows every java file in the workspace starting with A,
AbstractFoo.java
AbstractBar.java
AllTests.java
AllTests.java
AllTests.java
AllTests.java
A.java
etc.


This behaviour is similar to Open Type, which has special processing for "." to mean "a package, or multiple packages, separator"?

I believe that this should be reverted to the pre-Helios behaviour, as there already exists syntax to do the new behaviour both now and before ("A*.java").

Reproducible: Always

Steps to Reproduce:
1. Have plenty of files in your workspace.
2. Ctrl+shift+r Open Resource A.java
3. See files not called A.java in the results.
Comment 1 Markus Keller CLA 2010-07-14 13:17:16 EDT
In 3.6, we still show A.java on top, so the first match didn't change (you just get more matches).

The added benefit of the new behavior is that you not only get free prefix matching at the end of the whole file name, but you now get it separately for the base name and for the extension. This is especially useful for camel case matches: In 3.5, it was e.g. not possible to open AbstractBar.java by just typing "AB.java". It worked for "AB", but there was no way to add a file extension without having to change the pattern for the base name.

This is similar to how the Open Type dialog works. There, we also split the pattern at the "." that separates package and type name, and you get free prefix matching for both parts.

To avoid automatic prefix matching, you can add a "<" or a " " (space) at the end of a pattern. E.g. "A<.java" reduces the match count, but it still leaves some unwanted matches, because "A" is also a valid camel case prefix, so this pattern also matches e.g. "Argument.java".
Comment 2 Markus Keller CLA 2010-07-14 13:20:45 EDT
I've released a fix to HEAD of FilteredResourcesSelectionDialog, such that a "<" or " " at the end of the whole pattern disables the separate prefix matching for base name and extension.

So "A.java<" will not match any A*.java files any more.
Comment 3 Chris West (Faux) CLA 2010-07-14 14:12:11 EDT
Mmm, apparently I wasn't looking very carefully.

The first match does change, but only if you have recently used files.

i.e. you get:
AbstractFoo.java
AbstractBar.java
AllTests.java
AllTests.java
AllTests.java
AllTests.java
------------------- Workspace matches ----------------
A.java
...

, which is what I was actually complaining about. :)


Why " " or "<" instead of "$", regex style (which I actually tried the first time I came across this)?  But, cool, anyway.
Comment 4 Dani Megert CLA 2010-07-15 02:07:15 EDT
>Why " " or "<" instead of "$", regex style
Because this is used in 'Open Type' for years.
Comment 5 Markus Keller CLA 2010-07-15 05:17:06 EDT
> The first match does change, but only if you have recently used files.

You're right, but I don't see how we could improve this without losing the new functionality. The workaround in 3.7 is to append " " or "<".

> >Why " " or "<" instead of "$", regex style
> Because this is used in 'Open Type' for years.

And because it was already like this in the Open Resource dialog since at least 3.3 (although this has only been documented properly in 3.6), and because "$" is a valid character in a Java type name but the others are not. And note that the only wildcards supported in the pattern are the glob-style ? and * (i.e. no regexes).
Comment 6 Dani Megert CLA 2010-08-03 05:53:34 EDT
Verified in I20100802-1800: found some additional issues, see bug 321564.
Comment 7 Dani Megert CLA 2010-08-23 06:03:17 EDT
Makes sense to fix regression in 3.6.1 RC2. Boris, please speak up if you disagree.
Comment 8 Markus Keller CLA 2010-08-23 11:09:37 EDT
Created attachment 177229 [details]
Fix for 3.6.1
Comment 9 Boris Bokowski CLA 2010-08-24 10:57:55 EDT
+1 for fixing in 3.6.1 RC2.

Could you please open a new bug for the 3.6.1 work and keep this one with a target milestone of 3.7 M1? Platform UI uses "clone this bug" for that purpose. The reason is that you can later query for which bugs got fixed in which release, and you need two bugs if there are two target milestones for which we applied the fix.
Comment 10 Markus Keller CLA 2010-08-24 16:27:42 EDT
> Could you please open a new bug for the 3.6.1 work ...
Sure, opened bug 323539.