try { notifyListeners(DND.DropAccept,event); } catch (Throwable err) { event.detail = DND.DROP_NONE; event.dataType = null; }
notifyListeners(DND.DropAccept,event);
private void dropProcCallback(int widget, int client_data, int call_data) {	if (call_data == 0) return;	droppedEventData = new XmDropProcCallbackStruct();	OS.memmove(droppedEventData, call_data, XmDropProcCallbackStruct.sizeof);			if (droppedEventData.dropSiteStatus == OS.XmDROP_SITE_INVALID) {		int[] args = new int[] {OS.XmNtransferStatus, OS.XmTRANSFER_FAILURE, OS.XmNnumDropTransfers, 0};		dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);		return;	}		DNDEvent event = new DNDEvent();	if (!setEventData(droppedEventData.operations, droppedEventData.operation, droppedEventData.dragContext, droppedEventData.x, droppedEventData.y, droppedEventData.timeStamp, event)){		return;	}		int allowedOperations = event.operations;	TransferData[] allowedDataTypes = new TransferData[event.dataTypes.length];	System.arraycopy(event.dataTypes, 0, allowedDataTypes, 0, allowedDataTypes.length);		event.dataType = selectedDataType;	event.detail = selectedOperation;	try {		notifyListeners(DND.DropAccept,event);	} catch (Throwable err) {		event.detail = DND.DROP_NONE;		event.dataType = null;	}		selectedDataType = null;	if (event.dataType != null) {		for (int i = 0; i < allowedDataTypes.length; i++) {			if (allowedDataTypes[i].type == event.dataType.type) {				selectedDataType = allowedDataTypes[i];				break;			}		}	}		selectedOperation = DND.DROP_NONE;	if (selectedDataType != null && ((event.detail & allowedOperations) == event.detail)) {		selectedOperation = event.detail;	}	if (selectedOperation == DND.DROP_NONE) {		// this was not a successful drop		int[] args = new int[] {OS.XmNtransferStatus, OS.XmTRANSFER_FAILURE, OS.XmNnumDropTransfers, 0};		dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);		return;	}	// ask drag source for dropped data	int[] transferEntries = new int[2];	transferEntries[0] = control.handle; // pass control handle as data to locate drop target	transferEntries[1] = selectedDataType.type;			int pTransferEntries = OS.XtMalloc(transferEntries.length * 4);	OS.memmove(pTransferEntries, transferEntries, transferEntries.length * 4);	int xtContext = OS.XtDisplayToApplicationContext(getDisplay().xDisplay);	selectionTimeout = OS.XtAppGetSelectionTimeout(xtContext);	OS.XtAppSetSelectionTimeout(xtContext, 0x7fffffff);			int[] args = new int[] {OS.XmNdropTransfers, pTransferEntries,				            OS.XmNnumDropTransfers, transferEntries.length / 2,				            OS.XmNtransferProc, TransferProc.getAddress()};	dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);	OS.XtFree(pTransferEntries);}