private void indent(IDocument document) throws BadLocationException, MalformedTreeException { // first line int offset= document.getLineOffset(0); document.replace(offset, 0, CodeFormatterUtil.createIndentString(fInitialIndentLevel, fProject)); // following lines int lineCount= document.getNumberOfLines(); IndentUtil.indentLines(document, new LineRange(1, lineCount - 1), fProject, null); }
private ILineRange getLineRange(IDocument document, ITextSelection selection) throws BadLocationException { final int offset= selection.getOffset(); int startLine= document.getLineOfOffset(offset); int endOffset= offset + selection.getLength(); int endLine= document.getLineOfOffset(endOffset); final int nLines= endLine - startLine + 1; return new LineRange(startLine, nLines); }
private ILineRange getLineRange(IDocument document, ITextSelection selection) throws BadLocationException { final int offset = selection.getOffset(); int startLine = document.getLineOfOffset(offset); int endOffset = offset + selection.getLength(); int endLine = document.getLineOfOffset(endOffset); final int nLines = endLine - startLine + 1; return new LineRange(startLine, nLines); }
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) { return new LineRange(lineNumber, 1); }