src/macosx/native/sun/awt/CDropTarget.m

Print this page




 631     DLog2(@"[CDropTarget prepareForDragOperation]: returning %@\n", (sDraggingError ? @"NO" : @"YES"));
 632 
 633     return sDraggingError ? NO : YES;
 634 }
 635 
 636 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
 637 {
 638     DLog2(@"[CDropTarget performDragOperation]: %@\n", self);
 639 
 640     sCurrentDropTarget = nil;
 641 
 642     JNIEnv* env = [ThreadUtilities getJNIEnv];
 643 
 644     // Now copy dragging data:
 645     if (sDraggingError == FALSE && [self copyDraggingData:sender] == FALSE)
 646         sDraggingError = TRUE;
 647 
 648     if (sDraggingError == FALSE) {
 649         sDraggingLocation = [sender draggingLocation];
 650         NSPoint javaLocation = [fView convertPoint:sDraggingLocation fromView:nil];




 651 
 652         jint actions = [DnDUtilities mapNSDragOperationMaskToJava:[sender draggingSourceOperationMask]];
 653         jint dropAction = sJavaDropOperation;
 654 
 655         jlongArray formats = sDraggingFormats;
 656 
 657         JNF_MEMBER_CACHE(handleDropMessageMethod, jc_CDropTargetContextPeer, "handleDropMessage", "(Ljava/awt/Component;IIII[JJ)V");
 658 
 659         if (sDraggingError == FALSE) {
 660             JNFCallVoidMethod(env, fDropTargetContextPeer, handleDropMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (event)
 661         }
 662 
 663         if (sDraggingError == FALSE) {
 664             JNF_MEMBER_CACHE(flushEventsMethod, jc_CDropTargetContextPeer, "flushEvents", "(Ljava/awt/Component;)V");
 665             if (sDraggingError == FALSE) {
 666                 JNFCallVoidMethod(env, fDropTargetContextPeer, flushEventsMethod, fComponent); // AWT_THREADING Safe (AWTRunLoopMode)
 667             }
 668         }
 669     } else {
 670         // 8-19-03 Note: [Radar 3368754]




 631     DLog2(@"[CDropTarget prepareForDragOperation]: returning %@\n", (sDraggingError ? @"NO" : @"YES"));
 632 
 633     return sDraggingError ? NO : YES;
 634 }
 635 
 636 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
 637 {
 638     DLog2(@"[CDropTarget performDragOperation]: %@\n", self);
 639 
 640     sCurrentDropTarget = nil;
 641 
 642     JNIEnv* env = [ThreadUtilities getJNIEnv];
 643 
 644     // Now copy dragging data:
 645     if (sDraggingError == FALSE && [self copyDraggingData:sender] == FALSE)
 646         sDraggingError = TRUE;
 647 
 648     if (sDraggingError == FALSE) {
 649         sDraggingLocation = [sender draggingLocation];
 650         NSPoint javaLocation = [fView convertPoint:sDraggingLocation fromView:nil];
 651         // The y coordinate that comes in the NSDraggingInfo seems to be reversed - probably
 652         // has to do something with the type of view it comes to.
 653         // This is the earliest place where we can correct it.
 654         javaLocation.y = fView.window.frame.size.height - javaLocation.y;
 655 
 656         jint actions = [DnDUtilities mapNSDragOperationMaskToJava:[sender draggingSourceOperationMask]];
 657         jint dropAction = sJavaDropOperation;
 658 
 659         jlongArray formats = sDraggingFormats;
 660 
 661         JNF_MEMBER_CACHE(handleDropMessageMethod, jc_CDropTargetContextPeer, "handleDropMessage", "(Ljava/awt/Component;IIII[JJ)V");
 662 
 663         if (sDraggingError == FALSE) {
 664             JNFCallVoidMethod(env, fDropTargetContextPeer, handleDropMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (event)
 665         }
 666 
 667         if (sDraggingError == FALSE) {
 668             JNF_MEMBER_CACHE(flushEventsMethod, jc_CDropTargetContextPeer, "flushEvents", "(Ljava/awt/Component;)V");
 669             if (sDraggingError == FALSE) {
 670                 JNFCallVoidMethod(env, fDropTargetContextPeer, flushEventsMethod, fComponent); // AWT_THREADING Safe (AWTRunLoopMode)
 671             }
 672         }
 673     } else {
 674         // 8-19-03 Note: [Radar 3368754]