void (@NotNull AnActionEvent event) { final Project project = event.getProject(); LOG.assertTrue(project != null); final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, false){ @Override public Icon getIcon(VirtualFile file) { if (file.isDirectory() && file.findChild(InspectionsResultUtil.DESCRIPTIONS + "." + StdFileTypes.XML.getDefaultExtension()) != null) { return AllIcons.Nodes.InspectionResults; } return super.getIcon(file); } }.withFileFilter(f -> f.isDirectory() || StdFileTypes.XML.getDefaultExtension().equals(f.getExtension())) .withTitle(InspectionsBundle.message("view.offline.inspections.select.path.title")) .withDescription(InspectionsBundle.message("view.offline.inspections.select.path.description")); final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null); if (virtualFile == null) return; final Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap = new HashMap<>(); final String [] profileName = new String[1]; ProgressManager.getInstance().run(new Task.Backgroundable(project, InspectionsBundle.message("parsing.inspections.dump.progress.title"), true, new PerformAnalysisInBackgroundOption(project)) { @Override public void run(@NotNull ProgressIndicator indicator) { //for non project directories ensure refreshed directory VfsUtil.markDirtyAndRefresh(false, true, true, virtualFile); final VirtualFile[] files = virtualFile.isDirectory() ? virtualFile.getChildren() : new VirtualFile[] {virtualFile}; try { for (final VirtualFile inspectionFile : files) { if (inspectionFile.isDirectory()) continue; final String shortName = inspectionFile.getNameWithoutExtension(); final String extension = inspectionFile.getExtension(); Path inspectionIoFile = inspectionFile.toNioPath(); try { if (shortName.equals(InspectionsResultUtil.DESCRIPTIONS)) { profileName[0] = ReadAction.compute(() -> OfflineViewParseUtil.parseProfileName(inspectionIoFile)); } else if (StdFileTypes.XML.getDefaultExtension().equals(extension)) { resMap.put(shortName, ReadAction.compute(() -> OfflineViewParseUtil.parse(inspectionIoFile))); } } catch (Exception e) { throw new RuntimeException("Can't read file: " + inspectionFile.getName(), e); } } if (profileName[0] == null) { profileName[0] = virtualFile.getNameWithoutExtension(); } } catch (final Exception e) { //all parse exceptions ApplicationManager.getApplication() .invokeLater(() -> Messages.showInfoMessage(ExceptionUtil.getThrowableText(e), InspectionsBundle.message("offline.view.parse.exception.title"))); throw new ProcessCanceledException(e); //cancel process } } @Override public void onSuccess() { if (resMap.isEmpty()) return; DumbService.getInstance(project).smartInvokeLater(() -> { final String name = profileName[0]; LOG.assertTrue(name != null); showOfflineView(project, name, resMap, InspectionsBundle.message("offline.view.title") + " (" + name + ")"); }); } }); }