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

Print this page




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


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




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


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