Java Code Examples for java.awt.dnd.DropTarget#getDefaultActions()

The following examples show how to use java.awt.dnd.DropTarget#getDefaultActions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SunDropTargetContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 2
Source File: SunDropTargetContextPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 3
Source File: SunDropTargetContextPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 4
Source File: SunDropTargetContextPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 5
Source File: SunDropTargetContextPeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 6
Source File: SunDropTargetContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 7
Source File: SunDropTargetContextPeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 8
Source File: SunDropTargetContextPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 9
Source File: SunDropTargetContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 10
Source File: SunDropTargetContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 11
Source File: SunDropTargetContextPeer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();
    if (currentDTC != null) { // some wreckage from last time
        acc.reset(currentDTC);
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 12
Source File: SunDropTargetContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 13
Source File: SunDropTargetContextPeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 14
Source File: SunDropTargetContextPeer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 15
Source File: SunDropTargetContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();
    if (currentDTC != null) { // some wreckage from last time
        acc.reset(currentDTC);
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example 16
Source File: SunDropTargetContextPeer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;
        DropTargetContextAccessor acc =
                AWTAccessor.getDropTargetContextAccessor();

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = dtc;
        acc.setDropTargetContextPeer(currentDTC, this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 17
Source File: SunDropTargetContextPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 18
Source File: SunDropTargetContextPeer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 19
Source File: SunDropTargetContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
Example 20
Source File: SunDropTargetContextPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}