/** * Returns the index in document of a none whitespace character * between start (inclusive) and end (inclusive) such that if * more then one such character the index returned is the largest * possible (closest to end). Returns start - 1 if no such character. * * @param start * @param end * @param document * @return the position or start - 1 * @throws BadLocationException */ private static int getIndexOfRightMostNoneWhitspaceCharacter(int start, int end, Document document) throws BadLocationException { int position= end; while (position >= start && Character.isWhitespace(document.getChar(position))) position--; return position; }
char ch= document.getChar(to); if (!Character.isWhitespace(ch)) break;
char ch= document.getChar(to); if (!Character.isWhitespace(ch)) break;
char ch= document.getChar(to); if (!Character.isWhitespace(ch)) break;
char ch= document.getChar(to); if (!Character.isWhitespace(ch)) break;
/** * Cuts the visual equivalent of <code>toDelete</code> characters out of the indentation of line <code>line</code> in <code>document</code>. * * @param document * the document * @param line * the line * @param toDelete * the number of space equivalents to delete. * @throws BadLocationException * on concurrent document modification */ private void cutIndent(Document document, int line, int toDelete) throws BadLocationException { IRegion region = document.getLineInformation(line); int from = region.getOffset(); int endOffset = region.getOffset() + region.getLength(); int to = from; while (toDelete > 0 && to < endOffset) { char ch = document.getChar(to); if (!Character.isWhitespace(ch)) break; toDelete -= computeVisualLength(ch); if (toDelete >= 0) { to++; } else { break; } } document.replace(from, to - from, null); }
char ch= document.getChar(to); if (!Character.isWhitespace(ch)) break;
char ch= document.getChar(to); if (!Character.isWhitespace(ch)) break;
if (document.getChar(j) == '*' && getIndexOfRightMostNoneWhitspaceCharacter(lineStart, j - 1, document) < lineStart) { j++;
} else if (removeTrailingWhitespacesIgnorEmpty) { if (j >= lineStart) { if (document.getChar(j) == '*' && getIndexOfRightMostNoneWhitspaceCharacter(lineStart, j - 1, document) < lineStart) { j++;
if (document.getChar(j) == '*' && getIndexOfRightMostNoneWhitspaceCharacter(lineStart, j - 1, document) < lineStart) { j++;