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 30520 - Wrong top component selected after switching workapces / opening file
Summary: Wrong top component selected after switching workapces / opening file
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: mslama
URL:
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2003-01-30 15:24 UTC by Marian Mirilovic
Modified: 2008-12-23 09:16 UTC (History)
3 users (show)

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 Marian Mirilovic 2003-01-30 15:24:27 UTC
[nb_dev](20030130), [jdk1.4.2](b15)

Steps to reproduce:
- run IDE in SDI mode
- switch to Debugging Workspace 
-> Debugger window is opened and has Debugger view
selected
- switch to Editing
- restart IDE
- switch to Debugging workspace
-> title of Debugger Window is "Debugger [?]" -
issue 30509, but Project tab is selected (no
Debugger View)

It worked fine in [nb_dev](20030129) - sooner, but
not now in [nb_dev](20030130)
Comment 1 mslama 2003-02-13 12:18:31 UTC
It seems it is caused by fix of issue #27789.
Comment 2 mslama 2003-02-14 14:15:09 UTC
I tried to fix but it is almost impossible to fix it generaly. When I
fix one case by delaying TopComponent activation it fails in other
case because it is done too late. :( The main reason is how MDI
desktop modes is currently build. Every TopComponent is added to
already live environment - it causes call of requestFocus() and
setSelectedTopComponent(). It is too complicated to trace and to even
understand what is going on inside. We spent already too much time to
fix such issue. Constructing desktop requires complete redesign. First
frame should be created, TopComponents added to it (without
activating, listening on JTabbedPane, ....) and possibly select
desired components/tabs and THEN added to desktop instead of adding
TopComponent one by one to live frame. I leave this issue opened.
Comment 3 Marian Mirilovic 2003-02-18 12:25:58 UTC
The same behaviour after opening form file (for example).
Comment 4 Marian Mirilovic 2003-02-18 12:27:19 UTC
*** Issue 30779 has been marked as a duplicate of this issue. ***
Comment 5 Marian Mirilovic 2003-02-18 12:29:01 UTC
IMHO: it's 100 % reproducible by qa-functional tests.
Comment 6 mslama 2003-02-19 10:40:12 UTC
JDK 1.4.1_01:

Problem is in current winsys design: When workspace is opened for the
first time TopComponent are loaded and added to modes one by one using
Mode.dockInto() and TopComponent.open(). It causes call of
requestFocus() on EVERY TopComponent added to workspace. Unfortunately
not all requests are granted by AWT. requestFocus() on Runtime tab is
(sometimes) converted to FOCUS_GAINED event with main window as
source. This event is processed later and changed to new FOCUS_GAINED
event with Runtime tab as source when Filesystems tab is already
correctly selected. This event causes activation Runtime tab in
Explorer. One possible fix (workaround) is to avoid all calls of
requestFocus() during workspace switching. The best solution would be
to redesign way how new workspace is loaded but it is not that simple.

Fix: Do not call TopComponent.requestFocus() during workspace
switching. Keep last activated TopComponent and activate it after
workspace switching is finished.
Comment 7 mslama 2003-02-19 11:41:56 UTC
Fixed in main trunk.

Modified:
core/src/org/netbeans/core/windows/WorkspaceImpl.java r.1.115
core/src/org/netbeans/core/windows/WorkspaceVisibilityManager.java r.1.28
core/src/org/netbeans/core/windows/frames/DefaultContainerImpl.java r.1.73
Comment 8 Marian Mirilovic 2003-02-20 09:17:02 UTC
Marek:

After switching workspaces in one run IDE it works fine , right top
components are selected, but if you try next steps , it doesn't work
in [nb_dev](20030220) :

- run IDE
- switch to SDI
- switch to GUI Editing -> Filesystems selected in Explorer - fine
- switch to Debugging -> Debugger selected in Debugger window - fine
- switch back to Editing
- restart IDE
- switch to GUI Editing -> Runtime selected in Explorer !
- switch to Debugging -> Project selected in Debugger window !

reopen or file new one ?
Comment 9 Marian Mirilovic 2003-02-20 09:28:27 UTC
Ok, I have filed another issue 31246.

verified in [nb_dev](20030220)