当前位置: 首页>>代码示例>>Java>>正文


Java UserPreferences.getCustomPlugins方法代码示例

本文整理汇总了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;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:68,代码来源:BugContentProvider.java


注:本文中的edu.umd.cs.findbugs.config.UserPreferences.getCustomPlugins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。