/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "CClipboard.h"
#include "CDataTransferer.h"
#import <Cocoa/Cocoa.h>
#include "ThreadUtilities.h"
//
// CClipboardUpdate is used for mulitple calls to setData that happen before
// the model and AppKit can get back in sync.
//
@interface CClipboardUpdate : NSObject {
}
@end
{
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
//- (void)finalize { [super finalize]; }
return fData;
}
return fFormat;
}
@end
// Clipboard creation is synchronized at the Java level.
+ (CClipboard *) sharedClipboard
{
if (sClipboard == nil) {
[[NSNotificationCenter defaultCenter] addObserver:sClipboard selector: @selector(checkPasteboard:) name: NSApplicationDidBecomeActiveNotification object: nil];
}
return sClipboard;
}
{
}
return self;
}
- (void) javaDeclareTypes:(NSArray *)inTypes withOwner:(jobject)inClipboard jniEnv:(JNIEnv *)inEnv {
//NSLog(@"CClipboard javaDeclareTypes %@ withOwner", inTypes);
@synchronized(self) {
if (inClipboard != NULL) {
if (fClipboardOwner != NULL) {
}
}
}
[ThreadUtilities performOnMainThread:@selector(_nativeDeclareTypes:) on:self withObject:inTypes waitUntilDone:YES];
}
//NSLog(@"CClipboard _nativeDeclareTypes %@ withOwner", inTypes);
}
- (NSArray *) javaGetTypes {
[ThreadUtilities performOnMainThread:@selector(_nativeGetTypes:) on:self withObject:args waitUntilDone:YES];
//NSLog(@"CClipboard getTypes returns %@", [args lastObject]);
return [args lastObject];
}
//NSLog(@"CClipboard getTypes returns %@", [args lastObject]);
}
[ThreadUtilities performOnMainThread:@selector(_nativeSetData:) on:self withObject:newUpdate waitUntilDone:YES];
//NSLog(@"CClipboard javaSetData forType %@", inFormat);
}
//NSLog(@"CClipboard _nativeSetData setData %@", [newUpdate data]);
//NSLog(@"CClipboard _nativeSetData forType %@", [newUpdate format]);
}
[ThreadUtilities performOnMainThread:@selector(_nativeGetDataForType:) on:self withObject:args waitUntilDone:YES];
//NSLog(@"CClipboard javaGetDataForType %@ returns an NSData", inFormat);
return [args lastObject];
}
else [args removeLastObject];
//NSLog(@"CClipboard _nativeGetDataForType");
}
//NSLog(@"CClipboard checkPasteboard oldCount %d newCount %d newTypes %@", fChangeCount, [[NSPasteboard generalPasteboard] changeCount], [[NSPasteboard generalPasteboard] types]);
// This is called via NSApplicationDidBecomeActiveNotification.
// If the change count on the general pasteboard is different than when we set it
// someone else put data on the clipboard. That means the current owner lost ownership.
if (fChangeCount != newChangeCount) {
}
}
//NSLog(@"CClipboard pasteboardChangedOwner");
// If we have a Java pasteboard owner, tell it that it doesn't own the pasteboard anymore.
@synchronized(self) {
if (fClipboardOwner) {
}
}
}
@end
/*
* Class: sun_lwawt_macosx_CClipboard
* Method: declareTypes
* Signature: ([JLsun/awt/datatransfer/SunClipboard;)V
*/
{
jint i;
for (i = 0; i < nElements; i++) {
if (pbFormat)
}
}
/*
* Class: sun_lwawt_macosx_CClipboard
* Method: setData
* Signature: ([BJ)V
*/
{
return;
}
//NSLog(@"Java_sun_lwawt_macosx_CClipboard_setData");
}
/*
* Class: sun_lwawt_macosx_CClipboard
* Method: getClipboardFormats
* Signature: (J)[J
*/
{
//NSLog(@"Java_sun_lwawt_macosx_CClipboard_getClipboardFormats");
NSUInteger i;
// There can be any number of formats on the general pasteboard. Find out which ones
// we know about (i.e., live in the flavormap.properties).
for (i = 0; i < nFormats; i++) {
knownFormats++;
}
if (returnValue == NULL) {
return NULL;
}
if (knownFormats == 0) {
return returnValue;
}
// Now go back and map the formats we found back to Java indexes.
for (i = 0; i < nFormats; i++) {
if (index != -1) {
lFormats++;
}
}
return returnValue;
}
/*
* Class: sun_lwawt_macosx_CClipboard
* Method: getClipboardData
* Signature: (JJ)[B
*/
{
// Note that this routine makes no attempt to interpret the data, since we're returning
// a byte array back to Java. CDataTransferer will do that if necessary.
//NSLog(@"Java_sun_lwawt_macosx_CClipboard_getClipboardData");
return NULL;
}
if (returnValue == NULL) {
return NULL;
}
if (dataSize != 0) {
}
return returnValue;
}
/*
* Class: sun_lwawt_macosx_CClipboard
* Method: checkPasteboard
* Signature: ()V
*/
{
}];
}