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 24877 - Cannot use View sources in Auto comment tool
Summary: Cannot use View sources in Auto comment tool
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: mslama
URL:
Keywords:
: 24878 35922 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-06-17 14:16 UTC by Milan Kubec
Modified: 2008-12-23 09:14 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Diff of patch (1.42 KB, patch)
2003-06-09 16:00 UTC, mslama
Details | Diff
Binary patch (64.26 KB, application/octet-stream)
2003-06-09 16:01 UTC, mslama
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Kubec 2002-06-17 14:16:37 UTC
Since Auto Comment Tool window is now opened as
native window I cannot use View Source
functionality easily. When I click View Source
button ACT window is still in foreground usually
covering whole editor. I would need to minimize
ACT or close it to acctually view the source. I
expect to view source without any additional
action than clicking View Source button.
Comment 1 Milan Kubec 2002-06-17 14:25:34 UTC
*** Issue 24878 has been marked as a duplicate of this issue. ***
Comment 2 Milan Kubec 2002-06-17 15:14:12 UTC
This is general problem of UI, not javadoc itself. The same case is
e.g. Search results dialog.
Comment 3 Jesse Glick 2002-06-17 18:00:37 UTC
It works OK for me on Linux using MDI... just switch back to the main
window, e.g. Alt-TAB. Currently it seems I cannot get KB focus on the
main window with the ACT open as a separate window, but I have had
similar problems in general with the window system, and it may just be
a problem with interactions with my window manager. Could you explain
exactly what the problem for you is?

Perhaps the window system should front the main window if focus is
requested on a component inside the main window?
Comment 4 Milan Kubec 2002-06-18 07:33:18 UTC
My problem is exactly described in your last sentence. Usually ACT
covers my editor window, so when I hit View Source actually nothing
happens, of course that editor is scrolled to the correct line, but
nobody can see that and I would expect that if I hit View Source I
will view source and not search for editor window by Alt+TAB. It
applies for any other search, find of view dialogs.
Comment 5 Jesse Glick 2002-06-18 14:56:34 UTC
So it sounds to me like this may be a window system issue then.
Javadoc developers, what is actually called when View Source is
pressed? E.g. TopComponent.requestFocus()?
Comment 6 Tomas Hurka 2002-06-19 07:31:05 UTC
            OpenCookie oc = ((OpenCookie)srcElement.getCookie(
OpenCookie.class ));
            oc.open();
Comment 7 jrojcek 2002-06-28 15:27:10 UTC
The rule is:

If action is invoked from top component (e.g. "View Source" from Auto
Comment Tool) and the result of the action is displayed in different
view then such view should be brought to front. It means that if the
view that presents the result of the action is in Main Window (MDI)
then Main Window should be brought to front too (not just view inside
Main Window).

Is it possible to implement it in core or on module side? If it is, I
would like to test the patch before applying to check possible side
effects.

Marek, please evaluate.
Comment 8 jrojcek 2002-07-09 09:51:59 UTC
I am not sure who should fix this but it belongs to javadoc module. If
you think that ui evaluation is not correct reassign back, thank you.
Comment 9 Marek Grummich 2002-07-22 10:50:45 UTC
Set target milestone to TBD
Comment 10 Jaroslav Tulach 2002-07-26 07:58:38 UTC
This bug is reported in version <= 3.4dev and still not fixed. Due to that it
forbids the release candidate for 3.4 to be promoted. Are you aware of that and
are you intensively working on the fix? If not, you should consider some
corrective action.
Comment 11 Milan Kubec 2002-07-26 08:24:29 UTC
Decreasing priority since this is not stopper for release34. By higher
priority I wanted to point out that mixture of "native" top components
and internal frames do not cooperate very well, although it's more
general problem.
Comment 12 Svata Dedic 2003-02-28 14:15:48 UTC
I think it is a core issue: during the execution,
CloneableTopComponent.requestVisible() and requestFocus() are called
(in that order).
If some other method should be called to bring the TC to front please
reassign back with an advice.
Comment 13 Peter Zavadsky 2003-02-28 14:57:53 UTC
I would say that requestFocus for TopComponent shouldn't bring its
window to front. But it seems the javadoc in TopComponent claims that :-(.
Marek, do you know how it should work?
Comment 14 Peter Zavadsky 2003-02-28 15:32:22 UTC
Anyway, the possible advice could be, to add following snippet after
the requestFocus call:

Window w = SwingUtilities.getWindowAncestor(tc);
if(w != null) {
    w.toFront();
}

Probably it is necessary to schedule that snippet later into AWT in
case you aren't in AWT already (open isn't synchronous if you aren't
in AWT already).
Comment 15 mslama 2003-02-28 15:42:52 UTC
No. Forget about Peter's suggestion. I will check it. When you call
TopComponent.requestFocus() it call also JInternalFrame.setSelected()
and it shoudl front frame at least in MDI. I take this issue and
investigate it.

TopComponent.requestVisible() is meant if you want to front component
in JTabbedPane but NOT assign focus to it. => using both
requestFocus() and requestVisible() at the same time on the same
component is redundant.
Comment 16 mslama 2003-06-09 14:47:43 UTC
Again problem with transferring focus/fronting windows. It is never
ending story. UI has some view how it should work and OS Window
Managers has their own (and unfortunately there is more than one OS
WM) so it impossible to infy these views/expectations. The main
problem here is that there are mixed MDI desktop and separate native
windows (SDI part). 

Unfortunately JDK Component.requestFocus() does not guarantee focus
transfer when focus should be transferred between native windows.
Actualy it works (cross window focus transfer) on Window but not on X
Windows - Linux).

If desktop is pure SDI we use java.awt.Window.toFront() in
TopFrameTypeImpl to transfer focus between native SDI windows AND
front target windows.

Problem here is mixture of SDI window (ACT) and main MDI window. In
such case there is no call of toFront() (when focus should be
transferred from separate native window to main app window. It needs 
call of toFront() on main window as Peter suggested.
Comment 17 mslama 2003-06-09 16:00:16 UTC
Created attachment 10623 [details]
Diff of patch
Comment 18 mslama 2003-06-09 16:01:30 UTC
Created attachment 10624 [details]
Binary patch
Comment 19 mslama 2003-06-09 16:04:45 UTC
Patch is for dev build. Place it to
$NBDIR/modules/patches/org-netbeans-core-windows. Fix calls toFont()
on main window when focus is requested for Mode with internal or
desktop frame (ie.frame inside of main window) AND main window is NOT
focused.
Comment 20 mslama 2003-06-10 10:29:37 UTC
Fixed in main trunk as described above.

Modified:
core/windows/src/org/netbeans/core/windows/ModeImpl.java r.1.4
Comment 21 Milan Kubec 2003-06-11 16:11:37 UTC
Verified on Win XP. I will verify it also on X.
Comment 22 mslama 2003-09-15 13:04:12 UTC
*** Issue 35922 has been marked as a duplicate of this issue. ***
Comment 23 Marian Mirilovic 2004-03-01 08:55:00 UTC
issue doesn't apply to new window system - verified