Search in sources :

Example 1 with ExportToHTMLDialog

use of com.intellij.codeInspection.export.ExportToHTMLDialog 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 ExportToHTMLDialog

use of com.intellij.codeInspection.export.ExportToHTMLDialog in project intellij-community by JetBrains.

the class ExportHTMLAction method exportHTML.

private void exportHTML(final boolean exportToHTML) {
    ExportToHTMLDialog exportToHTMLDialog = new ExportToHTMLDialog(myView.getProject(), exportToHTML);
    final ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myView.getProject());
    if (exportToHTMLSettings.OUTPUT_DIRECTORY == null) {
        exportToHTMLSettings.OUTPUT_DIRECTORY = PathManager.getHomePath() + File.separator + "inspections";
    }
    exportToHTMLDialog.reset();
    if (!exportToHTMLDialog.showAndGet()) {
        return;
    }
    exportToHTMLDialog.apply();
    final String outputDirectoryName = exportToHTMLSettings.OUTPUT_DIRECTORY;
    ApplicationManager.getApplication().invokeLater(() -> {
        final Runnable exportRunnable = () -> ApplicationManager.getApplication().runReadAction(() -> {
            if (!exportToHTML) {
                dump2xml(outputDirectoryName);
            } else {
                try {
                    new InspectionTreeHtmlWriter(myView, outputDirectoryName);
                } catch (ProcessCanceledException e) {
                // Do nothing here.
                }
            }
        });
        if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(exportRunnable, InspectionsBundle.message(exportToHTML ? "inspection.generating.html.progress.title" : "inspection.generating.xml.progress.title"), true, myView.getProject())) {
            return;
        }
        if (exportToHTML && exportToHTMLSettings.OPEN_IN_BROWSER) {
            BrowserUtil.browse(new File(exportToHTMLSettings.OUTPUT_DIRECTORY, "index.html"));
        }
    });
}
Also used : InspectionTreeHtmlWriter(com.intellij.codeInspection.export.InspectionTreeHtmlWriter) ExportToHTMLDialog(com.intellij.codeInspection.export.ExportToHTMLDialog) File(java.io.File) ExportToHTMLSettings(com.intellij.codeEditor.printing.ExportToHTMLSettings) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Example 3 with ExportToHTMLDialog

use of com.intellij.codeInspection.export.ExportToHTMLDialog in project intellij-community by JetBrains.

the class CoverageEngine method createGenerateReportDialog.

@NotNull
public ExportToHTMLDialog createGenerateReportDialog(@NotNull final Project project, @NotNull final DataContext dataContext, @NotNull final CoverageSuitesBundle currentSuite) {
    final ExportToHTMLDialog dialog = new ExportToHTMLDialog(project, true);
    dialog.setTitle("Generate Coverage Report for: \'" + currentSuite.getPresentableName() + "\'");
    return dialog;
}
Also used : ExportToHTMLDialog(com.intellij.codeInspection.export.ExportToHTMLDialog) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ExportToHTMLDialog (com.intellij.codeInspection.export.ExportToHTMLDialog)3 ExportToHTMLSettings (com.intellij.codeEditor.printing.ExportToHTMLSettings)1 InspectionTreeHtmlWriter (com.intellij.codeInspection.export.InspectionTreeHtmlWriter)1 CoverageDataManager (com.intellij.coverage.CoverageDataManager)1 CoverageEngine (com.intellij.coverage.CoverageEngine)1 CoverageSuitesBundle (com.intellij.coverage.CoverageSuitesBundle)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 Project (com.intellij.openapi.project.Project)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1