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.
There is strange TopComponent activation: 1.Add to bottom of Explorer some focusable TopComponent. 2.Filesystem tab should be selected at center area (ExplorerPanel). 3.Open anything in Source Editor. 4.Select your TopComponent at bottom of Explorer 5.Select TopComponent in Source Editor by mouse click. 6.Click on test TopComponent at bottom of Explorer. 7.Sometimes first Filesystem is activated (receives focus) first and then test TopComponent is activated. You can see it at frame title it shortly displays "Explorer [Filesystems]".
Some additinal info is in a thread with this message: http://www.netbeans.org/servlets/ReadMsg?msgId=460183&listNa me=nbdev I (original reporter :-) have the issue on win XP, so changing OS from Linux to All Andrew
Here's the bug from a user's perspective: 1) open netbeans, close all editor windows, leave only the explorer and the output window open 2) Activate an explorer tab, lets say "Filesystems" 3) Click in the output window 4) Now click on then "Runtime" tab from the explorer window. You can see that it's activated for a very short time, than the "Filesystems" tab is activated again. I have to click again on the "Runtime" tab to activate it. Very annoying. That's why I'm increasing priority :)
I removed call of requestDefaultFocus() from ExplorerPanel.requestFocus(). Subclasses of ExplorerPanel should overwrite requestFocus() and set focus to desired subcomponent after super.requestFocus() is called. Also NbMainExplorer$ExplorerTab now overwrites TopComponent.requestFocus() instead of overwriting it in ExplorerPanel. (Issue #29848.) Modified: openide/src/org/openide/explorer/ExplorerPanel.java r.1.40
Marek, unfortunately, can not verify the fix. Try this sequence: Filesystems - Editor - TC under testing This listener's code (without any extra code in the listener) TopComponent tc = TopComponent.getRegistry().getActivated(); if(tc == null) return; if(tc.equals(this)) { System.err.println("Self-selected"); return; } System.err.println(tc.getName()); gives this output after clicking on TC under testing: ... Filesystems Self-selected Filesystems Self-selected ... You see, there are four(!) activations now.
I had your component at bottom of Explorer, some text in Source Editor. Now I click on your component and component in source editor. I have log in RegistryImpl.topComponentActivated(). Before there was call with Filesystems. But not now. Only your top component is activated. Can you verify this? Or could you send me your module with log? And possibly one call stack Thread.dumpStack(). I will check your sequence. Thanks. BTW what JDK do you use? I have JDK 1.4.1_01. There is diff between JDK 1.3 and 1.4 in focus area.
I forgot I was clicking alternatively on your TC and source editor more than once. Click and see what events are comming (activation and focus events).
One more note you should add requestFocus() { super.requestFocus(); beanTreeView.requestFocus(); } to your top component. It will make sure that focus is set correctly.
Marek, Yes, seq. TC-Editor-TC-Editor-... works now without any problems. Try FS-Editor-TC-FS-Editor-TC-... here 4 events take place after clicking on TC. _All_ code of the listener was included in my prev. commit. For testing purpose all other code was commented.
Yes, I have tried with requestFocus() with the same result.
Well, env. was reported in our mail thread: win XP, j2se 1.4.1_01 I have tried to switch to "All" OS instead of "Linux", but you have switched back to "Linux" :-)
Created attachment 8837 [details] shortest testcase for internal execution
Marek, I have created very short and clear testcase (I think :-). It is main() for internal execution. Hope, will help. Andrew
Yes you are right. Problem is caused by changes in DefaultContainerImpl made by Peter (new actions implementation). We also activate TopComponent when frame is activated - in this case originally selected component is activated first and then we process FOCUS_GAINED for your component which is selected then. Before there was delayed activation ie. when more activation requests was required only last one was performed. Now it doe snot work this way. I think that functionality should be returned back. Peter what do you think? Other solution (not activate top component when only frame is selected eg when you just click on frame title bar is not possible - it would change behaviour) is not possible.
I created patch: Activation of TopComponent comming from frameActivated() is delayed to make sure that proper TopComponent is set before. Please check that. I observed one strange thing: When I start IDE. Source Editor selected and then click on Filesystem on some class node you component is updated and takes focus from Filesystems. Is it correct behaviour? I will attach patch. Put it to lib/patches and test it please.
Created attachment 8844 [details] Patch
Marek, It is difficult to test because of periodic frequent exception: java.lang.NullPointerException at org.netbeans.core.windows.frames.DefaultContainerImpl.reactivateSelectedComponent(DefaultContainerImpl.java:1077) [catch] at org.netbeans.core.windows.frames.DefaultContainerImpl$2.run(DefaultContainerImpl.java:1135) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent(EventQueue.java:448) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136) at java.awt.EventDispatchThread.run(EventDispatchThread.java:99) Andrew
>>...then click on Filesystem on some class node >>you component is updated and takes focus from >> Filesystems. Is it correct behaviour? This is a goal - to show expanded java file tree when appropriate node (in explorer, search result, editor, ...) is activated. This TC is some (and first :-) kind of outline panel. The module try to wait java node parsing, creates FilterNode and expands it.
Marek, Patched path seems to work well, - at least, during few minutes clicking :-) Thanks! My suggestion is: I'll test overall the IDE behaviour during upcoming weekends.
I have no problem with your component updating but with stealing focus :). Ok good to hear I will test it too and probably on Monday commit fix to trunk.
Marek, During last weekends I have not noticed any side-effects of your patch. BTW, how does focus stealing become apparent?
Second part of fix. TopComponent activation is delayed when called from frameActivated(). I also tested that issue #29939 does not appear again. Modified: core/src/org/netbeans/core/windows/frames/DefaultContainerImpl.java r.1.71 Regarding focus stealing: Focus is moved to your TopComponent ie. focus is not in FS.
verified in [s1s5](030331)