private List<Item> createNewMenuItems(final ExplorerNode explorerNode,
                                          final ExplorerNodePermissions documentPermissions,
                                          final DocumentTypes documentTypes) {
        final List<Item> children = new ArrayList<>();
        //noinspection SimplifyStreamApiCallChains
        final List<DocumentType> availableTypes = documentTypes.getTypes()
                .stream()
                .filter(documentPermissions::hasCreatePermission)
                .collect(Collectors.toList());

        // Group all document types
        final Map<DocumentTypeGroup, List<DocumentType>> groupedTypes = availableTypes.stream()
                .collect(Collectors.groupingBy(DocumentType::getGroup, Collectors.toList()));

        // Add each type group as a sorted list of menu items
        groupedTypes
                .entrySet()
                .stream()
                .sorted(Comparator.comparing(entry -> entry.getKey().getPriority()))
                .forEach(entry -> {
                    final DocumentTypeGroup group = entry.getKey();
                    final List<DocumentType> types = entry.getValue();
                    if (DocumentTypeGroup.STRUCTURE.equals(group) && types != null && types.size() == 1) {
                        children.add(createIconMenuItemFromDocumentType(types.get(0), explorerNode));
                        if (groupedTypes.keySet().size() > 1) {
                            children.add(new Separator(1));
                        }
                    } else if (types != null && !types.isEmpty()) {
                        final List<Item> grandChildren = types.stream()
                                .sorted(Comparator.comparing(DocumentType::getDisplayType))
                                .map(type -> (Item) createIconMenuItemFromDocumentType(type, explorerNode))
                                .collect(Collectors.toList());

                        // Add the group level item with its children
                        children.add(new IconParentMenuItem.Builder()
                                .text(group.getDisplayName())
                                .children(grandChildren)
                                .build());
                    }
                });
        return children;
    }
Highlights the supplied document item in the explorer tree.
stroom-core-client/src/main/java/stroom/document/client/DocumentPluginEventManager.java