try { notifyListeners(DND.DragStart, event); } catch (Throwable e) { event.doit = false; }
notifyListeners(DND.DragStart, event);
private void drag() {	// Current event must be a Button Press event	Display display = control.getDisplay ();	XButtonEvent xEvent = new XButtonEvent();	OS.memmove(xEvent, display.xEvent, XButtonEvent.sizeof);	if (xEvent.type != OS.ButtonPress) return;	DNDEvent event = new DNDEvent();	event.widget = this;		event.time = xEvent.time;	event.doit = true;		try {		notifyListeners(DND.DragStart, event);	} catch (Throwable e) {		event.doit = false;	}	if (!event.doit || transferAgents == null || transferAgents.length == 0) { 		int time = xEvent.time;		int dc = OS.XmGetDragContext(control.handle, time);		if (dc != 0){			OS.XmDragCancel(dc);		}		return;	}	// set the protocol (optional)	// not implemented		// create pixmaps for icons (optional)	// not implemented	// Copy targets to global memory	TransferData[] transferData = new TransferData[0];	for (int i = 0; i < transferAgents.length; i++){		TransferData[] data = transferAgents[i].getSupportedTypes();		TransferData[] newTransferData = new TransferData[transferData.length + data.length];		System.arraycopy(transferData, 0, newTransferData, 0, transferData.length);		System.arraycopy(data, 0, newTransferData, transferData.length, data.length);		transferData = newTransferData;	}	int[] dataTypes = new int[transferData.length];	for (int i = 0; i < transferData.length; i++){		dataTypes[i] = transferData[i].type;	}	int pExportTargets = OS.XtMalloc(dataTypes.length * 4);	OS.memmove(pExportTargets, dataTypes, dataTypes.length * 4);	int[] args = new int[]{		OS.XmNexportTargets,		pExportTargets,		OS.XmNnumExportTargets,		dataTypes.length,		OS.XmNdragOperations,		opToOsOp(getStyle()),		OS.XmNconvertProc,			ConvertProc.getAddress(),		OS.XmNoperationCursorIcon,	0,		OS.XmNsourceCursorIcon,		0,		OS.XmNstateCursorIcon,		0,		OS.XmNclientData,			0,		OS.XmNblendModel,			OS.XmBLEND_ALL	};		// look for existing drag contexts	int time = xEvent.time;	dragContext = OS.XmGetDragContext(control.handle, time);	if (dragContext != 0){		OS.XtSetValues(dragContext, args, args.length /2);	} else {		dragContext = OS.XmDragStart(this.control.handle, display.xEvent, args, args.length / 2);	}	OS.XtFree(pExportTargets);	if (dragContext == 0) return;	// register a call back to clean up when drop is done (optional)	OS.XtAddCallback(dragContext, OS.XmNdragDropFinishCallback, DragDropFinish.getAddress(), 0);	// register a call back to tell user what happened (optional)	OS.XtAddCallback(dragContext, OS.XmNdropFinishCallback, DropFinish.getAddress(), 0);		display.setData(Integer.toString(dragContext), this);	return;}