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.
IZ 108834 described how the editor would aggressively grab focus when Line.SHOW_SHOW was used by sunstudios dbx gui. It seems that a variation of this problem is back in the 6.x codebase. Line.SHOW_SHOW, if it opens a new edito tab will cause focus to get grabbed away. I've submitted a standalone reproducible testcase project as part of IZ 132671. Please familiarize yourself with it first and then consider the following commands: Issue "edit A". The editor will open file A. Issue "line 10" and see the editor line hilite move to line 10. Issue "edit B". Observe how the focus moves away from ReadEvalPrint. Issue "edit A" again. Now the focus doesn't move away. Ergo it's only the opning of new files which causes focus to shift.
it seems that there were no changes in the EditorSupportLineSet.java from the fix for the issue 108834 that you verified... http://hg.netbeans.org/main/log/tip/openide.text/src/org/openide/text/EditorSupportLineSet.java
This new behaviour does not have to have anything to do with EditorSupportLineSet.java. SHOW_SHOW of a previously unopened file would not steal focus in 5.x. It does so in 6.x. The first attachment in IZ 132671 was empty. I've added a filled one.
Problem is in window system. CloneableEditor calls TopComponent.requestVisible. It should not focus newly selected TC if given mode is not active but winsys activates mode and focuses newly selected TC.
Correction: This was introduced by Jarda as http://hg.netbeans.org/main/rev/237f35dacb17. There is no explanation for this ie. why it was done. Generally it is wrong. Opening TC should not focus it. If there is need to focus it TopComponent.requestActive() should be called. Normal usage is: TopComponent tc = ... tc.open() tc.requestActive() Jarda please could you explain why you added call of requestFocusInWindow() into CloneableEditor? In addition requestFocusInWindow should be only overriden but not called. requestActive should be used instead. It is to set all winsys internals (like active mode) correctly. Fixed as 7489fd8218d8.
Integrated into 'main-golden', available in NB_Trunk_Production #268 build Changeset: http://hg.netbeans.org/main/rev/7489fd8218d8 User: Marek Slama <mslama@netbeans.org> Log: #134910: Fix grabbing focus by editor when new CloneableEditor is opened.
I think the fix is bad. In 080620, when I create a new Java class, the caret is not visible. Irritating regression.
Fixed 4c3a265cbc40. Problem is that in some cases TC.requestFocus is called BEFORE CloneableEditor.DoInitialize.initVisual so editor pane is added later. So current fix transfers focus to added subcomponent ONLY when editor is already activated ie. compare editor (CloneableEditor.this) and getRegistry().getActivated(). If they are equals call requestFocusInWindow(). I tested test module from issue #132671 and it works as expected ie. focus is not changed.
Fixed in release65_m1 39fb9c7844b1
Integrated into 'main-golden', available in NB_Trunk_Production #285 build Changeset: http://hg.netbeans.org/main/rev/4c3a265cbc40 User: Marek Slama <mslama@netbeans.org> Log: #134910: Transfer focus to added subcomponent when TC is already activated only.
Please note that NetBeans 6.1 Patch3 cut-off is going to happen on close of business August 5th. If you would like to have bugfix for this issue as part of NetBeans 6.1 Patch3, then this issue must have information about bugfix' trunk changeset and it's status must be "VERIFIED".
Marian added 61fixes2 to issue. Marian/Ivan shall we put this fix to patch3?
ivan, can you mark as verified if it works for you?
verified in trunk.
I've ported those two changesets http://hg.netbeans.org/main/rev/7489fd8218d8 and http://hg.netbeans.org/main/rev/4c3a265cbc40 into release61_fixes repository as http://hg.netbeans.org/release61_fixes/rev/345f57e4a0aa
Yes it is correct. I checked diff http://hg.netbeans.org/release61_fixes/rev/345f57e4a0aa
delivered to SS