org.eclipse.jface.text.source.LineRange Java Examples
The following examples show how to use
org.eclipse.jface.text.source.LineRange.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Utils.java From jdt-codemining with Eclipse Public License 1.0 | 5 votes |
public static ILineRange getLineRange(IJavaElement element, IDocument document) throws JavaModelException, BadLocationException { ISourceRange r = ((ISourceReference) element).getSourceRange(); int offset = r.getOffset(); int startLine = document.getLineOfOffset(offset); int endLine = document.getLineOfOffset(offset + r.getLength()); return new LineRange(startLine, endLine - startLine); }
Example #2
Source File: JavaFormatter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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); }
Example #3
Source File: JavaMoveLinesAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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); }
Example #4
Source File: PyMoveLineAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private ILineRange getLineRange(IDocument document, ICoreTextSelection 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); }
Example #5
Source File: AnnotationExpandHover.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) { return new LineRange(lineNumber, 1); }