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

Print this page




 651     {
 652         NSData *rtfdData = [pboard dataForType:NSRTFDPboardType];
 653         NSAttributedString *styledText = [[NSAttributedString alloc] initWithRTFD:rtfdData documentAttributes:nil];
 654         NSString *text = [styledText string];
 655         [styledText release];
 656 
 657         return [self replaceAccessibleTextSelection:text];
 658     }
 659 
 660     return NO;
 661 }
 662 
 663 
 664 -(void) setDragSource:(CDragSource *)source {
 665     self._dragSource = source;
 666 }
 667 
 668 
 669 - (void) setDropTarget:(CDropTarget *)target {
 670     self._dropTarget = target;
 671     [ThreadUtilities performOnMainThread:@selector(controlModelControlValid) onObject:self._dropTarget withObject:nil waitUntilDone:YES awtMode:YES];
 672 }
 673 
 674 /********************************  BEGIN NSDraggingSource Interface  ********************************/
 675 
 676 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag
 677 {
 678     // If draggingSource is nil route the message to the superclass (if responding to the selector):
 679     CDragSource *dragSource = self._dragSource;
 680     NSDragOperation dragOp = NSDragOperationNone;
 681 
 682     if (dragSource != nil)
 683         dragOp = [dragSource draggingSourceOperationMaskForLocal:flag];
 684     else if ([super respondsToSelector:@selector(draggingSourceOperationMaskForLocal:)])
 685         dragOp = [super draggingSourceOperationMaskForLocal:flag];
 686 
 687     return dragOp;
 688 }
 689 
 690 - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
 691 {


1198     JNIEnv *env = [ThreadUtilities getJNIEnv];
1199 
1200     // Get rid of the old one
1201     if (fInputMethodLOCKABLE) {
1202         JNFDeleteGlobalRef(env, fInputMethodLOCKABLE);
1203     }
1204 
1205     // Save a global ref to the new input method.
1206     if (inputMethod != NULL)
1207         fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
1208     else
1209         fInputMethodLOCKABLE = NULL;
1210 }
1211 
1212 - (void)abandonInput
1213 {
1214 #ifdef IM_DEBUG
1215     fprintf(stderr, "AWTView InputMethod Selector Called : [abandonInput]\n");
1216 #endif // IM_DEBUG
1217 
1218     [ThreadUtilities performOnMainThread:@selector(markedTextAbandoned:) onObject:[NSInputManager currentInputManager] withObject:self waitUntilDone:YES awtMode:YES];
1219     [self unmarkText];
1220 }
1221 
1222 /********************************   END NSTextInputClient Protocol   ********************************/
1223 
1224 
1225 
1226 
1227 @end // AWTView
1228 
1229 /*
1230  * Class:     sun_lwawt_macosx_CPlatformView
1231  * Method:    nativeCreateView
1232  * Signature: (IIII)J
1233  */
1234 JNIEXPORT jlong JNICALL
1235 Java_sun_lwawt_macosx_CPlatformView_nativeCreateView
1236 (JNIEnv *env, jobject obj, jint originX, jint originY, jint width, jint height, jlong windowLayerPtr)
1237 {
1238     __block AWTView *newView = nil;




 651     {
 652         NSData *rtfdData = [pboard dataForType:NSRTFDPboardType];
 653         NSAttributedString *styledText = [[NSAttributedString alloc] initWithRTFD:rtfdData documentAttributes:nil];
 654         NSString *text = [styledText string];
 655         [styledText release];
 656 
 657         return [self replaceAccessibleTextSelection:text];
 658     }
 659 
 660     return NO;
 661 }
 662 
 663 
 664 -(void) setDragSource:(CDragSource *)source {
 665     self._dragSource = source;
 666 }
 667 
 668 
 669 - (void) setDropTarget:(CDropTarget *)target {
 670     self._dropTarget = target;
 671     [ThreadUtilities performOnMainThread:@selector(controlModelControlValid) on:self._dropTarget withObject:nil waitUntilDone:YES];
 672 }
 673 
 674 /********************************  BEGIN NSDraggingSource Interface  ********************************/
 675 
 676 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag
 677 {
 678     // If draggingSource is nil route the message to the superclass (if responding to the selector):
 679     CDragSource *dragSource = self._dragSource;
 680     NSDragOperation dragOp = NSDragOperationNone;
 681 
 682     if (dragSource != nil)
 683         dragOp = [dragSource draggingSourceOperationMaskForLocal:flag];
 684     else if ([super respondsToSelector:@selector(draggingSourceOperationMaskForLocal:)])
 685         dragOp = [super draggingSourceOperationMaskForLocal:flag];
 686 
 687     return dragOp;
 688 }
 689 
 690 - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
 691 {


1198     JNIEnv *env = [ThreadUtilities getJNIEnv];
1199 
1200     // Get rid of the old one
1201     if (fInputMethodLOCKABLE) {
1202         JNFDeleteGlobalRef(env, fInputMethodLOCKABLE);
1203     }
1204 
1205     // Save a global ref to the new input method.
1206     if (inputMethod != NULL)
1207         fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
1208     else
1209         fInputMethodLOCKABLE = NULL;
1210 }
1211 
1212 - (void)abandonInput
1213 {
1214 #ifdef IM_DEBUG
1215     fprintf(stderr, "AWTView InputMethod Selector Called : [abandonInput]\n");
1216 #endif // IM_DEBUG
1217 
1218     [ThreadUtilities performOnMainThread:@selector(markedTextAbandoned:) on:[NSInputManager currentInputManager] withObject:self waitUntilDone:YES];
1219     [self unmarkText];
1220 }
1221 
1222 /********************************   END NSTextInputClient Protocol   ********************************/
1223 
1224 
1225 
1226 
1227 @end // AWTView
1228 
1229 /*
1230  * Class:     sun_lwawt_macosx_CPlatformView
1231  * Method:    nativeCreateView
1232  * Signature: (IIII)J
1233  */
1234 JNIEXPORT jlong JNICALL
1235 Java_sun_lwawt_macosx_CPlatformView_nativeCreateView
1236 (JNIEnv *env, jobject obj, jint originX, jint originY, jint width, jint height, jlong windowLayerPtr)
1237 {
1238     __block AWTView *newView = nil;