本文整理汇总了Java中edu.umd.cs.findbugs.Project类的典型用法代码示例。如果您正苦于以下问题:Java Project类的具体用法?Java Project怎么用?Java Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Project类属于edu.umd.cs.findbugs包,在下文中一共展示了Project类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: adjustFilter
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
void adjustFilter(Project project, BugCollection collection) {
suppressionFilter = project.getSuppressionFilter();
if (maxAgeSpecified) {
minFirstSeen = collection.getAnalysisTimestamp() - maxAge * MILLISECONDS_PER_DAY;
}
first = getVersionNum(collection, firstAsString, true);
maybeMutated = getVersionNum(collection, maybeMutatedAsString, true);
last = getVersionNum(collection, lastAsString, true);
before = getVersionNum(collection, beforeAsString, true);
after = getVersionNum(collection, afterAsString, false);
present = getVersionNum(collection, presentAsString, true);
absent = getVersionNum(collection, absentAsString, true);
if (sloppyUniqueSpecified)
uniqueSloppy = new TreeSet<BugInstance>(new SloppyBugComparator());
long fixed = getVersionNum(collection, fixedAsString, true);
if (fixed >= 0)
last = fixed - 1; // fixed means last on previous sequence (ok
// if -1)
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:23,代码来源:Filter.java
示例2: union
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
static public SortedBugCollection union(SortedBugCollection origCollection, SortedBugCollection newCollection) {
SortedBugCollection result = origCollection.duplicate();
for (Iterator<BugInstance> i = newCollection.iterator(); i.hasNext();) {
BugInstance bugInstance = i.next();
result.add(bugInstance);
}
ProjectStats stats = result.getProjectStats();
ProjectStats stats2 = newCollection.getProjectStats();
stats.addStats(stats2);
Project project = result.getProject();
project.add(newCollection.getProject());
return result;
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:18,代码来源:MergeSummarizeAndView.java
示例3: merge
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
static public void merge(HashSet<String> hashes, SortedBugCollection into, SortedBugCollection from) {
for (BugInstance bugInstance : from.getCollection()) {
if (hashes == null || hashes.add(bugInstance.getInstanceHash()))
into.add(bugInstance);
}
ProjectStats stats = into.getProjectStats();
ProjectStats stats2 = from.getProjectStats();
stats.addStats(stats2);
Project project = into.getProject();
Project project2 = from.getProject();
project.add(project2);
for(AnalysisError error : from.getErrors())
into.addError(error);
return;
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:UnionResults.java
示例4: reloadProjectItemActionPerformed
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
private void reloadProjectItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reloadProjectItemActionPerformed
Project current = getCurrentProject();
if (current == null)
return;
try {
String filename = current.getProjectFileName();
Project project = new Project();
project.read(filename);
setProject(null);
setProject(project);
findBugsButtonActionPerformed(evt);
} catch (IOException e) {
logger.logMessage(Logger.ERROR, "Could not reload project: " + e.getMessage());
}
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:19,代码来源:FindBugsFrame.java
示例5: openProjectItemActionPerformed
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
private void openProjectItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openProjectItemActionPerformed
if (!closeProjectHook(getCurrentProject(), L10N.getLocalString("msg.openproject_txt", "Open Project")))
return;
JFileChooser chooser = createFileChooser();
chooser.setFileFilter(projectFileFilter);
int result = chooseFileToOpen(chooser);
if (result == JFileChooser.CANCEL_OPTION)
return;
try {
File file = chooser.getSelectedFile();
Project project = new Project();
project.read(file.getPath());
setProject(project);
UserPreferences.getUserPreferences().useProject(file.getPath());
rebuildRecentProjectsMenu();
} catch (IOException e) {
logger.logMessage(Logger.ERROR, MessageFormat.format( L10N.getLocalString("msg.couldnotopenproject_txt", "Could not open project: {0}"), new Object[]{e.getMessage()}));
}
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:24,代码来源:FindBugsFrame.java
示例6: openRecentProjectItemActionPerformed
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
private void openRecentProjectItemActionPerformed(java.awt.event.ActionEvent evt) {
if (!closeProjectHook(getCurrentProject(), L10N.getLocalString("msg.openproject_txt", "Open Project")))
return;
JMenuItem recentProjectItem = (JMenuItem) evt.getSource();
File file = new File(recentProjectItem.getText());
try {
System.setProperty("user.dir", file.getParent());
Project project = new Project();
project.read(file.getPath());
setProject(project);
UserPreferences.getUserPreferences().useProject(file.getPath());
} catch (IOException e) {
UserPreferences.getUserPreferences().removeProject(file.getPath());
logger.logMessage(Logger.ERROR, MessageFormat.format(L10N.getLocalString("msg.couldnotopenproject_txt", "Could not open project: {0}"), new Object[]{e.getMessage()}));
} finally {
rebuildRecentProjectsMenu();
}
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:FindBugsFrame.java
示例7: setProject
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
private void setProject(Project project) {
currentProject = project;
if (project != null) {
synchProject(project);
setView("EditProjectPanel");
editMenu.setEnabled(true);
viewProjectItem.setEnabled(true);
viewProjectItem.setSelected(true);
viewBugsItem.setEnabled(false);
viewBugsItem.setSelected(false);
} else {
editMenu.setEnabled(false);
viewProjectItem.setEnabled(false);
viewProjectItem.setSelected(false);
viewBugsItem.setEnabled(false);
viewBugsItem.setSelected(false);
setView("EmptyPanel");
}
updateTitle(project);
ableEditMenu();
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:FindBugsFrame.java
示例8: closeProjectHook
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
/**
* Hook to call before closing a project.
*
* @param project the project being closed
* @param savePromptTitle title to use for the "Save project?" dialog
* @return true if user has confirmed that the project should be closed,
* false if the close is cancelled
*/
private boolean closeProjectHook(Project project, String savePromptTitle) {
if (project == null || !project.isModified())
return true;
// Confirm that the project should be closed.
int option = JOptionPane.showConfirmDialog(this, L10N.getLocalString("msg.saveprojectquery_txt", "Save Project?"), savePromptTitle,
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (option == JOptionPane.CANCEL_OPTION)
return false;
else if (option == JOptionPane.YES_OPTION) {
boolean result = saveProject(project, "Save Project");
if (result)
JOptionPane.showMessageDialog(this, "Project was successfully saved.");
return result;
} else
return true;
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:27,代码来源:FindBugsFrame.java
示例9: AnalysisRun
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
/**
* Creates a new instance of AnalysisRun.
*/
public AnalysisRun(Project project, FindBugsFrame frame) {
this.frame = frame;
this.logger = frame.getLogger();
this.reporter = new SwingGUIBugReporter(this);
this.reporter.setPriorityThreshold(Detector.EXP_PRIORITY);
// Create IFindBugsEngine
FindBugs2 engine = new FindBugs2();
engine.setBugReporter(reporter);
engine.setProject(project);
engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance());
this.findBugs = engine;
this.treeModelMap = new HashMap<String, DefaultTreeModel>();
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:19,代码来源:AnalysisRun.java
示例10: doAnalysis
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
/**
* Performs an analysis and returns the BugSet created
*
* @param p
* The Project to run the analysis on
* @param progressCallback
* the progressCallBack is supposed to be supplied by analyzing
* dialog, FindBugs supplies progress information while it runs
* the analysis
* @return the bugs found
* @throws InterruptedException
* @throws IOException
*/
public static BugCollection doAnalysis(@Nonnull Project p, FindBugsProgress progressCallback) throws IOException,
InterruptedException {
StringWriter stringWriter = new StringWriter();
BugCollectionBugReporter pcb = new BugCollectionBugReporter(p, new PrintWriter(stringWriter, true));
pcb.setPriorityThreshold(Priorities.NORMAL_PRIORITY);
IFindBugsEngine fb = createEngine(p, pcb);
fb.setUserPreferences(getUserPreferences());
fb.setProgressCallback(progressCallback);
fb.setProjectName(p.getProjectName());
fb.execute();
String warnings = stringWriter.toString();
if (warnings.length() > 0) {
JTextArea tp = new JTextArea(warnings);
tp.setEditable(false);
JScrollPane pane = new JScrollPane(tp);
pane.setPreferredSize(new Dimension(600, 400));
JOptionPane.showMessageDialog(MainFrame.getInstance(),
pane, "Analysis errors",
JOptionPane.WARNING_MESSAGE);
}
return pcb.getBugCollection();
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:38,代码来源:BugLoader.java
示例11: loadBugs
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
public static @CheckForNull
SortedBugCollection loadBugs(MainFrame mainFrame, Project project, File source) {
if (!source.isFile() || !source.canRead()) {
JOptionPane.showMessageDialog(mainFrame, "Unable to read " + source);
return null;
}
SortedBugCollection col = new SortedBugCollection(project);
try {
col.readXML(source);
initiateCommunication(col);
if (col.hasDeadBugs()) {
addDeadBugMatcher(col);
}
} catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(mainFrame, "Could not read " + source + "; " + e.getMessage());
}
MainFrame.getInstance().setProjectAndBugCollectionInSwingThread(project, col);
return col;
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:BugLoader.java
示例12: AnalyzingDialog
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
public AnalyzingDialog(@Nonnull final Project project) {
this(project, new AnalysisCallback() {
public void analysisFinished(BugCollection results) {
MainFrame instance = MainFrame.getInstance();
assert results.getProject() == project;
instance.setBugCollection(results);
try {
instance.releaseDisplayWait();
} catch (Exception e) {
Logger.getLogger(AnalyzingDialog.class.getName()).log(Level.FINE, "", e);
}
results.reinitializeCloud();
}
public void analysisInterrupted() {
MainFrame instance = MainFrame.getInstance();
instance.updateProjectAndBugCollection(null);
instance.releaseDisplayWait();
}
}, false);
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:AnalyzingDialog.java
示例13: redoAnalysis
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
void redoAnalysis() {
if (!canNavigateAway())
return;
/// QQQ-TODO: new RuntimeException("Redo analysis called").printStackTrace();
acquireDisplayWait();
edu.umd.cs.findbugs.util.Util.runInDameonThread(
new Runnable() {
public void run() {
try {
updateDesignationDisplay();
Project project = getProject();
BugCollection bc = BugLoader.redoAnalysisKeepComments(project);
updateProjectAndBugCollection(bc);
setProjectAndBugCollectionInSwingThread(project, bc);
} finally {
releaseDisplayWait();
}
}
});
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:MainFrame.java
示例14: loadAnalysis
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
void loadAnalysis(final File file) {
Runnable runnable = new Runnable() {
public void run() {
mainFrame.acquireDisplayWait();
try {
Project project = new Project();
project.setGuiCallback(mainFrame.getGuiCallback());
project.setCurrentWorkingDirectory(file.getParentFile());
BugLoader.loadBugs(mainFrame, project, file);
project.getSourceFinder(); // force source finder to be
// initialized
mainFrame.updateBugTree();
} finally {
mainFrame.releaseDisplayWait();
}
}
};
if (EventQueue.isDispatchThread())
new Thread(runnable, "Analysis loading thread").start();
else
runnable.run();
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:24,代码来源:MainFrameLoadSaveHelper.java
示例15: loadXml
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
/**
* Load existing FindBugs xml report for the given collection of files.
*
* @param fileName
* xml file name to load bugs from
* @throws CoreException
*/
public void loadXml(String fileName) throws CoreException {
if (fileName == null) {
return;
}
st = new StopTimer();
// clear markers
clearMarkers(null);
final Project findBugsProject = new Project();
final Reporter bugReporter = new Reporter(javaProject, findBugsProject, monitor);
bugReporter.setPriorityThreshold(userPrefs.getUserDetectorThreshold());
reportFromXml(fileName, findBugsProject, bugReporter);
// Merge new results into existing results.
updateBugCollection(findBugsProject, bugReporter, false);
monitor.done();
}
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:26,代码来源:FindBugsWorker.java
示例16: addFilesToProject
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
public void addFilesToProject(Project fbProject, Map<IPath, IPath> outputLocations) {
IResource res = getCorespondingResource();
if (res instanceof IProject) {
for (IPath outDir : outputLocations.values()) {
fbProject.addFile(outDir.toOSString());
}
} else if (res instanceof IFolder) {
// assumption: this is a source folder.
boolean added = addClassesForFolder((IFolder) res, outputLocations, fbProject);
if (!added) {
// What if this is a class folder???
addJavaElementPath(fbProject);
}
} else if (res instanceof IFile) {
// ID: 2734173: allow to analyze classes inside archives
if (Util.isClassFile(res) || Util.isJavaArchive(res)) {
fbProject.addFile(res.getLocation().toOSString());
} else if (Util.isJavaFile(res)) {
addClassesForFile((IFile) res, outputLocations, fbProject);
}
} else {
addJavaElementPath(fbProject);
}
}
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:25,代码来源:WorkItem.java
示例17: addClassesForFile
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
private static void addClassesForFile(IFile file, Map<IPath, IPath> outLocations, Project fbProject) {
IPath path = file.getLocation();
IPath srcRoot = getMatchingSourceRoot(path, outLocations);
if (srcRoot == null) {
return;
}
IPath outputRoot = outLocations.get(srcRoot);
int firstSegments = path.matchingFirstSegments(srcRoot);
// add relative path to the output path
IPath out = outputRoot.append(path.removeFirstSegments(firstSegments));
String fileName = path.removeFileExtension().lastSegment();
String namePattern = fileName + "\\.class|" + fileName + "\\$.*\\.class";
namePattern = addSecondaryTypesToPattern(file, fileName, namePattern);
File directory = out.removeLastSegments(1).toFile();
// add parent folder and regexp for file names
Pattern classNamesPattern = Pattern.compile(namePattern);
ResourceUtils.addFiles(fbProject, directory, classNamesPattern);
}
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:20,代码来源:WorkItem.java
示例18: main
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
FindBugs.setNoAnalysis();
CommandLine commandLine = new CommandLine();
int argCount = commandLine.parse(args, 0, 2, "Usage: " + ObfuscateBugs.class.getName() + " [options] [<xml results>] ");
SortedBugCollection bugCollection = new SortedBugCollection();
if (argCount < args.length)
bugCollection.readXML(args[argCount++]);
else
bugCollection.readXML(System.in);
SortedBugCollection results = bugCollection.createEmptyCollectionWithMetadata();
Project project = results.getProject();
project.getSourceDirList().clear();
project.getFileList().clear();
project.getAuxClasspathEntryList().clear();
results.getProjectStats().getPackageStats().clear();
results.clearMissingClasses();
results.clearErrors();
for (BugInstance bug : bugCollection) {
results.add(Obfuscate.obfuscate(bug), false);
}
if (argCount == args.length) {
results.writeXML(System.out);
} else {
results.writeXML(args[argCount++]);
}
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:35,代码来源:ObfuscateBugs.java
示例19: createPreconfiguredBugCollection
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
static SortedBugCollection createPreconfiguredBugCollection(List<String> workingDirList, List<String> srcDirList,
IGuiCallback guiCallback) {
Project project = new Project();
for (String cwd : workingDirList) {
project.addWorkingDir(cwd);
}
for (String srcDir : srcDirList) {
project.addSourceDir(srcDir);
}
project.setGuiCallback(guiCallback);
return new SortedBugCollection(project);
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:13,代码来源:MergeSummarizeAndView.java
示例20: setProject
import edu.umd.cs.findbugs.Project; //导入依赖的package包/类
/**
* @param project
*/
private void setProject(Project project) {
this.project = project;
repositoryList = new LinkedList<SourceRepository>();
cache = new Cache();
setSourceBaseList(project.getResolvedSourcePaths());
}
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:10,代码来源:SourceFinder.java
注:本文中的edu.umd.cs.findbugs.Project类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论