8020371: [macosx] applets with Drag and Drop fail with IllegalArgumentException
Reviewed-by: anthony, art
This commit is contained in:
parent
a507980e6d
commit
0b20e5e9af
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user