本文整理汇总了Java中edu.umd.cs.findbugs.config.UserPreferences.getCustomPlugins方法的典型用法代码示例。如果您正苦于以下问题:Java UserPreferences.getCustomPlugins方法的具体用法?Java UserPreferences.getCustomPlugins怎么用?Java UserPreferences.getCustomPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.config.UserPreferences
的用法示例。
在下文中一共展示了UserPreferences.getCustomPlugins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGroups
import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
* @param <Identifier>
* object type, like String or Integer
* @param mapper
* maps between BugInstance and group
*/
private synchronized <Identifier> Object[] createGroups(BugGroup parent, MarkerMapper<Identifier> mapper) {
if (mapper == MarkerMapper.NO_MAPPING) {
return parent.getAllMarkers().toArray(new IMarker[0]);
}
Set<IMarker> allMarkers = parent.getAllMarkers();
GroupType childType = grouping.getChildType(mapper.getType());
Map<Identifier, Set<IMarker>> groupIds = new HashMap<Identifier, Set<IMarker>>();
UserPreferences prefs = FindbugsPlugin.getCorePreferences(null, false);
Set<String> disabledPlugins = prefs.getCustomPlugins(false);
// first, sort all bugs to the sets with same identifier type
Set<String> errorMessages = new HashSet<String>();
for (IMarker marker : allMarkers) {
Identifier id = mapper.getIdentifier(marker);
if (id == null) {
String pluginId = MarkerUtil.getPluginId(marker);
if(pluginId.length() == 0 || disabledPlugins.contains(pluginId)){
// do not report errors for disabled plugins
continue;
}
try {
String debugDescription = mapper.getDebugDescription(marker);
if(errorMessages.contains(debugDescription)) {
continue;
}
errorMessages.add(debugDescription);
if(FindbugsPlugin.getDefault().isDebugging()){
FindbugsPlugin.getDefault().logWarning(
"BugContentProvider.createGroups: failed to find " + debugDescription + " for marker on file "
+ marker.getResource());
}
} catch (CoreException e) {
FindbugsPlugin.getDefault().logException(e, "Exception on retrieving debug data for: " + mapper.getType());
}
continue;
}
if (!groupIds.containsKey(id)) {
groupIds.put(id, new HashSet<IMarker>());
}
groupIds.get(id).add(marker);
}
// now create groups from the sorted bug sets
Set<Entry<Identifier, Set<IMarker>>> typesSet = groupIds.entrySet();
BugGroup[] children = new BugGroup[typesSet.size()];
boolean lastlevel = grouping.getChildType(mapper.getType()) == GroupType.Marker;
int i = 0;
for (Entry<Identifier, Set<IMarker>> entry : typesSet) {
Identifier groupId = entry.getKey();
children[i] = new BugGroup(parent, groupId, mapper.getType());
children[i].setMarkers(entry.getValue());
i++;
}
if (!lastlevel) {
for (BugGroup bugGroup : children) {
// recursive call
createGroups(bugGroup, childType.getMapper());
}
}
return children;
}