Search in sources :

Example 1 with CoverageEngine

use of com.intellij.coverage.CoverageEngine in project intellij-community by JetBrains.

the class GenerateCoverageReportAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    final Project project = e.getProject();
    assert project != null;
    final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(project);
    final CoverageSuitesBundle currentSuite = coverageDataManager.getCurrentSuitesBundle();
    final CoverageEngine coverageEngine = currentSuite.getCoverageEngine();
    final ExportToHTMLDialog dialog = coverageEngine.createGenerateReportDialog(project, dataContext, currentSuite);
    dialog.reset();
    if (!dialog.showAndGet()) {
        return;
    }
    dialog.apply();
    coverageEngine.generateReport(project, dataContext, currentSuite);
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) ExportToHTMLDialog(com.intellij.codeInspection.export.ExportToHTMLDialog) CoverageDataManager(com.intellij.coverage.CoverageDataManager) CoverageEngine(com.intellij.coverage.CoverageEngine) CoverageSuitesBundle(com.intellij.coverage.CoverageSuitesBundle)

Example 2 with CoverageEngine

use of com.intellij.coverage.CoverageEngine in project intellij-community by JetBrains.

the class GenerateCoverageReportAction method update.

public void update(final AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    final Presentation presentation = e.getPresentation();
    presentation.setEnabled(false);
    presentation.setVisible(false);
    final Project project = e.getProject();
    if (project != null) {
        final CoverageSuitesBundle currentSuite = CoverageDataManager.getInstance(project).getCurrentSuitesBundle();
        if (currentSuite != null) {
            final CoverageEngine coverageEngine = currentSuite.getCoverageEngine();
            if (coverageEngine.isReportGenerationAvailable(project, dataContext, currentSuite)) {
                presentation.setEnabled(true);
                presentation.setVisible(true);
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) Presentation(com.intellij.openapi.actionSystem.Presentation) CoverageEngine(com.intellij.coverage.CoverageEngine) CoverageSuitesBundle(com.intellij.coverage.CoverageSuitesBundle)

Example 3 with CoverageEngine

use of com.intellij.coverage.CoverageEngine in project intellij-community by JetBrains.

the class PercentageCoverageColumnInfo method valueOf.

@Override
public String valueOf(NodeDescriptor node) {
    final CoverageEngine coverageEngine = mySuitesBundle.getCoverageEngine();
    final Project project = node.getProject();
    return coverageEngine.createCoverageViewExtension(project, mySuitesBundle, myStateBean).getPercentage(myColumnIdx, (AbstractTreeNode) node);
}
Also used : Project(com.intellij.openapi.project.Project) CoverageEngine(com.intellij.coverage.CoverageEngine)

Example 4 with CoverageEngine

use of com.intellij.coverage.CoverageEngine in project intellij-community by JetBrains.

the class CoverageEnabledConfiguration method getOrCreate.

@NotNull
public static CoverageEnabledConfiguration getOrCreate(@NotNull final RunConfigurationBase runConfiguration) {
    CoverageEnabledConfiguration configuration = runConfiguration.getCopyableUserData(COVERAGE_KEY);
    if (configuration == null) {
        for (CoverageEngine engine : CoverageEngine.EP_NAME.getExtensions()) {
            if (engine.isApplicableTo(runConfiguration)) {
                configuration = engine.createCoverageEnabledConfiguration(runConfiguration);
                break;
            }
        }
        LOG.assertTrue(configuration != null, "Coverage enabled run configuration wasn't found for run configuration: " + runConfiguration.getName() + ", type = " + runConfiguration.getClass().getName());
        runConfiguration.putCopyableUserData(COVERAGE_KEY, configuration);
    }
    return configuration;
}
Also used : CoverageEngine(com.intellij.coverage.CoverageEngine) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CoverageEngine (com.intellij.coverage.CoverageEngine)4 Project (com.intellij.openapi.project.Project)3 CoverageSuitesBundle (com.intellij.coverage.CoverageSuitesBundle)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 ExportToHTMLDialog (com.intellij.codeInspection.export.ExportToHTMLDialog)1 CoverageDataManager (com.intellij.coverage.CoverageDataManager)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 NotNull (org.jetbrains.annotations.NotNull)1