This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 113202 - Find/replace in projects file pattern field corrupts selection clipboard
Summary: Find/replace in projects file pattern field corrupts selection clipboard
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: All Linux
: P4 blocker (vote)
Assignee: Marian Petras
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-20 14:13 UTC by ehucka
Modified: 2008-01-11 15:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ehucka 2007-08-20 14:13:31 UTC
If I select a text on unix platforms and past it by middle mouse button to 'File Name Patterns' field in Find/Replace in
projects dialog it always paste '(all files)'
Comment 1 Roman Ondruska 2007-08-20 16:22:57 UTC
It works fine on WIN when using CTRL+C/CTRL+V. Emane, can you verify that this also works on Linux? In other words, is
it just the 'middle mouse button' issue? Thanks. 
Comment 2 ehucka 2007-08-20 16:52:11 UTC
Yes, of course. I do not know how it is called so I used 'selection clipboard'.
Comment 3 Roman Ondruska 2007-08-27 15:26:35 UTC
Thanks for the info. I reproduced the same behavior with NB profiler where a similar technique is used. IMO this is a
bug of Swing implementation (Windows not affected); I would expect that the focus event will be delivered before the
text is pasted into the combo. Lowering to P4 until it is clear how to proceed with this; JDK should accept this issue
or suggest a way how to work-around it.
Comment 4 ehucka 2007-08-27 16:11:43 UTC
But why do the other textfields in the dialog work correctly? I think the '(all files)' is always put and selected in
the textfield when the dialog lost focus.
Comment 5 Marian Petras 2008-01-11 15:26:56 UTC
This bug is caused by interference of three mechanisms:

a) automatic "select all" - content of a text-field is automatically selected when the text-fields gains focus
b) automatic display of "(all files)" - whenever the file name pattern text-field loses focus, string "(all files)" is
displayed in it
c) selection clipboard - whenever text is selected, it is put to the selection clipboard

Windows does not have any selection clipboard so it is not affected. All other systems are affected.

The interference works as follows:
1) text-field "File Name Patterns:" gains focus.
2) focus listener A is notified and causes that all text "(all files") is selected
3) selection clipboard is notified and stores the selected text
4) focus listener B is notified and removes the "(all files)" text
5) the user presses the middle button - content of the selection clipboard is copied to the text-field

This particular could be solved by making sure that the "(all files)" text is removed before the test is selected.
It would not solve the case that a real file name pattern is specified.
Comment 6 Marian Petras 2008-01-11 15:58:10 UTC
Fixed (in the trunk).

I modified the code such that it is guaranteed that "(all files)" is removed sooner than it might be selected (and thus
put to the selection clipboard).

Modified file:
    utilities/src/org/netbeans/modules/search/BasicSearchForm.java   (1.16)

Diff:
http://deadlock.netbeans.org/fisheye/browse/netbeans/utilities/src/org/netbeans/modules/search/BasicSearchForm.java?r1=1.15&r2=1.16