edu.umd.cs.findbugs.gui

Class AnalysisRun

public class AnalysisRun extends Object

Representation of a run of the FindBugs analysis on a Project. This class has convenient methods which can be used to extract bug reports in various interesting ways.

Author: David Hovemeyer

Constructor Summary
AnalysisRun(Project project, FindBugsFrame frame)
Creates a new instance of AnalysisRun.
Method Summary
voidexecute(FindBugsProgress progressCallback)
Run the analysis.
Collection<BugInstance>getBugInstances()
Return the collection of BugInstances.
FindBugsFramegetFrame()
Get the FindBugsFrame which created this analysis run.
StringgetSummary()
DefaultTreeModelgetTreeModel(String groupByOrder)
Get the tree model to be used in the BugTree.
voidloadBugsFromFile(File file)
Load bugs from a file.
voidloadBugsFromInputStream(InputStream in)
Load bugs from an InputStream.
voidreportAnalysisErrors()
Report any errors that may have occurred during analysis.
voidsaveBugsToFile(File file)
Save bugs to a file.
voidsetTreeModel(String groupByOrder, DefaultTreeModel treeModel)
Set the tree model to be used in the BugTree.

Constructor Detail

AnalysisRun

public AnalysisRun(Project project, FindBugsFrame frame)
Creates a new instance of AnalysisRun.

Method Detail

execute

public void execute(FindBugsProgress progressCallback)
Run the analysis. This should be done in a separate thread (not the GUI event thread). The progress callback can be used to update the user interface to reflect the progress of the analysis. The GUI may cancel the analysis by interrupting the analysis thread, in which case InterruptedException will be thrown by this method.

Parameters: progressCallback the progress callback

Throws: IOException if an I/O error occurs during the analysis InterruptedException if the analysis thread is interrupted

getBugInstances

public Collection<BugInstance> getBugInstances()
Return the collection of BugInstances.

getFrame

public FindBugsFrame getFrame()
Get the FindBugsFrame which created this analysis run.

Returns: the FindBugsFrame

getSummary

public String getSummary()

getTreeModel

public DefaultTreeModel getTreeModel(String groupByOrder)
Get the tree model to be used in the BugTree.

Parameters: groupByOrder the grouping order that the tree model conforms to

Returns: the tree model

loadBugsFromFile

public void loadBugsFromFile(File file)
Load bugs from a file.

loadBugsFromInputStream

public void loadBugsFromInputStream(InputStream in)
Load bugs from an InputStream.

Parameters: in the InputStream

Throws: IOException DocumentException

reportAnalysisErrors

public void reportAnalysisErrors()
Report any errors that may have occurred during analysis.

saveBugsToFile

public void saveBugsToFile(File file)
Save bugs to a file.

setTreeModel

public void setTreeModel(String groupByOrder, DefaultTreeModel treeModel)
Set the tree model to be used in the BugTree.

Parameters: groupByOrder the grouping order that the tree model will conform to treeModel the tree model

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.