Search in sources :

Example 1 with InspectionTreeHtmlWriter

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

Aggregations

ExportToHTMLSettings (com.intellij.codeEditor.printing.ExportToHTMLSettings)1 ExportToHTMLDialog (com.intellij.codeInspection.export.ExportToHTMLDialog)1 InspectionTreeHtmlWriter (com.intellij.codeInspection.export.InspectionTreeHtmlWriter)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 File (java.io.File)1