CheckboxTreeTable (Collection<SuggestedChildRootInfo> suggestedRoots) { final CheckedTreeNode root = createRoot(suggestedRoots); CheckboxTreeTable treeTable = new CheckboxTreeTable(root, new CheckboxTree.CheckboxTreeCellRenderer(true) { @Override public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (!(value instanceof VirtualFileCheckedTreeNode node)) return; VirtualFile file = node.getFile(); @NlsSafe String text; SimpleTextAttributes attributes; boolean isValid = true; if (leaf) { VirtualFile ancestor = ((VirtualFileCheckedTreeNode)node.getParent()).getFile(); if (ancestor != null) { text = VfsUtilCore.getRelativePath(file, ancestor, File.separatorChar); if (StringUtil.isEmpty(text)) { text = File.separator; } } else { text = file.getPresentableUrl(); } if (text == null) { isValid = false; text = file.getPresentableUrl(); } attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES; } else { text = file.getPresentableUrl(); attributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES; } ColoredTreeCellRenderer textRenderer = getTextRenderer(); textRenderer.setIcon(PlatformIcons.FOLDER_ICON); if (!isValid) { textRenderer.append(ProjectBundle.message("invalid.root.label") + ' ', SimpleTextAttributes.ERROR_ATTRIBUTES); } textRenderer.append(text, attributes); } }, new ColumnInfo[]{ROOT_COLUMN, ROOT_TYPE_COLUMN}); int max = 0; for (SuggestedChildRootInfo info : suggestedRoots) { for (String s : info.getRootTypeNames()) { max = Math.max(max, treeTable.getFontMetrics(treeTable.getFont()).stringWidth(s)); } } final TableColumn column = treeTable.getColumnModel().getColumn(1); int width = max + 20;//add space for combobox button column.setPreferredWidth(width); column.setMaxWidth(width); treeTable.setRootVisible(false); TreeTableSpeedSearch.installOn(treeTable, o -> { Object node = o.getLastPathComponent(); if (!(node instanceof VirtualFileCheckedTreeNode)) return ""; return ((VirtualFileCheckedTreeNode)node).getFile().getPresentableUrl(); }); TreeUtil.expandAll(treeTable.getTree()); return treeTable; }