/** * ファイル一覧をチェックしてマーカーを作成します。 * * @param env * @param files ファイル一覧 * @param monitor 遷移モニタ * @return 処理に成功したらtrue */ private boolean markAll(LimyQalabEnvironment env, String[] files, IProgressMonitor monitor) { IFindBugsEngine engine = getEngine(env.getProject(), monitor); try { LimyBugReporter reporter = new LimyBugReporter(env); reporter.setPriorityThreshold(Detector.LOW_PRIORITY); engine.setBugReporter(reporter); Project findbugsProject = new Project(); for (String file : files) { findbugsProject.addFile(file); } engine.setProject(findbugsProject); engine.execute(); return true; } catch (IOException e) { LimyEclipsePluginUtils.log(e); } catch (InterruptedException e) { LimyEclipsePluginUtils.log(e); } return false; }
/** * @param resource * @param monitor * @return */ private IFindBugsEngine getEngine(IResource resource, IProgressMonitor monitor) { IFindBugsEngine engine = engines.get(resource.getProject()); if (engine != null) { return engine; } IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); subMonitor.subTask("Creating Findbugs-engine for " + resource.getProject().getName()); engine = new FindBugs2(); engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); engine.setUserPreferences(UserPreferences.createDefaultUserPreferences()); engines.put(resource.getProject(), engine); subMonitor.done(); return engine; }