jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
changeset 7493 010ad57ed8d1
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
7492:494fbd1859a1 7493:010ad57ed8d1
    92     private boolean                   dragRejected = false;
    92     private boolean                   dragRejected = false;
    93 
    93 
    94     protected int                     dropStatus   = STATUS_NONE;
    94     protected int                     dropStatus   = STATUS_NONE;
    95     protected boolean                 dropComplete = false;
    95     protected boolean                 dropComplete = false;
    96 
    96 
       
    97     // The flag is used to monitor whether the drop action is
       
    98     // handled by a user. That allows to distinct during
       
    99     // which operation getTransferData() method is invoked.
       
   100     boolean                           dropInProcess = false;
       
   101 
    97     /*
   102     /*
    98      * global lock
   103      * global lock
    99      */
   104      */
   100 
   105 
   101     protected static final Object _globalLock = new Object();
   106     protected static final Object _globalLock = new Object();
   218         InvalidDnDOperationException
   223         InvalidDnDOperationException
   219     {
   224     {
   220 
   225 
   221         SecurityManager sm = System.getSecurityManager();
   226         SecurityManager sm = System.getSecurityManager();
   222         try {
   227         try {
   223             if (!dropComplete && sm != null) {
   228             if (!dropInProcess && sm != null) {
   224                 sm.checkSystemClipboardAccess();
   229                 sm.checkSystemClipboardAccess();
   225             }
   230             }
   226         } catch (Exception e) {
   231         } catch (Exception e) {
   227             Thread currentThread = Thread.currentThread();
   232             Thread currentThread = Thread.currentThread();
   228             currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
   233             currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
   523 
   528 
   524             synchronized(_globalLock) {
   529             synchronized(_globalLock) {
   525                 if ((local = getJVMLocalSourceTransferable()) != null)
   530                 if ((local = getJVMLocalSourceTransferable()) != null)
   526                     setCurrentJVMLocalSourceTransferable(null);
   531                     setCurrentJVMLocalSourceTransferable(null);
   527             }
   532             }
       
   533 
       
   534             dropInProcess = true;
   528 
   535 
   529             try {
   536             try {
   530                 ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
   537                 ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
   531                                                                       hots,
   538                                                                       hots,
   532                                                                       currentDA,
   539                                                                       currentDA,
   536                 if (dropStatus == STATUS_WAIT) {
   543                 if (dropStatus == STATUS_WAIT) {
   537                     rejectDrop();
   544                     rejectDrop();
   538                 } else if (dropComplete == false) {
   545                 } else if (dropComplete == false) {
   539                     dropComplete(false);
   546                     dropComplete(false);
   540                 }
   547                 }
       
   548                 dropInProcess = false;
   541             }
   549             }
   542         } else {
   550         } else {
   543             rejectDrop();
   551             rejectDrop();
   544         }
   552         }
   545     }
   553     }