本文整理汇总了Java中edu.umd.cs.findbugs.config.UserPreferences.getFilterSettings方法的典型用法代码示例。如果您正苦于以下问题:Java UserPreferences.getFilterSettings方法的具体用法?Java UserPreferences.getFilterSettings怎么用?Java UserPreferences.getFilterSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.config.UserPreferences
的用法示例。
在下文中一共展示了UserPreferences.getFilterSettings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
public void run(IProgressMonitor monitor) throws CoreException {
UserPreferences userPrefs = FindbugsPlugin.getUserPreferences(project);
ProjectFilterSettings filterSettings = userPrefs.getFilterSettings();
IPreferenceStore store = FindbugsPlugin.getPluginPreferences(project);
for (MarkerParameter mp : mpList) {
if (mp.markerType == null) {
continue;
}
if (!MarkerUtil.shouldDisplayWarning(mp.bug, filterSettings)) {
continue;
}
updateMarkerSeverity(store, mp);
// This triggers resource update on IResourceChangeListener's (BugTreeView)
addMarker(mp);
}
}
示例2: refreshUI
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
void refreshUI(UserPreferences prefs) {
IPreferenceStore store = propertyPage.getPreferenceStore();
scariestRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_SCARIEST_MARKER_SEVERITY)).name());
scaryRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_SCARY_MARKER_SEVERITY)).name());
troublingRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_TROUBLING_MARKER_SEVERITY)).name());
ofConcernRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_OFCONCERN_MARKER_SEVERITY)).name());
ProjectFilterSettings filterSettings = prefs.getFilterSettings();
minRankSlider.setSelection(filterSettings.getMinRank());
updateRankValueLabel();
minPriorityCombo.setText(filterSettings.getMinPriority());
for (Button checkBox : chkEnableBugCategoryList) {
checkBox.setSelection(filterSettings.containsCategory((String) checkBox.getData()));
}
syncSelectedCategories();
}
示例3: analyze
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Launch an analysis on the given source files.
*
* @param classFiles
* @param classPaths
* @param bugReporter
* @throws java.io.IOException
* @throws InterruptedException
* @throws edu.umd.cs.findbugs.PluginException
* @throws URISyntaxException
*
*/
public void analyze(String[] classFiles, String[] classPaths, BugReporter bugReporter) throws IOException, InterruptedException,
PluginException, NoSuchFieldException, IllegalAccessException, URISyntaxException {
Project project = new Project();
project.setProjectName("automate-test-project");
for (String file : classFiles) {
project.addFile(file);
}
// Add classpath list to project's auxclasspath
for (String classpath : classPaths) {
project.addAuxClasspathEntry(classpath);
}
if (loadedPlugin == null) {
//Initialize the plugin base on the findbugs.xml
byte[] archive = buildFakePluginJar();
File f = new File(System.getProperty("java.io.tmpdir"), "plugin.jar");
log.info("Writing " + f.getCanonicalPath());
f.deleteOnExit();
FileOutputStream out = new FileOutputStream(f);
out.write(archive);
out.close();
loadedPlugin = Plugin.loadCustomPlugin(f.toURI().toURL(), project);
}
//FindBugs engine
FindBugs2 engine = new FindBugs2();
engine.setNoClassOk(true);
engine.setMergeSimilarWarnings(false);
engine.setBugReporter(bugReporter);
engine.setProject(project);
engine.setProgressCallback(mock(FindBugsProgress.class));
engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance());
//User preferences set to miss no bugs report
UserPreferences prefs = UserPreferences.createDefaultUserPreferences();
ProjectFilterSettings filter = prefs.getFilterSettings();
filter.setMinRank(20);
filter.setDisplayFalseWarnings(true);
filter.setMinPriority("Low");
engine.setUserPreferences(prefs);
log.info("Analyzing... {}", classFiles);
engine.execute();
}