if (length == 0) { return text; } convertedText = new StringBuffer(length);
StringBuffer convertedText = new StringBuffer(length); String delimiter = getLineDelimiter();
String getModelDelimitedText(String text) {	StringBuffer convertedText;	String delimiter = getLineDelimiter();	int length = text.length();		int crIndex = 0;	int lfIndex = 0;	int i = 0;		if (length == 0) {		return text;	}	convertedText = new StringBuffer(length);	while (i < length) {		if (crIndex != -1) {			crIndex = text.indexOf(SWT.CR, i);		}		if (lfIndex != -1) {			lfIndex = text.indexOf(SWT.LF, i);		}		if (lfIndex == -1 && crIndex == -1) {	// no more line breaks?			break;		}		else									// CR occurs before LF or no LF present?		if ((crIndex < lfIndex && crIndex != -1) || lfIndex == -1) {				convertedText.append(text.substring(i, crIndex));			if (lfIndex == crIndex + 1) {		// CR/LF combination?				i = lfIndex + 1;			}			else {				i = crIndex + 1;			}		}		else {									// LF occurs before CR!			convertedText.append(text.substring(i, lfIndex));			i = lfIndex + 1;		}		if (isSingleLine()) {			break;		}		convertedText.append(delimiter);	}	// copy remaining text if any and if not in single line mode or no 	// text copied thus far (because there only is one line)	if (i < length && (!isSingleLine() || convertedText.length() == 0)) {		convertedText.append(text.substring(i));	}	return convertedText.toString();}