use of org.eclipse.jface.text.source.LineRange in project eclipse.platform.text by eclipse.
the class ChangeRegion method getAdjustedCoverage.
/**
* Returns the line coverage of the adjusted ranges, an empty range if the coverage is empty.
*
* @return the line coverage of the adjusted ranges
*/
public ILineRange getAdjustedCoverage() {
if (fAdjusted.isEmpty())
return new LineRange(fLines.getStartLine(), 0);
Range first = fAdjusted.get(0);
Range last = fAdjusted.get(fAdjusted.size() - 1);
return Range.createAbsolute(first.start(), last.end());
}
use of org.eclipse.jface.text.source.LineRange in project eclipse.platform.text by eclipse.
the class JFaceTextUtil method getVisibleModelLines.
/**
* Returns the range of lines that is visible in the viewer, including any partially visible
* lines.
*
* @param viewer the viewer
* @return the range of lines that is visible in the viewer, <code>null</code> if no lines are
* visible
*/
public static ILineRange getVisibleModelLines(ITextViewer viewer) {
int top = getPartialTopIndex(viewer);
int bottom = getPartialBottomIndex(viewer);
if (top == -1 || bottom == -1)
return null;
return new LineRange(top, bottom - top + 1);
}
use of org.eclipse.jface.text.source.LineRange in project linuxtools by eclipse.
the class STPIndenterTest method assertIndenterResult.
protected void assertIndenterResult(String before, String expected) throws Exception {
IDocument document = new Document(before);
new MockSTPDocumentProvider(document);
int numLines = document.getNumberOfLines();
if (document.getLineLength(numLines - 1) == 0) {
// Exclude an empty line at the end.
numLines--;
}
IndentUtil.indentLines(document, new LineRange(0, numLines), null, null);
assertEquals(expected, document.get());
}
Aggregations