Search in sources :

Example 1 with CoverageDataManager

use of com.intellij.coverage.CoverageDataManager 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 CoverageDataManager

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

the class TrackCoverageAction method selectSubCoverage.

private void selectSubCoverage() {
    final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(myProperties.getProject());
    final CoverageSuitesBundle currentSuite = coverageDataManager.getCurrentSuitesBundle();
    if (currentSuite != null) {
        final AbstractTestProxy test = myModel.getTreeView().getSelectedTest();
        List<String> testMethods = new ArrayList<>();
        if (test != null && !test.isInProgress()) {
            final List<? extends AbstractTestProxy> list = test.getAllTests();
            for (AbstractTestProxy proxy : list) {
                final Location location = proxy.getLocation(myProperties.getProject(), myProperties.getScope());
                if (location != null) {
                    final PsiElement element = location.getPsiElement();
                    final String name = currentSuite.getCoverageEngine().getTestMethodName(element, proxy);
                    if (name != null) {
                        testMethods.add(name);
                    }
                }
            }
        }
        coverageDataManager.selectSubCoverage(currentSuite, testMethods);
    }
}
Also used : ArrayList(java.util.ArrayList) AbstractTestProxy(com.intellij.execution.testframework.AbstractTestProxy) CoverageDataManager(com.intellij.coverage.CoverageDataManager) CoverageSuitesBundle(com.intellij.coverage.CoverageSuitesBundle) PsiElement(com.intellij.psi.PsiElement) Location(com.intellij.execution.Location)

Aggregations

CoverageDataManager (com.intellij.coverage.CoverageDataManager)2 CoverageSuitesBundle (com.intellij.coverage.CoverageSuitesBundle)2 ExportToHTMLDialog (com.intellij.codeInspection.export.ExportToHTMLDialog)1 CoverageEngine (com.intellij.coverage.CoverageEngine)1 Location (com.intellij.execution.Location)1 AbstractTestProxy (com.intellij.execution.testframework.AbstractTestProxy)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Project (com.intellij.openapi.project.Project)1 PsiElement (com.intellij.psi.PsiElement)1 ArrayList (java.util.ArrayList)1