use of org.erlide.cover.views.model.LineResult in project erlide_eclipse by erlang.
the class CoverEventHandler method prepLineResults.
private void prepLineResults(final OtpErlangList lineList, final ModuleStats stats) {
for (OtpErlangObject aLineList : lineList) {
final OtpErlangTuple res = (OtpErlangTuple) aLineList;
final int num = Integer.parseInt(res.elementAt(1).toString());
final int calls = Integer.parseInt(res.elementAt(2).toString());
final LineResult lineRes = new LineResult(num, calls);
stats.addLine(lineRes);
}
}
use of org.erlide.cover.views.model.LineResult in project erlide_eclipse by erlang.
the class EditorTracker method removeAnnotationsFragment.
/**
* Removes coverage annotations from a fragment of file
*
* @param fileName
* @param start
* @param end
*/
public void removeAnnotationsFragment(final String fileName, final int start, final int end) {
final IEditorPart currentEditor = workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (currentEditor.getTitle().equals(fileName) && currentEditor instanceof ITextEditor) {
final ITextEditor editor = (ITextEditor) currentEditor;
final IAnnotationModel annMod = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
final Set<LineResult> list = coverage.getLineSet(editor.getTitle());
for (final LineResult lr : list) {
if (lr.getLineNum() < start || end != -1 && lr.getLineNum() > end) {
continue;
}
log.info(lr.getLineNum());
if (coverage.containsAnnotation(editor.getTitle(), lr)) {
final Annotation ann = coverage.getAnnotation(editor.getTitle(), lr);
annMod.removeAnnotation(ann);
coverage.removeAnnotation(editor.getTitle(), lr);
}
}
}
}
use of org.erlide.cover.views.model.LineResult in project erlide_eclipse by erlang.
the class EditorTracker method addAnnotationsToFile.
/**
* Marks coverage for a specified file.
*
* @param fileName
*/
public void addAnnotationsToFile(final String fileName) {
final IEditorPart currentEditor = workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (currentEditor.getTitle().equals(fileName) && !currentEditor.isDirty()) {
final ModuleStats module = ModuleSet.get(fileName.replace(".erl", ""));
if (module == null || !module.couldBeMarked) {
return;
}
final List<LineResult> list = module.getLineResults();
for (final LineResult lr : list) {
coverage.addAnnotation(fileName, lr, null);
}
annotateEditor(currentEditor);
}
}
use of org.erlide.cover.views.model.LineResult in project erlide_eclipse by erlang.
the class EditorTracker method annotateEditor.
public void annotateEditor(final IWorkbenchPart part) {
if (!(part instanceof ITextEditor)) {
return;
}
final ITextEditor editor = (ITextEditor) part;
log.info(editor.getTitle());
if (!coverage.containsFile(editor.getTitle())) {
return;
}
log.info(coverage);
final Set<LineResult> list = coverage.getLineSet(editor.getTitle());
for (final LineResult lr : list) {
if (lr.getLineNum() == 0) {
continue;
}
markLine(editor, lr);
}
}
use of org.erlide.cover.views.model.LineResult in project erlide_eclipse by erlang.
the class EditorTracker method createAnnotationMap.
private void createAnnotationMap() {
final Iterator<ModuleStats> it = ModuleSet.iterator();
while (it.hasNext()) {
final ModuleStats module = it.next();
if (!module.couldBeMarked) {
continue;
}
final List<LineResult> list = module.getLineResults();
final String modName = module.getLabel() + ".erl";
for (final LineResult lr : list) {
coverage.addAnnotation(modName, lr, null);
}
}
}
Aggregations