public static void processGatheredCoverage(RunConfigurationBase configuration) {
   final Project project = configuration.getProject();
   if (project.isDisposed()) return;
   final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(project);
   final CoverageEnabledConfiguration coverageEnabledConfiguration =
       CoverageEnabledConfiguration.getOrCreate(configuration);
   //noinspection ConstantConditions
   final CoverageSuite coverageSuite = coverageEnabledConfiguration.getCurrentCoverageSuite();
   if (coverageSuite != null) {
     ((BaseCoverageSuite) coverageSuite).setConfiguration(configuration);
     coverageDataManager.coverageGathered(coverageSuite);
   }
 }
  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    writeModule(element);

    XmlSerializer.serializeInto(this, element);

    CoverageEnabledConfiguration coverageEnabledConfiguration =
        DotNetCoverageEnabledConfiguration.get(this);
    Element coverageElement = new Element("coverage");
    coverageEnabledConfiguration.writeExternal(coverageElement);
    element.addContent(coverageElement);
  }
  @Override
  public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);
    readModule(element);

    XmlSerializer.deserializeInto(this, element);

    Element coverageElement = element.getChild("coverage");
    if (coverageElement != null) {
      CoverageEnabledConfiguration coverageEnabledConfiguration =
          DotNetCoverageEnabledConfiguration.get(this);
      coverageEnabledConfiguration.readExternal(coverageElement);
    }
  }
  @Override
  public CoverageSuite addCoverageSuite(final CoverageEnabledConfiguration config) {
    final String name = config.getName() + " Coverage Results";
    final String covFilePath = config.getCoverageFilePath();
    assert covFilePath != null; // Shouldn't be null here!

    final CoverageRunner coverageRunner = config.getCoverageRunner();
    LOG.assertTrue(coverageRunner != null, "Coverage runner id = " + config.getRunnerId());

    final DefaultCoverageFileProvider fileProvider =
        new DefaultCoverageFileProvider(new File(covFilePath));
    final CoverageSuite suite = createCoverageSuite(config, name, coverageRunner, fileProvider);

    // remove previous instance
    removeCoverageSuite(suite);

    // add new instance
    myCoverageSuites.add(suite);
    return suite;
  }
 @NotNull
 private CoverageSuite createCoverageSuite(
     final CoverageEnabledConfiguration config,
     final String name,
     final CoverageRunner coverageRunner,
     final DefaultCoverageFileProvider fileProvider) {
   CoverageSuite suite = null;
   for (CoverageEngine engine : CoverageEngine.EP_NAME.getExtensions()) {
     if (coverageRunner.acceptsCoverageEngine(engine)
         && engine.isApplicableTo(config.getConfiguration())) {
       suite = engine.createCoverageSuite(coverageRunner, name, fileProvider, config);
       if (suite != null) {
         break;
       }
     }
   }
   LOG.assertTrue(
       suite != null,
       "Cannot create coverage suite for runner: " + coverageRunner.getPresentableName());
   return suite;
 }