@Override
protected void perform(final StatsTreeObject selection) {
if (selection instanceof ModuleStats) {
final ModuleStats module = (ModuleStats) selection;
final String name = module.getLabel() + ".erl";
if (ifMarkAnnotations(module)) {
module.couldBeMarked = true;
marker.addAnnotationsToFile(name);
}
} else if (selection instanceof FunctionStats) {
final FunctionStats fs = (FunctionStats) selection;
final ModuleStats module = (ModuleStats) fs.getParent();
final String name = module.getLabel() + ".erl";
if (ifMarkAnnotations(module)) {
log.info(fs.getLineStart());
log.info(fs.getLineEnd());
module.couldBeMarked = true;
marker.addAnnotationsFragment(name, fs.getLineStart(), fs.getLineEnd());
}
} else if (selection.equals(StatsTreeModel.getInstance().getRoot())) {
// TODO: check annotation tree, only if root mark all annotations
final Collection<ICoverageObject> col = selection.getModules();
for (final ICoverageObject module : col) {
if (ifMarkAnnotations((ModuleStats) module)) {
((ModuleStats) module).couldBeMarked = true;
} else {
((ModuleStats) module).couldBeMarked = false;
}
}
marker.addAnnotations();
} else {
final Collection<ICoverageObject> col = selection.getModules();
for (final ICoverageObject module : col) {
if (ifMarkAnnotations((ModuleStats) module)) {
final String name = module.getLabel() + ".erl";
((ModuleStats) module).couldBeMarked = true;
marker.addAnnotationsToFile(name);
}
}
}