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 182124 - IDE forcefully gains primary focus each time project is opened
Summary: IDE forcefully gains primary focus each time project is opened
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P4 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2010-03-16 14:47 UTC by Jaroslav Pospisil
Modified: 2016-07-07 08:39 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE indicates that it is ready to work with (that an app has been opened) (15.58 KB, image/png)
2010-03-23 15:20 UTC, Ondrej Langr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Pospisil 2010-03-16 14:47:31 UTC
Each time IDE opens or creates some project,it gains primary focus and sends any other opened applications to background.This means,for example,that if I'm creating some project,which needs some components to install or activate (e.g. maven web app), which takes quite enough time and I'll try to write mail meantime,I'm interrupted in the middle of writing by IDE gaining focus and switched into IDE. This behaviour is very annoying and it's new in 6.9,since I don't remember anything like this from the past.
Comment 1 Jesse Glick 2010-03-16 18:43:52 UTC
I believe this is intentional, and nothing new; when a new project is created, the Projects tab is focused. Can be disabled with -J-Dproject.tab.no.selection=false.
Comment 2 Jaroslav Pospisil 2010-03-17 09:48:46 UTC
If it's intentional,it never worked before 6.9,at least on my Vista as I remember. I think we should ask ourselves, if our goal is to annoy the users or not, since this is very annoying feature and if it's really so important for us to have it that way. From what I heard about Facebook chat for example,which is behaving similar way - user response was pretty negative. I would consider at least not have this as default behaviour and let the users to set it individually, if they thinks it's neccessary for them.
Thanks for workaround,it will help me from serious headaches,when multitasking with IDE running ;-)
Comment 3 Jesse Glick 2010-03-17 15:14:10 UTC
As far as I know the code has always worked this way; for example, when a new project is created, the IDE (1) selects its root node, (2) expands that root node, (3) gives focus to the Projects tab to ensure that this is visible, using requestActive(). I do not know of any change in 6.9 in this area, and recall the behavior in previous releases being identical, but of course there might have been changes somewhere else which affected the outcome in some cases.

It is probably platform-specific whether the IDE's main window is fronted in the native window manager as a result of sending focus to the Projects tab (Dafe and others might know in more detail). I tried requestAttention(true) but this did not make the Projects tab visible and it looked odd; Ondrej could play with different behaviors on different platforms to see what feels best.

Note that some platforms provide a way for an application to indicate that something is ready or finished without actually fronting the window. For example, on Gnome when an application has taken some time to launch and you are working on something else, its window will be placed in the background but the task bar icon will flash until you front it. Unfortunately I do not think these native facilities are available from a Java application, unless perhaps you use JNA with something like (just guessing here):

http://library.gnome.org/devel/wm-spec/#id2511989
Comment 4 Ondrej Langr 2010-03-23 15:20:07 UTC
Mac OS X:    IDE does not gain focus when a project is opened, no indication that the IDE is now ready to work with. 

Windows XP:  IDE in my case does not gain primary focus either, but indicates the app is ready (see attachment). Not sure where the "problem" is. 

The solution which feels right and is IMO correct from users' perspective is how my Windows XP behaves: the IDE indicates that an app has been opened if OS means allow (i.e. flashing the application on start menu bar) but does not "steal" primary focus.
Comment 5 Ondrej Langr 2010-03-23 15:20:45 UTC
Created attachment 95610 [details]
IDE indicates that it is ready to work with (that an app has been opened)
Comment 6 Jaroslav Pospisil 2010-03-23 15:59:02 UTC
So this seems to be restricted for Vista environment only.
Comment 7 Jesse Glick 2010-03-23 16:52:09 UTC
Dafe probably knows better than I how to make the desired behavior happen.
Comment 8 Jesse Glick 2010-04-05 14:25:21 UTC
See also bug #76970 comment #35 for behavior of NB startup.
Comment 9 Martin Balin 2016-07-07 08:39:40 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss