if (display == null) DND.error(SWT.ERROR_WIDGET_DISPOSED); if (display.isDisposed()) DND.error(SWT.ERROR_DEVICE_DISPOSED);
checkWidget();
public void setContents(Object[] data, Transfer[] dataTypes) {	if (display == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);	if (display.isDisposed()) DND.error(SWT.ERROR_DEVICE_DISPOSED);	if (data == null || dataTypes == null || data.length != dataTypes.length) {		DND.error(SWT.ERROR_INVALID_ARGUMENT);	}	if (OS.ClearCurrentScrap() != OS.noErr) {		DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);	}	int[] scrap = new int[1];	if (OS.GetCurrentScrap(scrap) != OS.noErr) {		DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);	}	// copy data directly over to System clipboard (not deferred)	for (int i=0; i<dataTypes.length; i++) {		int[] typeIds = dataTypes[i].getTypeIds();		for (int j=0; j<typeIds.length; j++) {			TransferData transferData = new TransferData();			transferData.type = typeIds[j];			dataTypes[i].javaToNative(data[i], transferData); 			if (transferData.result != OS.noErr) {				DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);			}			//Drag and Drop can handle multiple items in one transfer but the			//Clipboard can not.			byte[] datum = transferData.data[0];			if (OS.PutScrapFlavor(scrap[0], transferData.type, 0, datum.length, datum) != OS.noErr){				DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);			}		}	}}