use of org.erlide.cover.views.model.StatsTreeModel in project erlide_eclipse by erlang.
the class CoveragePerformer method startCover.
/**
* Start cover
*/
@Override
public synchronized void startCover(final Collection<String> nodes) throws CoverException {
final StatsTreeModel model = StatsTreeModel.getInstance();
model.clear();
if (CoverBackend.getInstance().getAnnotationMaker() != null) {
CoverBackend.getInstance().getAnnotationMaker().clearAllAnnotations();
}
for (final ICoverObserver obs : CoverBackend.getInstance().getListeners()) {
obs.eventOccured(new CoverEvent(CoverStatus.UPDATE));
}
boolean different = false;
for (final String node : nodes) {
if (!coverNodes.contains(node)) {
different = true;
break;
}
}
if (coverNodes.isEmpty() || different) {
coverNodes = nodes;
log.info(CoverBackend.getInstance().getBackend().getName());
coverNodes.add(CoverBackend.getInstance().getBackend().getName());
// TODO restarting
final List<OtpErlangObject> names = new ArrayList<>(coverNodes.size());
for (final String name : coverNodes) {
names.add(new OtpErlangAtom(name));
}
final OtpErlangList nodesList = new OtpErlangList(names.toArray(new OtpErlangObject[0]));
try {
CoverBackend.getInstance().getBackend().getOtpRpc().call(CoverConstants.COVER_ERL_BACKEND, CoverConstants.FUN_START, "x", nodesList);
} catch (final RpcException e) {
ErlLogger.error(e);
throw new CoverException(e.getMessage());
}
}
}
Aggregations