use of com.intellij.coverage.CoverageSuitesBundle 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);
}
use of com.intellij.coverage.CoverageSuitesBundle 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);
}
}
}
}
use of com.intellij.coverage.CoverageSuitesBundle in project intellij-community by JetBrains.
the class ShowCoveringTestsAction method getTraceFiles.
@Nullable
private static File[] getTraceFiles(Project project) {
final CoverageSuitesBundle currentSuite = CoverageDataManager.getInstance(project).getCurrentSuitesBundle();
if (currentSuite == null)
return null;
final List<File> files = new ArrayList<>();
for (CoverageSuite coverageSuite : currentSuite.getSuites()) {
final String filePath = coverageSuite.getCoverageDataFileName();
final String dirName = FileUtil.getNameWithoutExtension(new File(filePath).getName());
final File parentDir = new File(filePath).getParentFile();
final File tracesDir = new File(parentDir, dirName);
final File[] suiteFiles = tracesDir.listFiles();
if (suiteFiles != null) {
Collections.addAll(files, suiteFiles);
}
}
return files.isEmpty() ? null : files.toArray(new File[files.size()]);
}
use of com.intellij.coverage.CoverageSuitesBundle 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);
}
}
use of com.intellij.coverage.CoverageSuitesBundle in project intellij-community by JetBrains.
the class SelectInCoverageView method selectIn.
public void selectIn(final SelectInContext context, final boolean requestFocus) {
final CoverageSuitesBundle suitesBundle = CoverageDataManager.getInstance(myProject).getCurrentSuitesBundle();
if (suitesBundle != null) {
final CoverageViewManager coverageViewManager = CoverageViewManager.getInstance(myProject);
final CoverageView coverageView = coverageViewManager.getToolwindow(suitesBundle);
coverageView.select(context.getVirtualFile());
coverageViewManager.activateToolwindow(coverageView, requestFocus);
}
}
Aggregations