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 215743

Summary: Allow Drag & Drop for modal Dialogs
Product: platform Reporter: maxnitribitt <maxnitribitt>
Component: ExplorerAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: anebuzelsky, geertjan, saubrecht
Priority: P3 Keywords: PLAN
Version: 7.1.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description maxnitribitt 2012-07-20 05:23:24 UTC
Perceived Behaviour:

DnD of nodes doesn't work in modal dialogs. I've got a panel with a BeanTreeView and DnD enabled Nodes. DnD works when I put it in a TopComponent or a non-modal dialog. It silently fails when in a modal dialog.

Expected behaviour:

DnD should work in modal dialogs.

Workaround:

None

Usecase: 

My usecase is a custom PropertyEditor which uses an explorerview and node reordering for setting the property.

Bug Analyis:

DnD in modal Dialogs was removed in 2002:
http://netbeans.org/bugzilla/show_bug.cgi?id=22618

The reason was a bug in  JDK 1.4.0:

"DnD in modal dialogs freezes the JVM in
JDK 1.4.0.  We detect the situation, log it and don't allow DnD.  This
is a bug in JDK which has been fixed for 1.4.1."
http://netbeans.org/bugzilla/show_bug.cgi?id=25848

Since the bug has been fixed and NB requires at least JDK 1.6, could you replace these lines from ExplorerDragSupport, which prevent using DnD in modal dialogs:

Dialog d = (Dialog) SwingUtilities.getAncestorOfClass(Dialog.class, comp);

            if ((d != null) && d.isModal()) {
                exDnD.setDnDActive(false);

                return;
            } else {
                exDnD.setDnDActive(true);
                dge.startDrag(null, transferable, this);
            }

with something like:
exDnD.setDnDActive(true);
dge.startDrag(null, transferable, this);
Comment 1 Stanislav Aubrecht 2012-07-23 12:22:15 UTC
core-main f72a1fe1bd6d
Comment 2 Quality Engineering 2012-07-24 16:34:33 UTC
Integrated into 'main-golden', will be available in build *201207241500* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f72a1fe1bd6d
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #215743 - Allow Drag & Drop for modal Dialogs