8020371: [macosx] applets with Drag and Drop fail with IllegalArgumentException

Reviewed-by: anthony, art
This commit is contained in:
Petr Pchelko 2013-07-15 12:06:06 +04:00
parent a507980e6d
commit 0b20e5e9af
3 changed files with 7 additions and 6 deletions

View File

@ -107,10 +107,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
loc = rootComponent.getLocation();
}
//It sure will be LWComponentPeer instance as rootComponent is a Window
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
// If there isn't any drag image make one of default appearance:
if (fDragImage == null)
this.setDefaultDragImage(component);
@ -137,6 +133,11 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
}
try {
//It sure will be LWComponentPeer instance as rootComponent is a Window
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation");
// Create native dragging source:
final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
(int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,

View File

@ -52,6 +52,8 @@ public final class CDropTarget {
fPeer = peer;
long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin)
// Create native dragging destination:
fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
if (fNativeDropTarget == 0) {

View File

@ -896,8 +896,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView();
} else if (platformWindow instanceof CViewPlatformEmbeddedFrame){
nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr();
} else {
throw new IllegalArgumentException("Unsupported platformWindow implementation");
}
return nativePeer;
}