34 import javax.swing.*; 35 36 37 final class CDropTargetContextPeer extends SunDropTargetContextPeer { 38 39 private long fNativeDropTransfer = 0; 40 private long fNativeDataAvailable = 0; 41 private Object fNativeData = null; 42 private DropTarget insideTarget = null; 43 44 Object awtLockAccess = new Object(); 45 46 static CDropTargetContextPeer getDropTargetContextPeer() { 47 return new CDropTargetContextPeer(); 48 } 49 50 private CDropTargetContextPeer() { 51 super(); 52 } 53 54 // We block, waiting for an empty event to get posted (CToolkit.invokeAndWait) 55 // This is so we finish dispatching DropTarget events before we dispatch the dragDropFinished event (which is a higher priority). 56 private void flushEvents(Component c) { 57 try { 58 LWCToolkit.invokeAndWait(new Runnable() { 59 public synchronized void run() { 60 } 61 }, c); 62 } 63 catch(Exception e) { 64 e.printStackTrace(); 65 } 66 } 67 68 protected Object getNativeData(long format) { 69 long nativeDropTarget = this.getNativeDragContext(); 70 71 synchronized (awtLockAccess) { 72 fNativeDataAvailable = 0; 73 74 if (fNativeDropTransfer == 0) { 75 fNativeDropTransfer = startTransfer(nativeDropTarget, format); 76 } else { 77 addTransfer(nativeDropTarget, fNativeDropTransfer, format); 78 } 79 80 while (format != fNativeDataAvailable) { 81 try { 82 awtLockAccess.wait(); 83 } catch (Throwable e) { 84 e.printStackTrace(); 85 } 86 } 87 } | 34 import javax.swing.*; 35 36 37 final class CDropTargetContextPeer extends SunDropTargetContextPeer { 38 39 private long fNativeDropTransfer = 0; 40 private long fNativeDataAvailable = 0; 41 private Object fNativeData = null; 42 private DropTarget insideTarget = null; 43 44 Object awtLockAccess = new Object(); 45 46 static CDropTargetContextPeer getDropTargetContextPeer() { 47 return new CDropTargetContextPeer(); 48 } 49 50 private CDropTargetContextPeer() { 51 super(); 52 } 53 54 protected Object getNativeData(long format) { 55 long nativeDropTarget = this.getNativeDragContext(); 56 57 synchronized (awtLockAccess) { 58 fNativeDataAvailable = 0; 59 60 if (fNativeDropTransfer == 0) { 61 fNativeDropTransfer = startTransfer(nativeDropTarget, format); 62 } else { 63 addTransfer(nativeDropTarget, fNativeDropTransfer, format); 64 } 65 66 while (format != fNativeDataAvailable) { 67 try { 68 awtLockAccess.wait(); 69 } catch (Throwable e) { 70 e.printStackTrace(); 71 } 72 } 73 } |