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 242854 - When creating the Options dialog the parent is set to null. Instead the MainWindow should be set as parent.
Summary: When creating the Options dialog the parent is set to null. Instead the MainW...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-13 10:03 UTC by thomas_hopf
Modified: 2014-04-20 01:24 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
DialogDisplayer that sets the Main Window as parent (21.23 KB, text/plain)
2014-04-17 06:27 UTC, maxnitribitt
Details
DialogDisplayer that sets the Main Window as parent (21.27 KB, application/octet-stream)
2014-04-17 06:36 UTC, maxnitribitt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description thomas_hopf 2014-03-13 10:03:57 UTC
In the class DialogDisplayer the Options Dialog's dialog is created in the sub-class StandardDialog by the following statement:

super((Frame) null, title, modal);

This statement should be replaced by the following statement:

super(WindowManager.getDefault().getMainWindow(), title, modal);


The following problem exists when the parent of the Options Dialog is null:

If the Option Dialog is opened by a shortcut (e.g. Ctrl+O) while a specific TopComponent has the focus, then the Options Dialog creates a WindowListener which listens to the close operation of this specific TopComponent. This leads to the problem that when the specific TopComponent is closed then the Options Dialog is also closed automatically. This is not a nice behaviour!
Comment 1 Theofanis Oikonomou 2014-03-28 11:10:07 UTC
I am not sure this is an issue with options. OptionsDisplayerImpl is using DialogDisplayer.getDefault().createDialog() passing a DialogDescriptor. Re-assigning for evaluation. Thank you
Comment 2 Stanislav Aubrecht 2014-03-28 14:28:44 UTC
I'm not sure there's a safe and regression-less fix for this. Having a floated editor window as dialog parent ensures the dialog windows open at correct position above the focused editor window instead of being centered on the main window which is possibly on a different screen.
Comment 3 thomas_hopf 2014-03-28 15:43:58 UTC
If it is not possible to fix it in DialogDisplayer then it should be fixed in OptionsDisplayerImpl class.

There the following line should be replaced with a method which sets a parent:
        Dialog tmpDialog = DialogDisplayer.getDefault ().createDialog (descriptor);
Comment 4 maxnitribitt 2014-04-17 06:27:34 UTC
Created attachment 146796 [details]
DialogDisplayer that sets the Main Window as parent
Comment 5 maxnitribitt 2014-04-17 06:36:50 UTC
Created attachment 146797 [details]
DialogDisplayer that sets the Main Window as parent
Comment 6 maxnitribitt 2014-04-17 06:42:17 UTC
It can be worked around by modifying the DialogDisplayer like in the attached File, and registering the modified version as a replacement.

What do I need to do to legally use this code modified from the original NetBeans source code? Is it enough to publish my modification here as the source and declare that I donate it?

I think if we can clarify this, then Thomas would also be able to use this  as a simple solution.

Besides that, it would be nice if you could also provide a fix in NetBeans itself as well, since this is an ugly bug.
Comment 7 Stanislav Aubrecht 2014-04-18 16:09:36 UTC
Fixed in core-main ef69baa85669

The side-effect is that Options window will now always open centered on the main IDE window.
Comment 8 Quality Engineering 2014-04-20 01:24:13 UTC
Integrated into 'main-silver', will be available in build *201404200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ef69baa85669
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #242854 - allow to set a parent for dialog window