本文整理汇总了Java中edu.umd.cs.findbugs.config.UserPreferences.enableDetector方法的典型用法代码示例。如果您正苦于以下问题:Java UserPreferences.enableDetector方法的具体用法?Java UserPreferences.enableDetector怎么用?Java UserPreferences.enableDetector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.config.UserPreferences
的用法示例。
在下文中一共展示了UserPreferences.enableDetector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpEngine
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Sets up a FB engine to run on the 'findbugsTestCases' project. It enables
* all the available detectors and reports all the bug categories. Uses a
* normal priority threshold.
*/
private void setUpEngine(String... analyzeMe) throws IOException {
this.engine = new FindBugs2();
Project project = new Project();
project.setProjectName("findbugsTestCases");
this.engine.setProject(project);
DetectorFactoryCollection detectorFactoryCollection = DetectorFactoryCollection.instance();
engine.setDetectorFactoryCollection(detectorFactoryCollection);
bugReporter = new BugCollectionBugReporter(project);
bugReporter.setPriorityThreshold(Priorities.LOW_PRIORITY);
engine.setBugReporter(this.bugReporter);
UserPreferences preferences = UserPreferences.createDefaultUserPreferences();
DetectorFactory checkExpectedWarnings = detectorFactoryCollection.getFactory("CheckExpectedWarnings");
preferences.enableDetector(checkExpectedWarnings, true);
preferences.getFilterSettings().clearAllCategories();
this.engine.setUserPreferences(preferences);
for (String s : analyzeMe)
project.addFile(getFindbugsTestCasesFile(s).getPath());
project.addAuxClasspathEntry("lib/junit.jar");
File lib = getFindbugsTestCasesFile("lib");
for(File f : lib.listFiles()) {
String path = f.getPath();
if (f.canRead() && path.endsWith(".jar"))
project.addAuxClasspathEntry(path);
}
}
示例2: syncUserPreferencesWithTable
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* Disables all unchecked detector factories and enables checked factory
* detectors, leaving those not in the table unmodified.
*/
protected void syncUserPreferencesWithTable() {
TableItem[] itemList = availableFactoriesTableViewer.getTable().getItems();
UserPreferences currentProps = getCurrentProps();
for (int i = 0; i < itemList.length; i++) {
DetectorFactory factory = (DetectorFactory) itemList[i].getData();
// set enabled if defined in configuration
currentProps.enableDetector(factory, itemList[i].getChecked());
}
}