Search in sources :

Example 1 with IConfiguration

use of org.erlide.cover.api.IConfiguration in project erlide_eclipse by erlang.

the class CoverEventHandler method addModuleToTree.

// adds module to the statistics tree
private void addModuleToTree(final ModuleStats moduleStats) {
    ICoverageObject root = StatsTreeModel.getInstance().getRoot();
    final IConfiguration config = CoveragePerformer.getPerformer().getConfig();
    final String ppath = ErlangEngine.getInstance().getModelUtilService().getProject(config.getProject()).getWorkspaceProject().getLocation().toString();
    String mpath = config.getModule(moduleStats.getLabel()).getFilePath();
    mpath = mpath.substring(ppath.length());
    log.info(ppath);
    log.info(mpath);
    final String[] parts = mpath.split("/");
    root.setLiniesCount(root.getLinesCount() + moduleStats.getLinesCount());
    root.setCoverCount(root.getCoverCount() + moduleStats.getCoverCount());
    for (int i = 1; i < parts.length - 1; i++) {
        ICoverageObject tmp = root.findChild(parts[i]);
        if (tmp == null) {
            tmp = new StatsTreeObject(ObjectType.FOLDER);
            tmp.setLabel(parts[i]);
        }
        tmp.setLiniesCount(tmp.getLinesCount() + moduleStats.getLinesCount());
        tmp.setCoverCount(tmp.getCoverCount() + moduleStats.getCoverCount());
        root.addChild(parts[i], tmp);
        root = tmp;
    }
    root.addChild(moduleStats.getLabel(), moduleStats);
}
Also used : ICoverageObject(org.erlide.cover.views.model.ICoverageObject) StatsTreeObject(org.erlide.cover.views.model.StatsTreeObject) IConfiguration(org.erlide.cover.api.IConfiguration)

Example 2 with IConfiguration

use of org.erlide.cover.api.IConfiguration in project erlide_eclipse by erlang.

the class CoverRunner method run.

@Override
public void run() {
    final CoverBackend backend = CoverBackend.getInstance();
    try {
        CoverRunner.semaphore.acquireUninterruptibly();
        final IConfiguration config = backend.getSettings().getConfig();
        CoverageAnalysis.prepareAnalysis(config);
        runTests(config);
        CoverageAnalysis.performAnalysis();
    } catch (final Exception e) {
        ErlLogger.error(e);
        backend.handleError("Exception while running cover: " + e);
    } finally {
        CoverRunner.semaphore.release();
    }
}
Also used : IConfiguration(org.erlide.cover.api.IConfiguration) RpcException(org.erlide.runtime.rpc.RpcException)

Aggregations

IConfiguration (org.erlide.cover.api.IConfiguration)2 ICoverageObject (org.erlide.cover.views.model.ICoverageObject)1 StatsTreeObject (org.erlide.cover.views.model.StatsTreeObject)1 RpcException (org.erlide.runtime.rpc.RpcException)1