/** * Copies the specified text range to the clipboard. The text will be placed * in the clipboard in plain text format and RTF format. * * @param start start index of the text * @param length length of text to place in clipboard * * @exception SWTError, see Clipboard.setContents * @see org.eclipse.swt.dnd.Clipboard#setContents */ void setClipboardContent(int start, int length, int clipboardType) throws SWTError { if (clipboardType == DND.SELECTION_CLIPBOARD && !IS_GTK) return; TextTransfer plainTextTransfer = TextTransfer.getInstance(); TextWriter plainTextWriter = new TextWriter(start, length); String plainText = getPlatformDelimitedText(plainTextWriter); Object[] data; Transfer[] types; if (clipboardType == DND.SELECTION_CLIPBOARD) { data = new Object[]{plainText}; types = new Transfer[]{plainTextTransfer}; } else { RTFTransfer rtfTransfer = RTFTransfer.getInstance(); RTFWriter rtfWriter = new RTFWriter(start, length); String rtfText = getPlatformDelimitedText(rtfWriter); data = new Object[]{rtfText, plainText}; types = new Transfer[]{rtfTransfer, plainTextTransfer}; } clipboard.setContents(data, types, clipboardType); } /**
/** * Copies the specified text range to the clipboard. The text will be placed * in the clipboard in plain text format and RTF format. * * @param start start index of the text * @param length length of text to place in clipboard * * @exception SWTError, see Clipboard.setContents * @see org.eclipse.swt.dnd.Clipboard#setContents */ void setClipboardContent(int start, int length, int clipboardType) throws SWTError { if (clipboardType == DND.SELECTION_CLIPBOARD && !(IS_MOTIF || IS_GTK)) return; TextTransfer plainTextTransfer = TextTransfer.getInstance(); TextWriter plainTextWriter = new TextWriter(start, length); String plainText = getPlatformDelimitedText(plainTextWriter); Object[] data; Transfer[] types; if (clipboardType == DND.SELECTION_CLIPBOARD) { data = new Object[]{plainText}; types = new Transfer[]{plainTextTransfer}; } else { RTFTransfer rtfTransfer = RTFTransfer.getInstance(); RTFWriter rtfWriter = new RTFWriter(start, length); String rtfText = getPlatformDelimitedText(rtfWriter); data = new Object[]{rtfText, plainText}; types = new Transfer[]{rtfTransfer, plainTextTransfer}; } clipboard.setContents(data, types, clipboardType); } /**
/** * Copies the specified text range to the clipboard. The text will be placed * in the clipboard in plain text format and RTF format. * * @param start start index of the text * @param length length of text to place in clipboard * * @exception SWTError, see Clipboard.setContents * @see org.eclipse.swt.dnd.Clipboard#setContents */ void setClipboardContent(int start, int length, int clipboardType) throws SWTError { if (clipboardType == DND.SELECTION_CLIPBOARD && !IS_GTK) return; TextTransfer plainTextTransfer = TextTransfer.getInstance(); TextWriter plainTextWriter = new TextWriter(start, length); String plainText = getPlatformDelimitedText(plainTextWriter); Object[] data; Transfer[] types; if (clipboardType == DND.SELECTION_CLIPBOARD) { data = new Object[]{plainText}; types = new Transfer[]{plainTextTransfer}; } else { RTFTransfer rtfTransfer = RTFTransfer.getInstance(); RTFWriter rtfWriter = new RTFWriter(start, length); String rtfText = getPlatformDelimitedText(rtfWriter); data = new Object[]{rtfText, plainText}; types = new Transfer[]{rtfTransfer, plainTextTransfer}; } clipboard.setContents(data, types, clipboardType); } /**
/** * Copies the specified text range to the clipboard. The text will be placed * in the clipboard in plain text format and RTF format. * * @param start start index of the text * @param length length of text to place in clipboard * * @exception SWTError, see Clipboard.setContents * @see org.eclipse.swt.dnd.Clipboard#setContents */ void setClipboardContent(int start, int length, int clipboardType) throws SWTError { if (clipboardType == DND.SELECTION_CLIPBOARD && !IS_GTK) return; TextTransfer plainTextTransfer = TextTransfer.getInstance(); TextWriter plainTextWriter = new TextWriter(start, length); String plainText = getPlatformDelimitedText(plainTextWriter); Object[] data; Transfer[] types; if (clipboardType == DND.SELECTION_CLIPBOARD) { data = new Object[]{plainText}; types = new Transfer[]{plainTextTransfer}; } else { RTFTransfer rtfTransfer = RTFTransfer.getInstance(); RTFWriter rtfWriter = new RTFWriter(start, length); String rtfText = getPlatformDelimitedText(rtfWriter); data = new Object[]{rtfText, plainText}; types = new Transfer[]{rtfTransfer, plainTextTransfer}; } clipboard.setContents(data, types, clipboardType); } /**
/** * Copies the specified text range to the clipboard. The text will be placed * in the clipboard in plain text format and RTF format. * * @param start start index of the text * @param length length of text to place in clipboard * * @exception SWTError, see Clipboard.setContents * @see org.eclipse.swt.dnd.Clipboard#setContents */ void setClipboardContent(int start, int length, int clipboardType) throws SWTError { if (clipboardType == DND.SELECTION_CLIPBOARD && !IS_GTK) return; TextTransfer plainTextTransfer = TextTransfer.getInstance(); TextWriter plainTextWriter = new TextWriter(start, length); String plainText = getPlatformDelimitedText(plainTextWriter); Object[] data; Transfer[] types; if (clipboardType == DND.SELECTION_CLIPBOARD) { data = new Object[]{plainText}; types = new Transfer[]{plainTextTransfer}; } else { RTFTransfer rtfTransfer = RTFTransfer.getInstance(); RTFWriter rtfWriter = new RTFWriter(start, length); String rtfText = getPlatformDelimitedText(rtfWriter); data = new Object[]{rtfText, plainText}; types = new Transfer[]{rtfTransfer, plainTextTransfer}; } clipboard.setContents(data, types, clipboardType); } /**