edu.umd.cs.findbugs.gui
Class AnalysisRun

java.lang.Object
  extended by edu.umd.cs.findbugs.gui.AnalysisRun

public class AnalysisRun
extends java.lang.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

Nested Class Summary
private  class AnalysisRun.Reporter
          Our BugReporter just puts the reported BugInstances into a SortedBugCollection.
 
Field Summary
private static boolean CREATE_SUMMARY
           
private  AnalysisErrorDialog errorDialog
           
private  FindBugs findBugs
           
private  FindBugsFrame frame
           
private  ConsoleLogger logger
           
private static java.lang.String MISSING_SUMMARY_MESSAGE
           
private  Project project
           
private  AnalysisRun.Reporter reporter
           
private  java.lang.String summary
           
private  java.util.HashMap<java.lang.String,javax.swing.tree.DefaultTreeModel> treeModelMap
           
 
Constructor Summary
AnalysisRun(Project project, FindBugsFrame frame)
          Creates a new instance of AnalysisRun.
 
Method Summary
private  void createSummary(ProjectStats stats)
           
 void execute(FindBugsProgress progressCallback)
          Run the analysis.
 java.util.Collection<BugInstance> getBugInstances()
          Return the collection of BugInstances.
 java.lang.String getSummary()
           
 javax.swing.tree.DefaultTreeModel getTreeModel(java.lang.String groupByOrder)
          Get the tree model to be used in the BugTree.
 void loadBugsFromFile(java.io.File file)
          Load bugs from a file.
 void reportAnalysisErrors()
          Report any errors that may have occurred during analysis.
 void saveBugsToFile(java.io.File file)
          Save bugs to a file.
 void setTreeModel(java.lang.String groupByOrder, javax.swing.tree.DefaultTreeModel treeModel)
          Set the tree model to be used in the BugTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

private Project project

frame

private FindBugsFrame frame

summary

private java.lang.String summary

logger

private ConsoleLogger logger

findBugs

private FindBugs findBugs

reporter

private AnalysisRun.Reporter reporter

treeModelMap

private java.util.HashMap<java.lang.String,javax.swing.tree.DefaultTreeModel> treeModelMap

errorDialog

private AnalysisErrorDialog errorDialog

MISSING_SUMMARY_MESSAGE

private static final java.lang.String MISSING_SUMMARY_MESSAGE
See Also:
Constant Field Values

CREATE_SUMMARY

private static final boolean CREATE_SUMMARY
Constructor Detail

AnalysisRun

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

Method Detail

execute

public void execute(FindBugsProgress progressCallback)
             throws java.io.IOException,
                    java.lang.InterruptedException
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:
java.io.IOException - if an I/O error occurs during the analysis
java.lang.InterruptedException - if the analysis thread is interrupted

createSummary

private void createSummary(ProjectStats stats)
                    throws java.io.IOException
Throws:
java.io.IOException

loadBugsFromFile

public void loadBugsFromFile(java.io.File file)
                      throws java.io.IOException,
                             org.dom4j.DocumentException
Load bugs from a file.

Throws:
java.io.IOException
org.dom4j.DocumentException

saveBugsToFile

public void saveBugsToFile(java.io.File file)
                    throws java.io.IOException
Save bugs to a file.

Throws:
java.io.IOException

reportAnalysisErrors

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


getBugInstances

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


setTreeModel

public void setTreeModel(java.lang.String groupByOrder,
                         javax.swing.tree.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

getTreeModel

public javax.swing.tree.DefaultTreeModel getTreeModel(java.lang.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

getSummary

public java.lang.String getSummary()