Source:
private DefaultMutableTreeNode createLibrary(final DefaultMutableTreeNode libraryRoot) { final DescriptorProvider descriptorProvider = _analysisJobBuilder.getConfiguration().getEnvironment() .getDescriptorProvider(); final Set<ComponentSuperCategory> superCategories = descriptorProvider.getComponentSuperCategories(); for (ComponentSuperCategory superCategory : superCategories) { final DefaultMutableTreeNode schemaNode = new DefaultMutableTreeNode(superCategory); final Collection<? extends ComponentDescriptor<?>> componentDescriptors = descriptorProvider .getComponentDescriptorsOfSuperCategory(superCategory); final List<ComponentDescriptor<?>> filteredComponentDescriptors = new ArrayList<>(); for (ComponentDescriptor<?> componentDescriptor : componentDescriptors) { final String displayName = componentDescriptor.getDisplayName(); if (displayName.toLowerCase().contains(_searchTerm.toLowerCase())) { filteredComponentDescriptors.add(componentDescriptor); } } if (filteredComponentDescriptors.size() > 0) { libraryRoot.add(schemaNode); } final Map<ComponentCategory, DefaultMutableTreeNode> categoryTreeNodes = new HashMap<>(); MenuCallback menuCallback = new MenuCallback() { @Override public void addCategory(ComponentCategory category) { final DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(category); categoryTreeNodes.put(category, treeNode); schemaNode.add(treeNode); } @Override public void addComponentDescriptor(ComponentDescriptor<?> descriptor) { boolean placedInSubmenu = false; for (ComponentCategory category : descriptor.getComponentCategories()) { if (categoryTreeNodes.containsKey(category)) { placedInSubmenu = true; final DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(descriptor); categoryTreeNodes.get(category).add(treeNode); } } if (!placedInSubmenu) { schemaNode.add(new DefaultMutableTreeNode(descriptor)); } } }; DescriptorMenuBuilder.createMenuStructure(menuCallback, filteredComponentDescriptors, true); } return libraryRoot; }

Target:
private DefaultMutableTreeNode createLibrary(final DefaultMutableTreeNode libraryRoot) { final DescriptorProvider descriptorProvider = _analysisJobBuilder.getConfiguration().getEnvironment() .getDescriptorProvider(); final Set<ComponentSuperCategory> superCategories = descriptorProvider.getComponentSuperCategories(); for (ComponentSuperCategory superCategory : superCategories) { final DefaultMutableTreeNode schemaNode = new DefaultMutableTreeNode(superCategory); final Collection<? extends ComponentDescriptor<?>> componentDescriptors = descriptorProvider .getComponentDescriptorsOfSuperCategory(superCategory); final List<ComponentDescriptor<?>> filteredComponentDescriptors = new ArrayList<>(); for (ComponentDescriptor<?> componentDescriptor : componentDescriptors) { final String displayName = componentDescriptor.getDisplayName(); if (displayName.toLowerCase().contains(_searchTerm.toLowerCase())) { filteredComponentDescriptors.add(componentDescriptor); } } if (filteredComponentDescriptors.size() > 0) { libraryRoot.add(schemaNode); } final Map<ComponentCategory, DefaultMutableTreeNode> categoryTreeNodes = new HashMap<>(); MenuCallback menuCallback = new MenuCallback() { @Override public void addCategory(ComponentCategory category) { final DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(category); categoryTreeNodes.put(category, treeNode); schemaNode.add(treeNode); } @Override public void addComponentDescriptor(ComponentDescriptor<?> descriptor) { boolean placedInSubmenu = false; for (ComponentCategory category : descriptor.getComponentCategories()) { if (categoryTreeNodes.containsKey(category)) { placedInSubmenu = true; final DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(descriptor); categoryTreeNodes.get(category).add(treeNode); } } if (!placedInSubmenu) { schemaNode.add(new DefaultMutableTreeNode(descriptor)); } } }; DescriptorMenuBuilder.createMenuStructure(menuCallback, filteredComponentDescriptors, true); } if (libraryRoot.getChildCount() == 0) { libraryRoot.add(new DefaultMutableTreeNode(NO_COMPONENTS_FOUND_SEARCH_RESULT)); } return libraryRoot; }