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

Print this page




 373 - (void)safeReleaseDraggingData:(NSNumber *)arg
 374 {
 375     jlong draggingSequenceNumber = [arg longLongValue];
 376 
 377     // Make sure dragging data is released only if no new drag is under way. If a new drag
 378     // has been initiated it has released the old dragging data already. This has to be called
 379     // on the native event thread - otherwise we'd need to start synchronizing.
 380     if (draggingSequenceNumber == sDraggingSequenceNumber)
 381         [self releaseDraggingData];
 382 }
 383 
 384 - (void)javaDraggingEnded:(jlong)draggingSequenceNumber success:(BOOL)jsuccess action:(jint)jdropaction
 385 {
 386     NSNumber *draggingSequenceNumberID = [NSNumber numberWithLongLong:draggingSequenceNumber];
 387         // Report back actual Swing success, not what AppKit thinks
 388         sDraggingError = !jsuccess;
 389         sDragOperation = [DnDUtilities mapJavaDragOperationToNS:jdropaction];
 390 
 391     // Release dragging data if any when Java's AWT event thread is all finished.
 392     // Make sure dragging data is released on the native event thread.
 393     [ThreadUtilities performOnMainThread:@selector(safeReleaseDraggingData:) onObject:self
 394                               withObject:draggingSequenceNumberID waitUntilDone:NO awtMode:NO];
 395 }
 396 
 397 - (jint)currentJavaActions {
 398     return [DnDUtilities mapNSDragOperationToJava:sUpdateOperation];
 399 }
 400 
 401 /********************************  BEGIN NSDraggingDestination Interface  ********************************/
 402 
 403 
 404 // Private API to calculate the current Java actions
 405 - (void) calculateCurrentSourceActions:(jint *)actions dropAction:(jint *)dropAction
 406 {
 407     // Get the raw (unmodified by keys) source actions
 408     id jrsDrag = objc_lookUpClass("JRSDrag");
 409     if (jrsDrag != nil) {
 410         NSDragOperation rawDragActions = (NSDragOperation) [jrsDrag performSelector:@selector(currentAllowableActions)];
 411         if (rawDragActions != NSDragOperationNone) {
 412             // Both actions and dropAction default to the rawActions
 413             *actions = [DnDUtilities mapNSDragOperationMaskToJava:rawDragActions];
 414             *dropAction = *actions;




 373 - (void)safeReleaseDraggingData:(NSNumber *)arg
 374 {
 375     jlong draggingSequenceNumber = [arg longLongValue];
 376 
 377     // Make sure dragging data is released only if no new drag is under way. If a new drag
 378     // has been initiated it has released the old dragging data already. This has to be called
 379     // on the native event thread - otherwise we'd need to start synchronizing.
 380     if (draggingSequenceNumber == sDraggingSequenceNumber)
 381         [self releaseDraggingData];
 382 }
 383 
 384 - (void)javaDraggingEnded:(jlong)draggingSequenceNumber success:(BOOL)jsuccess action:(jint)jdropaction
 385 {
 386     NSNumber *draggingSequenceNumberID = [NSNumber numberWithLongLong:draggingSequenceNumber];
 387         // Report back actual Swing success, not what AppKit thinks
 388         sDraggingError = !jsuccess;
 389         sDragOperation = [DnDUtilities mapJavaDragOperationToNS:jdropaction];
 390 
 391     // Release dragging data if any when Java's AWT event thread is all finished.
 392     // Make sure dragging data is released on the native event thread.
 393     [ThreadUtilities performOnMainThread:@selector(safeReleaseDraggingData:) on:self withObject:draggingSequenceNumberID waitUntilDone:NO];

 394 }
 395 
 396 - (jint)currentJavaActions {
 397     return [DnDUtilities mapNSDragOperationToJava:sUpdateOperation];
 398 }
 399 
 400 /********************************  BEGIN NSDraggingDestination Interface  ********************************/
 401 
 402 
 403 // Private API to calculate the current Java actions
 404 - (void) calculateCurrentSourceActions:(jint *)actions dropAction:(jint *)dropAction
 405 {
 406     // Get the raw (unmodified by keys) source actions
 407     id jrsDrag = objc_lookUpClass("JRSDrag");
 408     if (jrsDrag != nil) {
 409         NSDragOperation rawDragActions = (NSDragOperation) [jrsDrag performSelector:@selector(currentAllowableActions)];
 410         if (rawDragActions != NSDragOperationNone) {
 411             // Both actions and dropAction default to the rawActions
 412             *actions = [DnDUtilities mapNSDragOperationMaskToJava:rawDragActions];
 413             *dropAction = *actions;