edu.umd.cs.findbugs.config

Class UserPreferences

public class UserPreferences extends Object implements Cloneable

User Preferences outside of any one Project. This consists of a class to manage the findbugs.prop file found in the user.home.

Author: Dave Brosius

Method Summary
static UserPreferencescreateDefaultUserPreferences()
Create default UserPreferences.
voidenableAllDetectors(boolean enable)
Enable or disable all known Detectors.
voidenableDetector(DetectorFactory factory, boolean enable)
Set the enabled/disabled status of given Detector.
ProjectFilterSettingsgetFilterSettings()
Get ProjectFilterSettings.
List<String>getRecentProjects()
Get List of recent project filenames.
intgetUserDetectorThreshold()
Get the detector threshold (min severity to report a warning).
static UserPreferencesgetUserPreferences()
Get UserPreferences singleton.
booleanisDetectorEnabled(DetectorFactory factory)
Get the enabled/disabled status of given Detector.
voidread()
Read persistent global UserPreferences from file in the user's home directory.
voidread(InputStream in)
Read user preferences from given input stream.
voidremoveProject(String projectName)
Remove project filename from the recently-used project list.
voidsetProjectFilterSettings(ProjectFilterSettings filterSettings)
Set the ProjectFilterSettings.
voidsetUserDetectorThreshold(int threshold)
Set the detector threshold (min severity to report a warning).
voidsetUserDetectorThreshold(String threshold)
Set the detector threshold (min severity to report a warning).
voiduseProject(String projectName)
Add given project filename to the front of the recently-used project list.
voidwrite()
Write persistent global UserPreferences to file in user's home directory.
voidwrite(OutputStream out)
Write UserPreferences to given OutputStream.

Method Detail

createDefaultUserPreferences

public static UserPreferences createDefaultUserPreferences()
Create default UserPreferences.

Returns: default UserPreferences

enableAllDetectors

public void enableAllDetectors(boolean enable)
Enable or disable all known Detectors.

Parameters: enable true if all detectors should be enabled, false if they should all be disabled

enableDetector

public void enableDetector(DetectorFactory factory, boolean enable)
Set the enabled/disabled status of given Detector.

Parameters: factory the DetectorFactory for the Detector to be enabled/disabled enable true if the Detector should be enabled, false if it should be Disabled

getFilterSettings

public ProjectFilterSettings getFilterSettings()
Get ProjectFilterSettings.

Returns: the ProjectFilterSettings

getRecentProjects

public List<String> getRecentProjects()
Get List of recent project filenames.

Returns: List of recent project filenames

getUserDetectorThreshold

public int getUserDetectorThreshold()
Get the detector threshold (min severity to report a warning).

Returns: the detector threshold

getUserPreferences

public static UserPreferences getUserPreferences()
Get UserPreferences singleton. This should only be used if there is a single set of user preferences to be used for all projects.

Returns: the UserPreferences

isDetectorEnabled

public boolean isDetectorEnabled(DetectorFactory factory)
Get the enabled/disabled status of given Detector.

Parameters: factory the DetectorFactory of the Detector

Returns: true if the Detector is enabled, false if not

read

public void read()
Read persistent global UserPreferences from file in the user's home directory.

read

public void read(InputStream in)
Read user preferences from given input stream. The InputStream is guaranteed to be closed by this method.

Parameters: in the InputStream

Throws: IOException

removeProject

public void removeProject(String projectName)
Remove project filename from the recently-used project list.

Parameters: projectName project filename

setProjectFilterSettings

public void setProjectFilterSettings(ProjectFilterSettings filterSettings)
Set the ProjectFilterSettings.

Parameters: filterSettings the ProjectFilterSettings

setUserDetectorThreshold

public void setUserDetectorThreshold(int threshold)
Set the detector threshold (min severity to report a warning).

Parameters: threshold the detector threshold

setUserDetectorThreshold

public void setUserDetectorThreshold(String threshold)
Set the detector threshold (min severity to report a warning).

Parameters: threshold the detector threshold

useProject

public void useProject(String projectName)
Add given project filename to the front of the recently-used project list.

Parameters: projectName project filename

write

public void write()
Write persistent global UserPreferences to file in user's home directory.

write

public void write(OutputStream out)
Write UserPreferences to given OutputStream. The OutputStream is guaranteed to be closed by this method.

Parameters: out the OutputStream

Throws: IOException

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