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);	}	int xDisplay = OS.XtDisplay (shellHandle);	if (xDisplay == 0) DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);	int xWindow = OS.XtWindow (shellHandle);	if (xWindow == 0) DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);		// Open clipboard for setting	int[] item_id = new int[1];				if (OS.XmClipboardStartCopy(xDisplay, xWindow, 0, OS.XtLastTimestampProcessed(xDisplay), shellHandle, 0, item_id) != OS.XmClipboardSuccess){		DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);	}	try {		// copy data directly over to System clipboard (not deferred)		for (int i = 0; i < dataTypes.length; i++) {			int[] ids = dataTypes[i].getTypeIds();			String[] names = dataTypes[i].getTypeNames();			for (int j = 0; j < names.length; j++) {				TransferData transferData = new TransferData();				transferData.type = ids[j];				dataTypes[i].javaToNative(data[i], transferData);				if (transferData.result != 1) DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);				try {					if (transferData.format != 8) DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);					byte[] buffer = new byte[transferData.length];					OS.memmove(buffer, transferData.pValue, transferData.length);					byte[] bName = Converter.wcsToMbcs(null, names[j], true);					if (OS.XmClipboardCopy(xDisplay, xWindow, item_id[0], bName, buffer, transferData.length, 0, null) != OS.XmClipboardSuccess) {						DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);					}				} finally {					OS.XtFree(transferData.pValue);				}			}		}	} finally {		// close clipboard  for setting		OS.XmClipboardEndCopy(xDisplay, xWindow, item_id[0]);	}}