public boolean markResources( LimyQalabEnvironment env, Collection<IResource> resources, IProgressMonitor monitor) { try { IProject project = env.getProject(); File binDir = new File(project.getLocation().toFile(), ".bin"); FileUtils.deleteDirectory(binDir); for (IResource resource : resources) { ResourceWithBasedir classResource = QalabResourceUtils.getClassResource(env, resource); // /javatest/bin/AdBean.class String fullPath = classResource.getResource().getFullPath().toString(); // /javatest/bin String baseDir = classResource.getBaseDir().toString(); // /AdBean.class String relativePath = fullPath.substring(baseDir.length() + 1); File classFile = new File(binDir, relativePath); classFile.getParentFile().mkdirs(); FileUtils.copyFile(classResource.getResource().getLocation().toFile(), classFile); } return markAll(env, new String[] {binDir.getAbsolutePath()}, monitor); } catch (CoreException e) { LimyEclipsePluginUtils.log(e); } catch (IOException e) { LimyEclipsePluginUtils.log(e); } return false; }
/** * ファイル一覧をチェックしてマーカーを作成します。 * * @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; }
public boolean markResource( LimyQalabEnvironment env, IResource resource, IProgressMonitor monitor) { try { ResourceWithBasedir classResource = QalabResourceUtils.getClassResource(env, resource); if (classResource == null) { LimyEclipsePluginUtils.log("Not found class file for " + resource); } else { String file = classResource.getResource().getLocation().toString(); return markAll(env, new String[] {file}, monitor); } } catch (CoreException e) { LimyEclipsePluginUtils.log(e); } return false; }
public boolean markResourceTemporary( LimyQalabEnvironment env, IResource resource, IProgressMonitor monitor) { try { String file = QalabResourceUtils.getClassResource(env, resource).getResource().getLocation().toString(); return markAll(env, new String[] {file}, monitor); } catch (CoreException e) { LimyEclipsePluginUtils.log(e); } return false; }