Search in sources :

Example 1 with InspectionsConfigTreeComparator

use of com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator in project intellij-community by JetBrains.

the class SingleInspectionProfilePanel method fillTreeData.

private void fillTreeData(@Nullable String filter, boolean forceInclude) {
    if (myProfile == null)
        return;
    myRoot.removeAllChildren();
    myRoot.dropCache();
    List<Set<String>> keySetList = new ArrayList<>();
    final Set<String> quoted = new HashSet<>();
    if (filter != null && !filter.isEmpty()) {
        keySetList.addAll(SearchUtil.findKeys(filter, quoted));
    }
    Project project = myProjectProfileManager.getProject();
    final boolean emptyFilter = myInspectionsFilter.isEmptyFilter();
    for (ToolDescriptors toolDescriptors : myInitialToolDescriptors.values()) {
        final Descriptor descriptor = toolDescriptors.getDefaultDescriptor();
        if (filter != null && !filter.isEmpty() && !isDescriptorAccepted(descriptor, filter, forceInclude, keySetList, quoted)) {
            continue;
        }
        final InspectionConfigTreeNode node = new InspectionConfigTreeNode.Tool(toolDescriptors.getDefaultDescriptor().getKey(), this);
        if (!emptyFilter && !myInspectionsFilter.matches(myProfile.getTools(toolDescriptors.getDefaultDescriptor().getKey().toString(), project), node)) {
            continue;
        }
        getGroupNode(myRoot, toolDescriptors.getDefaultDescriptor().getGroup()).add(node);
        myRoot.dropCache();
    }
    if (filter != null && forceInclude && myRoot.getChildCount() == 0) {
        final Set<String> filters = SearchableOptionsRegistrar.getInstance().getProcessedWords(filter);
        if (filters.size() > 1 || !quoted.isEmpty()) {
            fillTreeData(filter, false);
        }
    }
    TreeUtil.sortRecursively(myRoot, new InspectionsConfigTreeComparator());
}
Also used : THashSet(gnu.trove.THashSet) InspectionConfigTreeNode(com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode) Project(com.intellij.openapi.project.Project) InspectionsConfigTreeComparator(com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator) THashSet(gnu.trove.THashSet)

Aggregations

Project (com.intellij.openapi.project.Project)1 InspectionConfigTreeNode (com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode)1 InspectionsConfigTreeComparator (com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator)1 THashSet (gnu.trove.THashSet)1