Java Code Examples for sun.awt.AWTAccessor#getDropTargetContextAccessor()

The following examples show how to use sun.awt.AWTAccessor#getDropTargetContextAccessor() . 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 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 2
Source File: SunDropTargetContextPeer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (dt == null) {
        currentDT = null;
        currentT  = null;

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

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

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

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        acc.reset(currentDTC);
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
 
Example 3
Source File: SunDropTargetContextPeer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

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

            currentDT  = dt;
            currentDTC = null;
        }

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

            currentDTC = dtc;
            acc.setDropTargetContextPeer(currentDTC, this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
 
Example 4
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 5
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 6
Source File: SunDropTargetContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (dt == null) {
        currentDT = null;
        currentT  = null;

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

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

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

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        acc.reset(currentDTC);
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
 
Example 7
Source File: SunDropTargetContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

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

            currentDT  = dt;
            currentDTC = null;
        }

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

            currentDTC = dtc;
            acc.setDropTargetContextPeer(currentDTC, this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
 
Example 8
Source File: SunDropTargetContextPeer.java    From openjdk-jdk9 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;
        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();
    }
}