use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.
the class BoshDefintionFinder method toLocation.
protected Optional<Location> toLocation(TextDocument doc, Node node) {
int start = node.getStartMark().getIndex();
int end = node.getEndMark().getIndex();
try {
return Optional.of(new Location(doc.getUri(), doc.toRange(start, end - start)));
} catch (BadLocationException e) {
Log.log(e);
return Optional.empty();
}
}
use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.
the class ListLineTracker method getLineInformationOfOffset.
@Override
public final IRegion getLineInformationOfOffset(int position) throws BadLocationException {
if (position > fTextLength)
throw new BadLocationException();
if (position == fTextLength) {
int size = fLines.size();
if (size == 0)
return new Region(0, 0);
Line l = fLines.get(size - 1);
return (l.delimiter != null ? new Line(fTextLength, 0) : new Line(fTextLength - l.length, l.length));
}
return getLineInformation(findLine(position));
}
use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.
the class ListLineTracker method getLineDelimiter.
@Override
public final String getLineDelimiter(int line) throws BadLocationException {
int lines = fLines.size();
if (line < 0 || line > lines)
throw new BadLocationException();
if (lines == 0)
return null;
if (line == lines)
return null;
Line l = fLines.get(line);
return l.delimiter;
}
use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.
the class ListLineTracker method getLineNumberOfOffset.
@Override
public final int getLineNumberOfOffset(int position) throws BadLocationException {
if (position < 0 || position > fTextLength)
throw new BadLocationException();
if (position == fTextLength) {
int lastLine = fLines.size() - 1;
if (lastLine < 0)
return 0;
Line l = fLines.get(lastLine);
return (l.delimiter != null ? lastLine + 1 : lastLine);
}
return findLine(position);
}
use of org.springframework.ide.vscode.commons.util.BadLocationException in project sts4 by spring-projects.
the class ConcourseDefinitionFinder method toLocation.
Optional<Location> toLocation(TextDocument doc, Node node) {
int start = node.getStartMark().getIndex();
int end = node.getEndMark().getIndex();
try {
return Optional.of(new Location(doc.getUri(), doc.toRange(start, end - start)));
} catch (BadLocationException e) {
Log.log(e);
return Optional.empty();
}
}
Aggregations