@SuppressFBWarnings("SIC_INNER_SHOULD_BE_STATIC_ANON") @Override void analyze( @NotNull final AnActionEvent e, @NotNull final Project project, @Nullable final Module module, @NotNull final FindBugsPlugin plugin, @NotNull final ToolWindow toolWindow, @NotNull final FindBugsState state, @NotNull final FindBugsPreferences preferences) { final VirtualFile[] files = IdeaUtilImpl.getProjectClasspath(e.getDataContext()); final List<VirtualFile> modifiedFiles = IdeaUtilImpl.getAllModifiedFiles(e.getDataContext()); new FindBugsStarter(project, "Running FindBugs analysis for modified files...", preferences) { @Override protected void createCompileScope( @NotNull final CompilerManager compilerManager, @NotNull final Consumer<CompileScope> consumer) { consumer.consume(createFilesCompileScope(modifiedFiles)); } @Override protected void configure( @NotNull final ProgressIndicator indicator, @NotNull final FindBugsProject findBugsProject) { findBugsProject.configureAuxClasspathEntries(indicator, files); findBugsProject.configureSourceDirectories(indicator, modifiedFiles); findBugsProject.configureOutputFiles(project, modifiedFiles); } }.start(); }
@Override void updateImpl( @NotNull final AnActionEvent e, @NotNull final Project project, @Nullable final Module module, @NotNull final FindBugsPlugin plugin, @NotNull final ToolWindow toolWindow, @NotNull final FindBugsState state, @NotNull final FindBugsPreferences preferences) { boolean enable = false; final List<VirtualFile> modifiedFiles = IdeaUtilImpl.getAllModifiedFiles(e.getDataContext()); if (state.isIdle() && !modifiedFiles.isEmpty()) { for (final VirtualFile virtualFile : modifiedFiles) { if (IdeaUtilImpl.isValidFileType(virtualFile.getFileType())) { enable = true; break; } } } e.getPresentation().setEnabled(enable); e.getPresentation().setVisible(true); }