use of org.eclipse.xtext.ui.generator.trace.AbstractEclipseTrace in project xtext-eclipse by eclipse.
the class JavaBreakPointProvider method getJavaLineNumber.
private int getJavaLineNumber(final IJavaStratumLineBreakpoint breakpoint) throws CoreException {
ILocationInEclipseResource javaLocation = getJavaLocation(breakpoint);
if (javaLocation == null)
return -1;
IStorage storage = javaLocation.getPlatformResource();
if (storage == null) {
ITextRegionWithLineInformation textRegion = javaLocation.getTextRegion();
if (textRegion == null)
return -1;
return textRegion.getEndLineNumber();
} else {
AbstractEclipseTrace sourceTrace = (AbstractEclipseTrace) traceForStorageProvider.getTraceToSource(storage);
if (sourceTrace == null)
return -1;
AbstractTraceRegion rootTraceRegion = sourceTrace.getRootTraceRegion();
if (rootTraceRegion == null)
return -1;
List<LineMapping> lineMappings = lineMappingProvider.getLineMapping(rootTraceRegion);
if (lineMappings == null) {
return -1;
}
for (LineMapping lineMapping : lineMappings) {
if (lineMapping.sourceStartLine == breakpoint.getLineNumber()) {
return lineMapping.targetEndLine + 1;
}
}
return -1;
}
}
Aggregations