/*
* 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.
*/
/**
* <p>
* The SunDropTargetContextPeer class is the generic class responsible for handling
* the interaction between a windowing systems DnD system and Java.
* </p>
*
* @since JDK1.3.1
*
*/
/*
* A boolean constant that requires the peer to wait until the
* SunDropTargetEvent is processed and return the status back
* to the native code.
*/
public static final boolean DISPATCH_SYNC = true;
private long[] currentT;
private int previousDA;
private long nativeDragContext;
private boolean dragRejected = false;
protected boolean dropComplete = false;
// The flag is used to monitor whether the drop action is
// handled by a user. That allows to distinct during
// which operation getTransferData() method is invoked.
boolean dropInProcess = false;
/*
* global lock
*/
private static final PlatformLogger dndLog = PlatformLogger.getLogger("sun.awt.dnd.SunDropTargetContextPeer");
/*
* a primitive mechanism for advertising intra-JVM Transferables
*/
public static void setCurrentJVMLocalSourceTransferable(Transferable t) throws InvalidDnDOperationException {
synchronized(_globalLock) {
throw new InvalidDnDOperationException();
} else {
}
}
}
/**
* obtain the transferable iff the operation is in the same VM
*/
}
/*
* constants used by dropAccept() or dropReject()
*/
/**
* create the peer
*/
public SunDropTargetContextPeer() {
super();
}
/**
* @return the DropTarget associated with this peer
*/
/**
* @param actions set the current actions
*/
}
/**
* @return the current target actions
*/
public int getTargetActions() {
return currentA;
}
/**
* get the Transferable associated with the drop
*/
return this;
}
/**
* @return current DataFlavors available
*/
// NOTE: This method may be called by privileged threads.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
if (localTransferable != null) {
return localTransferable.getTransferDataFlavors();
} else {
(currentDT.getFlavorMap()));
}
}
/**
* @return if the flavor is supported
*/
if (localTransferable != null) {
} else {
(currentDT.getFlavorMap())).
}
}
/**
* @return the data
*/
throws UnsupportedFlavorException, IOException,
{
try {
}
} catch (Exception e) {
return null;
}
if (localTransferable != null) {
}
throw new InvalidDnDOperationException("No drop current");
}
(currentDT.getFlavorMap()));
throw new UnsupportedFlavorException(df);
}
if (df.isRepresentationClassRemote() &&
throw new InvalidDnDOperationException("only ACTION_LINK is permissable for transfer of java.rmi.Remote objects");
}
if (ret instanceof byte[]) {
try {
return DataTransferer.getInstance().
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
}
} else if (ret instanceof InputStream) {
try {
return DataTransferer.getInstance().
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
}
} else {
throw new IOException("no native data was transfered");
}
}
throws IOException;
/**
* @return if the transfer is a local one
*/
public boolean isTransferableJVMLocal() {
}
final int x, final int y,
final int dropAction,
final long nativeCtxt) {
}
/**
* actual processing on EventQueue Thread
*/
currentDTC = null;
}
currentDTC.addNotify(this);
try {
hots,
currentSA));
} catch (Exception e) {
e.printStackTrace();
}
} else {
currentDTC = null;
}
}
/**
* upcall to handle exit messages
*/
final long nativeCtxt) {
/*
* Even though the return value is irrelevant for this event, it is
* dispatched synchronously to fix 4393148 properly.
*/
}
/**
*
*/
if (currentDTC != null) {
}
currentDTC = null;
return;
}
if (currentDTC != null) {
}
currentDTC.addNotify(this);
}
dtc = currentDTC;
} catch (Exception e) {
e.printStackTrace();
} finally {
currentDTC = null;
dragRejected = false;
}
}
final int x, final int y,
final int dropAction,
final long nativeCtxt) {
}
/**
*
*/
boolean operationChanged) {
if (currentDTC != null) {
}
currentDTC = null;
}
if (dtc != currentDTC) {
if (currentDTC != null) {
}
currentDTC = dtc;
currentDTC.addNotify(this);
}
try {
hots,
if (operationChanged) {
} else {
}
if (dragRejected) {
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
}
}
/**
* upcall to handle the Drop message
*/
final int x, final int y,
final int dropAction, final int actions,
final long[] formats,
final long nativeCtxt) {
}
/**
*
*/
dropComplete = false;
if (currentDTC != null) {
}
currentDTC = dtc;
currentDTC.addNotify(this);
synchronized(_globalLock) {
}
dropInProcess = true;
try {
hots,
} finally {
if (dropStatus == STATUS_WAIT) {
rejectDrop();
} else if (dropComplete == false) {
dropComplete(false);
}
dropInProcess = false;
}
} else {
rejectDrop();
}
}
final int x, final int y,
final int dropAction,
final int actions,
final long[] formats,
final long nativeCtxt,
final int eventID,
final boolean dispatchType) {
}
// schedule callback
while (!dispatcher.isDone()) {
}
// return target's response
return dispatcher.getReturnValue();
} else {
return 0;
}
}
/**
* acceptDrag
*/
throw new InvalidDnDOperationException("No Drag pending");
}
dragRejected = false;
}
}
/**
* rejectDrag
*/
public synchronized void rejectDrag() {
throw new InvalidDnDOperationException("No Drag pending");
}
dragRejected = true;
}
/**
* acceptDrop
*/
throw new IllegalArgumentException("invalid acceptDrop() action");
if (dropStatus != STATUS_WAIT) {
throw new InvalidDnDOperationException("invalid acceptDrop()");
}
dropComplete = false;
}
/**
* reject Drop
*/
public synchronized void rejectDrop() {
if (dropStatus != STATUS_WAIT) {
throw new InvalidDnDOperationException("invalid rejectDrop()");
}
/*
* Fix for 4285634.
* The target rejected the drop means that it doesn't perform any
* drop action. This change is to make Solaris behavior consistent
* with Win32.
*/
dropComplete(false);
}
/**
* mapOperation
*/
int[] operations = {
};
ret = operations[i];
break;
}
}
return ret;
}
/**
* signal drop complete
*/
if (dropStatus == STATUS_NONE) {
throw new InvalidDnDOperationException("No Drop pending");
}
currentDTC = null;
synchronized(_globalLock) {
}
dropComplete = true;
try {
} finally {
// The native context is invalid after the drop is done.
// Clear the reference to prohibit access.
nativeDragContext = 0;
}
}
int dropAction, boolean isLocal);
protected synchronized long getNativeDragContext() {
return nativeDragContext;
}
boolean dispatcherDone) {}
protected static class EventDispatcher {
// context fields
private final int dropAction;
private final int actions;
private final long[] formats;
private long nativeCtxt;
private final boolean dispatchType;
private boolean dispatcherDone = false;
// dispatcher state fields
// set of events to be dispatched by this dispatcher
int dropAction,
int actions,
long[] formats,
long nativeCtxt,
boolean dispatchType) {
this.nativeCtxt = nativeCtxt;
this.dropAction = dropAction;
this.formats =
this.dispatchType = dispatchType;
}
switch (id) {
break;
break;
break;
break;
default:
throw new InvalidDnDOperationException();
}
}
synchronized (peer) {
// store the drop action here to track operation changes
// setup peer context
// To allow data retrieval.
peer.dropComplete = false;
try {
} finally {
}
}
}
synchronized (peer) {
// setup peer context
// To allow data retrieval.
peer.dropComplete = false;
try {
} finally {
}
}
}
synchronized (peer) {
// setup peer context
}
}
synchronized (peer) {
// setup peer context
}
}
returnValue = ret;
}
int getReturnValue() {
return returnValue;
}
boolean isDone() {
}
}
}
try {
// This event has already been unregistered.
return;
}
}
dispatcherDone = true;
}
} finally {
}
try {
} finally {
/*
* Clear the reference to the native context if all copies of
* the original event are processed.
*/
if (dispatcherDone) {
nativeCtxt = 0;
// Fix for 6342381
}
}
}
public void unregisterAllEvents() {
try {
} finally {
}
}
}
}
}
}