/** * Returns a copy of the widget content. * * @return copy of the widget content * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText() { checkWidget(); return content.getTextRange(0, getCharCount()); } /**
/** * Returns a copy of the widget content. * * @return copy of the widget content * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText() { checkWidget(); return content.getTextRange(0, getCharCount()); } /**
/** * Returns a copy of the widget content. * * @return copy of the widget content * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText() { checkWidget(); return content.getTextRange(0, getCharCount()); } /**
/** * Returns a copy of the widget content. * * @return copy of the widget content * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText() { checkWidget(); return content.getTextRange(0, getCharCount()); } /**
/** * Returns a copy of the widget content. * * @return copy of the widget content * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText() { checkWidget(); return content.getTextRange(0, getCharCount()); } /**
String getBlockSelectionText(String delimiter) { Rectangle rect = getBlockSelectionPosition(); int firstLine = rect.y; int lastLine = rect.height; int left = rect.x; int right = rect.width; StringBuffer buffer = new StringBuffer(); for (int lineIndex = firstLine; lineIndex <= lastLine; lineIndex++) { int start = getOffsetAtPoint(left, 0, lineIndex, null); int end = getOffsetAtPoint(right, 0, lineIndex, null); if (start > end) { int temp = start; start = end; end = temp; } String text = content.getTextRange(start, end - start); buffer.append(text); if (lineIndex < lastLine) buffer.append(delimiter); } return buffer.toString(); } /**
/** * Returns the selected text. * * @return selected text, or an empty String if there is no selection. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getSelectionText() { checkWidget(); if (blockSelection && blockXLocation != -1) { return getBlockSelectionText(content.getLineDelimiter()); } return content.getTextRange(selection.x, selection.y - selection.x); } StyledTextEvent getBidiSegments(int lineOffset, String line) {
/** * Returns the selected text. * * @return selected text, or an empty String if there is no selection. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getSelectionText() { checkWidget(); if (blockSelection && blockXLocation != -1) { return getBlockSelectionText(content.getLineDelimiter()); } return content.getTextRange(selection.x, selection.y - selection.x); } StyledTextEvent getBidiSegments(int lineOffset, String line) {
/** * Returns the selected text. * * @return selected text, or an empty String if there is no selection. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getSelectionText() { checkWidget(); if (blockSelection && blockXLocation != -1) { return getBlockSelectionText(content.getLineDelimiter()); } return content.getTextRange(selection.x, selection.y - selection.x); } StyledTextEvent getBidiSegments(int lineOffset, String line) {
/** * Returns the selected text. * * @return selected text, or an empty String if there is no selection. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getSelectionText() { checkWidget(); if (blockSelection && blockXLocation != -1) { return getBlockSelectionText(content.getLineDelimiter()); } return content.getTextRange(selection.x, selection.y - selection.x); } StyledTextEvent getBidiSegments(int lineOffset, String line) {
/** * Returns the selected text. * * @return selected text, or an empty String if there is no selection. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getSelectionText() { checkWidget(); if (blockSelection && blockXLocation != -1) { return getBlockSelectionText(content.getLineDelimiter()); } return content.getTextRange(selection.x, selection.y - selection.x); } StyledTextEvent getBidiSegments(int lineOffset, String line) {
/** * Returns the widget content between the two offsets. * * @param start offset of the first character in the returned String * @param end offset of the last character in the returned String * @return widget content starting at start and ending at end * @see #getTextRange(int,int) * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> */ public String getText(int start, int end) { checkWidget(); int contentLength = getCharCount(); if (start < 0 || start >= contentLength || end < 0 || end >= contentLength || start > end) { SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getTextRange(start, end - start + 1); } /**
/** * Returns the widget content between the two offsets. * * @param start offset of the first character in the returned String * @param end offset of the last character in the returned String * @return widget content starting at start and ending at end * @see #getTextRange(int,int) * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li> * </ul> */ public String getText(int start, int end) { checkWidget(); int contentLength = getCharCount(); if (start < 0 || start >= contentLength || end < 0 || end >= contentLength || start > end) { SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getTextRange(start, end - start + 1); } /**
/** * Returns the widget content starting at start for length characters. * * @param start offset of the first character in the returned String * @param length number of characters to return * @return widget content starting at start and extending length characters. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE when start and/or length are outside the widget content</li> * </ul> */ public String getTextRange(int start, int length) { checkWidget(); int contentLength = getCharCount(); int end = start + length; if (start > end || start < 0 || end > contentLength) { SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getTextRange(start, length); } /**
/** * Returns the widget content starting at start for length characters. * * @param start offset of the first character in the returned String * @param length number of characters to return * @return widget content starting at start and extending length characters. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE when start and/or length are outside the widget content</li> * </ul> */ public String getTextRange(int start, int length) { checkWidget(); int contentLength = getCharCount(); int end = start + length; if (start > end || start < 0 || end > contentLength) { SWT.error(SWT.ERROR_INVALID_RANGE); } return content.getTextRange(start, length); } /**
/** * Copies the text of the specified <code>StyledTextContent</code>. * </p> * @param original the <code>StyledTextContent</code> to copy. */ StyledTextContent copyContent(StyledTextContent original) { StyledTextContent printerContent = new DefaultContent(); int insertOffset = 0; for (int i = 0; i < original.getLineCount(); i++) { int insertEndOffset; if (i < original.getLineCount() - 1) { insertEndOffset = original.getOffsetAtLine(i + 1); } else { insertEndOffset = original.getCharCount(); } printerContent.replaceTextRange(insertOffset, 0, original.getTextRange(insertOffset, insertEndOffset - insertOffset)); insertOffset = insertEndOffset; } return printerContent; } /**
/** * Copies the text of the specified <code>StyledTextContent</code>. * </p> * @param original the <code>StyledTextContent</code> to copy. */ StyledTextContent copyContent(StyledTextContent original) { StyledTextContent printerContent = new DefaultContent(); int insertOffset = 0; for (int i = 0; i < original.getLineCount(); i++) { int insertEndOffset; if (i < original.getLineCount() - 1) { insertEndOffset = original.getOffsetAtLine(i + 1); } else { insertEndOffset = original.getCharCount(); } printerContent.replaceTextRange(insertOffset, 0, original.getTextRange(insertOffset, insertEndOffset - insertOffset)); insertOffset = insertEndOffset; } return printerContent; } /**
/** * Copies the text of the specified <code>StyledTextContent</code>. * </p> * @param original the <code>StyledTextContent</code> to copy. */ StyledTextContent copyContent(StyledTextContent original) { StyledTextContent printerContent = new DefaultContent(); int insertOffset = 0; for (int i = 0; i < original.getLineCount(); i++) { int insertEndOffset; if (i < original.getLineCount() - 1) { insertEndOffset = original.getOffsetAtLine(i + 1); } else { insertEndOffset = original.getCharCount(); } printerContent.replaceTextRange(insertOffset, 0, original.getTextRange(insertOffset, insertEndOffset - insertOffset)); insertOffset = insertEndOffset; } return printerContent; } /**
/** * Copies the text of the specified <code>StyledTextContent</code>. * </p> * @param original the <code>StyledTextContent</code> to copy. */ StyledTextContent copyContent(StyledTextContent original) { StyledTextContent printerContent = new DefaultContent(); int insertOffset = 0; for (int i = 0; i < original.getLineCount(); i++) { int insertEndOffset; if (i < original.getLineCount() - 1) { insertEndOffset = original.getOffsetAtLine(i + 1); } else { insertEndOffset = original.getCharCount(); } printerContent.replaceTextRange(insertOffset, 0, original.getTextRange(insertOffset, insertEndOffset - insertOffset)); insertOffset = insertEndOffset; } return printerContent; } /**
/** * Copies the text of the specified <code>StyledTextContent</code>. * </p> * @param original the <code>StyledTextContent</code> to copy. */ StyledTextContent copyContent(StyledTextContent original) { StyledTextContent printerContent = new DefaultContent(); int insertOffset = 0; for (int i = 0; i < original.getLineCount(); i++) { int insertEndOffset; if (i < original.getLineCount() - 1) { insertEndOffset = original.getOffsetAtLine(i + 1); } else { insertEndOffset = original.getCharCount(); } printerContent.replaceTextRange(insertOffset, 0, original.getTextRange(insertOffset, insertEndOffset - insertOffset)); insertOffset = insertEndOffset; } return printerContent; } /**