private static int findClosingCharacter(IDocument doc, int pos, int end, char endChar) throws BadLocationException { int curr= pos; while (curr < end && (doc.getChar(curr) != endChar)) { curr++; } if (curr < end) { return curr + 1; } return pos; }
private void gotoStringEnd(char delimiter) throws BadLocationException { while (fOffset < fEnd) { char current= fDocument.getChar(fOffset++); if (current == '\\') { // ignore escaped characters ++ fOffset; } else if (current == delimiter) { return; } } }
public char current() { if (fOffset <= fIndex && fIndex < fEndOffset) { try { return fDocument.getChar(fIndex); } catch (BadLocationException x) { } } return DONE; }
private void gotoStringEnd(char delimiter) throws BadLocationException { while (fOffset < fEnd) { char current= fDocument.getChar(fOffset++); if (current == '\\') { // ignore escaped characters ++ fOffset; } else if (current == delimiter) { return; } } }
@Override public char current() { if (fOffset <= fIndex && fIndex < fEndOffset) { try { return fDocument.getChar(fIndex); } catch (BadLocationException x) { } } return DONE; }
@Override public char current() { if (fOffset <= fIndex && fIndex < fEndOffset) { try { return fDocument.getChar(fIndex); } catch (BadLocationException x) { } } return DONE; }
@Override public char charAt(int index) { try { return fDocument.getChar(index); } catch (BadLocationException e) { throw new IndexOutOfBoundsException(); } }
public char charAt(int index) { try { return fDocument.getChar(index); } catch (BadLocationException e) { throw new IndexOutOfBoundsException(); } }
public char charAt(int index) { try { return fDocument.getChar(index); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getLocalizedMessage()); } }
private boolean isMasked(int offset) { IDocument document= getSourceViewer().getDocument(); try { return fEscapeCharacter == document.getChar(offset - 1); } catch (BadLocationException e) { } return false; } }
@Override public char getChar(int position) { try { return fDocument.getChar(position); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getMessage()); } }
private boolean isMasked(int offset) { IDocument document= getSourceViewer().getDocument(); try { return fEscapeCharacter == document.getChar(offset - 1); } catch (BadLocationException e) { } return false; } }
private void trimStart(IDocument document) throws BadLocationException { int i= 0; while ((i != document.getLength()) && Character.isWhitespace(document.getChar(i))) i++; document.replace(0, i, ""); //$NON-NLS-1$ }
private void trimStart(IDocument document) throws BadLocationException { int i= 0; while ((i != document.getLength()) && Character.isWhitespace(document.getChar(i))) i++; document.replace(0, i, ""); //$NON-NLS-1$ }
private IRegion findPrefixRange(IDocument document, IRegion line) throws BadLocationException { int lineOffset = line.getOffset(); int lineEnd = lineOffset + line.getLength(); int indentEnd = findEndOfWhiteSpace(document, lineOffset, lineEnd); if (indentEnd < lineEnd && document.getChar(indentEnd) == '*') { indentEnd++; while (indentEnd < lineEnd && document.getChar(indentEnd) == ' ') { indentEnd++; } } return new Region(lineOffset, indentEnd - lineOffset); }
private String getPrefix(ITextViewer viewer, int offset) throws BadLocationException { IDocument doc= viewer.getDocument(); if (doc == null || offset > doc.getLength()) return null; int length= 0; while (--offset >= 0 && Character.isJavaIdentifierPart(doc.getChar(offset))) length++; return doc.get(offset + 1, length); }