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 28728

Summary: selecting different sources via tabs "loses" cursor in Editor
Product: platform Reporter: ssffleming <ssffleming>
Component: TextAssignee: mslama <mslama>
Status: VERIFIED FIXED    
Severity: blocker CC: athempel, dkonecny, mroskanin, pzavadsky
Priority: P2 Keywords: FOCUS
Version: 3.x   
Hardware: PC   
OS: Windows 3.1/NT   
Issue Type: DEFECT Exception Reporter:
Attachments: Focus is requested from BasicTabbedPaneUI
Suggested fix of CloneableEditor
Patch

Description ssffleming 2002-11-13 17:48:34 UTC
Testing using Dublin build 021111_1 of EE on NT, JDK 1.4

Steps to reproduce:
open several text files in the source editor
edit some text switching back and forth
cursor position is lost when select tab for source file using mouse button #1

Note: this does not happen in Explorer...cursor position in Filesystems or other tree
is preserved when select different tabs
Comment 1 Martin Roskanin 2002-12-10 14:44:52 UTC
reproduced.
Focus appears in the first button of the editor toolbar. 
I am not able to find out who change the focus from editor pane to the
button.
Adding keyword FOCUS
Comment 2 Martin Roskanin 2003-01-15 09:20:52 UTC
*** Issue 29607 has been marked as a duplicate of this issue. ***
Comment 3 Martin Roskanin 2003-01-16 15:40:37 UTC
*** Issue 29685 has been marked as a duplicate of this issue. ***
Comment 4 Martin Roskanin 2003-01-29 08:36:33 UTC
*** Issue 13355 has been marked as a duplicate of this issue. ***
Comment 5 Martin Roskanin 2003-02-10 12:03:29 UTC
Created attachment 8862 [details]
Focus is requested from BasicTabbedPaneUI
Comment 6 Martin Roskanin 2003-02-10 13:19:23 UTC
I am not sure whether the bug is in JDK or core/windowing system.
Reassigning to core for more investigation. 
Comment 7 mslama 2003-02-10 16:48:18 UTC
I think it is necessary to overwrite requestDefaultFocus() in
TopComponent: org.netbeans.modules.java.JavaEditor$JavaEditorComponent
 or in some superclass if it is enough to request default focus on
editor pane could be possible to overwrite it in some editor subclass
of TopComponent like CloneableEditor. I attach diff for
org.openide.text.CloneableEditor.
Comment 8 mslama 2003-02-10 16:50:16 UTC
Created attachment 8878 [details]
Suggested fix of CloneableEditor
Comment 9 mslama 2003-02-10 16:52:25 UTC
Created attachment 8879 [details]
Patch
Comment 10 mslama 2003-02-10 16:54:10 UTC
You can test patch, just put to lib/patches. It works fine for me.
Comment 11 Martin Roskanin 2003-02-10 17:09:23 UTC
Works for me too. Thanks Marek.
Tested on:
  Operating System      = Windows 2000 version 5.0 running on x86
  Java; VM; Vendor      = 1.4.1; Java HotSpot(TM) Client VM 1.4.1-b21;
Sun Microsystems Inc.
Comment 12 David Konecny 2003-02-11 09:07:06 UTC
I reviewed the patch and it seem to me OK.
Comment 13 mslama 2003-02-11 13:11:59 UTC
Fixed in CloneableEditor. Method requestDefaultFocus() is added to
assign focus to editor pane when requestDefaultFocus() is called for
TopComponent.

Modified:
openide/src/org/openide/text/CloneableEditor.java r.1.54
Comment 14 Marian Mirilovic 2004-03-05 22:32:37 UTC
verified in NB3.6 beta