if (fileToImport == null || fileToImport.trim().isEmpty()) {
return;
}
final FindBugsPlugin findBugsPlugin = getPluginInterface(project);
final BugCollection bugCollection = findBugsPlugin.getToolWindowPanel().getBugCollection();
if (bugCollection != null && !bugCollection.getCollection().isEmpty()) {
//noinspection DialogTitleCapitalization
final int result = Messages.showYesNoDialog(project, "Current result in the 'Found bugs view' will be deleted. Continue ?", "Delete found bugs?", Messages.getQuestionIcon());
if (result == 1) {
return;
}
}
//Create a task to export the bug collection to html
final AtomicReference<Task> importTask = new AtomicReference<Task>(new BackgroundableTask(project, "Importing Findbugs Result", true) {
private ProgressIndicator _indicator;
@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"})
@Override
public void run(@NotNull final ProgressIndicator indicator) {
EventManagerImpl.getInstance().fireEvent(new BugReporterEventImpl(Operation.ANALYSIS_STARTED, null, 0, project.getName()));
setProgressIndicator(indicator);
indicator.setFraction(0.0);
indicator.setIndeterminate(false);
indicator.setText(fileToImport);
try {
_bugCollection = new SortedBugCollection();
final FindBugsPlugin pluginComponent = IdeaUtilImpl.getPluginComponent(project);
_importBugCollection = _bugCollection.createEmptyCollectionWithMetadata();
final edu.umd.cs.findbugs.Project importProject = _importBugCollection.getProject();
importProject.setGuiCallback(new PluginGuiCallback(pluginComponent));
_importBugCollection.setDoNotUseCloud(true);
for (final Plugin plugin : Plugin.getAllPlugins()) {