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"));
}
});
}
Aggregations