@Override protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { if (e.getKeyCode() == KeyEvent.VK_ENTER && e.getModifiers() == 0 && pressed) { if (myTree.isEditing()) { myTree.stopEditing(); } else { DefaultMutableTreeNode node = (DefaultMutableTreeNode)myTree.getLastSelectedPathComponent(); if (node != null) { myTree.startEditingAtPath(TreeUtil.getPathFromRoot(node)); } } return true; } if (myAllowSyncStrategy && e.getKeyCode() == KeyEvent.VK_F2 && e.getModifiers() == InputEvent.ALT_MASK && pressed) { startSyncEditing(); return true; } return super.processKeyBinding(ks, e, condition, pressed); }
private void initTree(final MyTree tree) { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setCellRenderer(new MyTreeCellRenderer(tree == myLeftTree)); tree.setRootVisible(false); tree.setShowsRootHandles(true); UIUtil.setLineStyleAngled(tree); TreeUtil.installActions(tree); SmartExpander.installOn(tree); EditSourceOnDoubleClickHandler.install(tree); new TreeSpeedSearch(tree); PopupHandler.installUnknownPopupHandler(tree, createTreePopupActions(), ActionManager.getInstance()); }
private TreeModel build(final Set<PsiFile> files, boolean showProgress) { if (files.size() == 1) { myShowFiles = true; } Runnable buildingRunnable = new Runnable() { public void run() { for (final PsiFile file : files) { if (file != null) { buildFileNode(file.getVirtualFile(), null); } } } }; if (showProgress) { final String title = AnalysisScopeBundle.message("package.dependencies.build.process.title"); ProgressManager.getInstance().runProcessWithProgressSynchronously(buildingRunnable, title, false, myProject); } else { buildingRunnable.run(); } TreeUtil.sort(myRoot, new DependencyNodeComparator()); return new TreeModel(myRoot, myTotalFileCount, myMarkedFileCount); }
private FilteringTreeStructure.FilteringNode findNode(Set<PsiElement> parents, FilteringTreeStructure.FilteringNode node) { while (node != null) { boolean changed = false; for (FilteringTreeStructure.FilteringNode n : node.children()) { final PsiElement psiElement = getPsi(n); if (psiElement != null && parents.contains(psiElement)) { node = n; changed = true; break; } } if (!changed) { myAbstractTreeBuilder.select(node); if (myAbstractTreeBuilder.getSelectedElements().isEmpty()) { TreeUtil.selectFirstNode(myTree); } myInitialNodeIsLeaf = node.getChildren().length == 0; return node; } } return null; }
@Override public void setSelected(AnActionEvent e, boolean state) { myPlainMode = state; DefaultMutableTreeNode selection = null; final TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath != null){ selection = (DefaultMutableTreeNode)selectionPath.getLastPathComponent(); } final ModifiableModuleModel model = myContext.myModulesConfigurator.getModuleModel(); final Module[] modules = model.getModules(); for (Module module : modules) { final String[] groupPath = model.getModuleGroupPath(module); updateProjectTree(new Module[]{module}, groupPath != null ? new ModuleGroup(groupPath) : null); } if (state) { removeModuleGroups(); } if (selection != null){ TreeUtil.selectInTree(selection, true, myTree); } }
public List<PackagingElementNode<?>> findNodes(final Collection<? extends PackagingElement<?>> elements) { final List<PackagingElementNode<?>> nodes = new ArrayList<PackagingElementNode<?>>(); TreeUtil.traverseDepth(getRootNode(), new TreeUtil.Traverse() { @Override public boolean accept(Object node) { final Object userObject = ((DefaultMutableTreeNode)node).getUserObject(); if (userObject instanceof PackagingElementNode) { final PackagingElementNode<?> packagingNode = (PackagingElementNode<?>)userObject; final List<? extends PackagingElement<?>> nodeElements = packagingNode.getPackagingElements(); if (ContainerUtil.intersects(nodeElements, elements)) { nodes.add(packagingNode); } } return true; } }); return nodes; }
@Nullable private DefaultMutableTreeNode getFirstNodeToEdit() { // start edit last selected component if editable if (myTree.getLastSelectedPathComponent() instanceof RepositoryNode) { RepositoryNode selectedNode = ((RepositoryNode)myTree.getLastSelectedPathComponent()); if (selectedNode.isEditableNow()) return selectedNode; } List<RepositoryNode> repositoryNodes = getChildNodesByType((DefaultMutableTreeNode)myTree.getModel().getRoot(), RepositoryNode.class, false); RepositoryNode editableNode = ContainerUtil.find(repositoryNodes, new Condition<RepositoryNode>() { @Override public boolean value(RepositoryNode repositoryNode) { return repositoryNode.isEditableNow(); } }); if (editableNode != null) { TreeUtil.selectNode(myTree, editableNode); } return editableNode; }
public void initProfiles(ProcessorConfigProfile defaultProfile, Collection<ProcessorConfigProfile> moduleProfiles) { myDefaultProfile.initFrom(defaultProfile); myModuleProfiles.clear(); for (ProcessorConfigProfile profile : moduleProfiles) { ProcessorConfigProfile copy = new ProcessorConfigProfileImpl(""); copy.initFrom(profile); myModuleProfiles.add(copy); } final RootNode root = (RootNode)myTree.getModel().getRoot(); root.sync(); final DefaultMutableTreeNode node = TreeUtil.findNodeWithObject(root, myDefaultProfile); if (node != null) { TreeUtil.selectNode(myTree, node); } }
private void buildRightTree(Module module){ final DefaultMutableTreeNode root = (DefaultMutableTreeNode)myRightTreeModel.getRoot(); root.removeAllChildren(); final Set<List<Module>> cycles = GraphAlgorithms.getInstance().findCycles(myModulesGraph, module); int index = 1; for (List<Module> modules : cycles) { final DefaultMutableTreeNode cycle = new DefaultMutableTreeNode( AnalysisScopeBundle.message("module.dependencies.cycle.node.text", Integer.toString(index++).toUpperCase())); root.add(cycle); cycle.add(new DefaultMutableTreeNode(new MyUserObject(false, module))); for (Module moduleInCycle : modules) { cycle.add(new DefaultMutableTreeNode(new MyUserObject(false, moduleInCycle))); } } ((DefaultTreeModel)myRightTree.getModel()).reload(); TreeUtil.expandAll(myRightTree); }
public void setSearchInProgress(boolean searchInProgress) { mySearchInProgress = searchInProgress; if (!myPresentation.isDetachedMode()) { myTransferToEDTQueue.offer(new Runnable() { @Override public void run() { if (isDisposed) return; final UsageNode firstUsageNode = myModel.getFirstUsageNode(); if (firstUsageNode == null) return; Node node = getSelectedNode(); if (node != null && !Comparing.equal(new TreePath(node.getPath()), TreeUtil.getFirstNodePath(myTree))) { // user has selected node already return; } showNode(firstUsageNode); if (UsageViewSettings.getInstance().isExpanded() && myUsageNodes.size() < 10000) { expandAll(); } } }); } }
public boolean isModified() { if (myHasDeletedItems) return true; final boolean[] modified = new boolean[1]; TreeUtil.traverseDepth(myRoot, new TreeUtil.Traverse() { public boolean accept(Object node) { if (node instanceof MyNode) { final NamedConfigurable configurable = ((MyNode)node).getConfigurable(); if (isInitialized(configurable) && configurable.isModified()) { modified[0] = true; return false; } } return true; } }); return modified[0]; }
public void apply() throws ConfigurationException { processRemovedItems(); final ConfigurationException[] ex = new ConfigurationException[1]; TreeUtil.traverse(myRoot, new TreeUtil.Traverse() { public boolean accept(Object node) { if (node instanceof MyNode) { try { final NamedConfigurable configurable = ((MyNode)node).getConfigurable(); if (isInitialized(configurable) && configurable.isModified()) { configurable.apply(); } } catch (ConfigurationException e) { ex[0] = e; return false; } } return true; } }); if (ex[0] != null) { throw ex[0]; } myHasDeletedItems = false; }
public void reset() { loadComponentState(); myHasDeletedItems = false; ((DefaultTreeModel)myTree.getModel()).reload(); //myTree.requestFocus(); myState.getProportions().restoreSplitterProportions(myWholePanel); final Enumeration enumeration = myRoot.breadthFirstEnumeration(); boolean selected = false; while (enumeration.hasMoreElements()) { final MyNode node = (MyNode)enumeration.nextElement(); if (node instanceof MyRootNode) continue; final String path = getNodePathString(node); if (!selected && Comparing.strEqual(path, myState.getLastEditedConfigurable())) { TreeUtil.selectInTree(node, false, myTree); selected = true; } } if (!selected) { TreeUtil.selectFirstNode(myTree); } updateSelectionFromTree(); }
@Nullable protected UnnamedConfigurable getItemConfigurable(final T item) { final Ref<UnnamedConfigurable> result = new Ref<UnnamedConfigurable>(); TreeUtil.traverse((TreeNode)myTree.getModel().getRoot(), new TreeUtil.Traverse() { @Override public boolean accept(Object node) { final NamedConfigurable configurable = (NamedConfigurable)((DefaultMutableTreeNode)node).getUserObject(); if (configurable.getEditableObject() == item) { //noinspection unchecked result.set(((ItemConfigurable)configurable).myConfigurable); return false; } else { return true; } } }); return result.get(); }
public void setState(@NotNull final Map<String, Set<String>> langToDisabledTemplates) { final TreeState treeState = TreeState.createOn(this, myRoot); Consumer<PostfixTemplateCheckedTreeNode> consumer = new Consumer<PostfixTemplateCheckedTreeNode>() { @Override public void consume(PostfixTemplateCheckedTreeNode template) { Set<String> disabledTemplates = langToDisabledTemplates.get(template.getLang()); String key = template.getTemplate().getKey(); if (disabledTemplates != null && disabledTemplates.contains(key)) { template.setChecked(false); return; } template.setChecked(true); } }; visit(consumer); myModel.nodeStructureChanged(myRoot); treeState.applyTo(this); TreeUtil.expandAll(this); }
private void expandDefaultChangeList(DefaultTreeModel oldModel, ChangesBrowserNode root) { if (((ChangesBrowserNode)oldModel.getRoot()).getCount() == 0 && TreeUtil.collectExpandedPaths(this).size() == 1) { TreeNode toExpand = null; for (int i = 0; i < root.getChildCount(); i++) { TreeNode node = root.getChildAt(i); if (node instanceof ChangesBrowserChangeListNode && node.getChildCount() > 0) { ChangeList object = ((ChangesBrowserChangeListNode)node).getUserObject(); if (object instanceof LocalChangeList) { if (((LocalChangeList)object).isDefault()) { toExpand = node; break; } } } } if (toExpand != null) { expandPath(new TreePath(new Object[] {root, toExpand})); } } }
public List<BreakpointItem> getSelectedBreakpoints(boolean traverse) { TreePath[] selectionPaths = myTreeView.getSelectionPaths(); if (selectionPaths == null || selectionPaths.length == 0) return Collections.emptyList(); final ArrayList<BreakpointItem> list = new ArrayList<BreakpointItem>(); for (TreePath selectionPath : selectionPaths) { TreeNode startNode = (TreeNode)selectionPath.getLastPathComponent(); if (traverse) { TreeUtil.traverseDepth(startNode, new TreeUtil.Traverse() { public boolean accept(final Object node) { if (node instanceof BreakpointItemNode) { list.add(((BreakpointItemNode)node).getBreakpointItem()); } return true; } }); } else { if (startNode instanceof BreakpointItemNode) { list.add(((BreakpointItemNode)startNode).getBreakpointItem()); } } } return list; }
public void update() { if (myFileSystemTree != null) { myFileSystemTree.updateTree(); final DefaultTreeModel model = (DefaultTreeModel)myTree.getModel(); final int visibleRowCount = TreeUtil.getVisibleRowCount(myTree); for (int row = 0; row < visibleRowCount; row++) { final TreePath pathForRow = myTree.getPathForRow(row); if (pathForRow != null) { final TreeNode node = (TreeNode)pathForRow.getLastPathComponent(); if (node != null) { model.nodeChanged(node); } } } } }
private static void _storePaths(JTree tree, DefaultMutableTreeNode root, List<Object> pathsToExpand, List<Object> selectionPaths, boolean storeElementsOnly) { ArrayList childNodes = TreeUtil.childrenToArray(root); for (final Object childNode1 : childNodes) { DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)childNode1; TreePath path = new TreePath(childNode.getPath()); final Object userObject = childNode.getUserObject(); if (tree.isPathSelected(path)) { if (!(userObject instanceof NodeDescriptor)) { LOG.error("Node: " + childNode + "; userObject: " + userObject + " of class " + userObject.getClass()); } selectionPaths.add(storeElementsOnly ? ((NodeDescriptor)userObject).getElement() : path); } if (tree.isExpanded(path) || childNode.getChildCount() == 0) { pathsToExpand.add(storeElementsOnly && userObject instanceof NodeDescriptor ? ((NodeDescriptor)userObject).getElement() : path); _storePaths(tree, childNode, pathsToExpand, selectionPaths, storeElementsOnly); } } }
public void removeSelectedBreakpoints(Project project) { final TreePath[] paths = myTreeView.getSelectionPaths(); if (paths == null) return; final List<BreakpointItem> breakpoints = getSelectedBreakpoints(true); for (TreePath path : paths) { final Object node = path.getLastPathComponent(); if (node instanceof BreakpointItemNode) { final BreakpointItem item = ((BreakpointItemNode)node).getBreakpointItem(); if (!item.allowedToRemove()) { TreeUtil.unselect(myTreeView, (DefaultMutableTreeNode)node); breakpoints.remove(item); } } } if (breakpoints.isEmpty()) return; TreeUtil.removeSelected(myTreeView); for (BreakpointItem breakpoint : breakpoints) { breakpoint.removed(project); } }
private SelectionState getSelectionStatus() { boolean isRequiredSelectionEnabled = computeRequiredSelectionStatus(); String stateMessage = ""; final Object root = myTree.getModel().getRoot(); if (root instanceof CheckedTreeNode) { final int[] selectedModulesCount = {0}; TreeUtil.traverse((CheckedTreeNode)root, new TreeUtil.Traverse() { @Override public boolean accept(Object node) { if (node instanceof DataNodeCheckedTreeNode && ((DataNodeCheckedTreeNode)node).isChecked() && ((DataNodeCheckedTreeNode)node).myDataNode.getKey().equals(ProjectKeys.MODULE)) { selectedModulesCount[0]++; } return true; } }); stateMessage = String.format("%1$d Modules. %2$d selected", myModulesCount, selectedModulesCount[0]); } return new SelectionState(isRequiredSelectionEnabled, stateMessage); }
protected FileTemplateTabAsTree(String title) { super(title); myRoot = initModel(); MyTreeModel treeModel = new MyTreeModel(myRoot); myTree = new Tree(treeModel); myTree.setRootVisible(false); myTree.setShowsRootHandles(true); UIUtil.setLineStyleAngled(myTree); myTree.expandPath(TreeUtil.getPathFromRoot(myRoot)); myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myTree.setCellRenderer(new MyTreeCellRenderer()); myTree.expandRow(0); myTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { onTemplateSelected(); } }); new TreeSpeedSearch(myTree); }
public void performCopy(@NotNull DataContext dataContext) { List<TreePath> paths = ContainerUtil.sorted(Arrays.asList(ObjectUtils.assertNotNull(myTree.getSelectionPaths())), TreeUtil.getDisplayOrderComparator(myTree)); CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.join(paths, new Function<TreePath, String>() { @Override public String fun(TreePath path) { Object node = path.getLastPathComponent(); if (node instanceof ChangesBrowserNode) { return ((ChangesBrowserNode)node).getTextPresentation(); } else { return node.toString(); } } }, "\n"))); }
private void installTree() { getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); myAutoScrollToSourceHandler.install(getTree()); myAutoScrollFromSourceHandler.install(); TreeUtil.installActions(getTree()); new TreeSpeedSearch(getTree(), new Convertor<TreePath, String>() { @Override public String convert(final TreePath treePath) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent(); final Object userObject = node.getUserObject(); if (userObject != null) { return FileStructurePopup.getSpeedSearchText(userObject); } return null; } }); addTreeKeyListener(); addTreeMouseListeners(); restoreState(); }
public ContentEntryTreeEditor(Project project, List<ModuleSourceRootEditHandler<?>> editHandlers) { myProject = project; myEditHandlers = editHandlers; myTree = new Tree(); myTree.setRootVisible(true); myTree.setShowsRootHandles(true); myEditingActionsGroup = new DefaultActionGroup(); TreeUtil.installActions(myTree); new TreeSpeedSearch(myTree); myTreePanel = new MyPanel(new BorderLayout()); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); myTreePanel.add(scrollPane, BorderLayout.CENTER); myTreePanel.setVisible(false); myDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor(); myDescriptor.setShowFileSystemRoots(false); }
@Override protected void doOKAction() { final ActionManager actionManager = ActionManager.getInstance(); TreeUtil.traverseDepth((TreeNode)myTree.getModel().getRoot(), new TreeUtil.Traverse() { @Override public boolean accept(Object node) { if (node instanceof DefaultMutableTreeNode) { final DefaultMutableTreeNode mutableNode = (DefaultMutableTreeNode)node; final Object userObject = mutableNode.getUserObject(); if (userObject instanceof Pair) { String actionId = (String)((Pair)userObject).first; final AnAction action = actionManager.getAction(actionId); Icon icon = (Icon)((Pair)userObject).second; action.getTemplatePresentation().setIcon(icon); action.setDefaultIcon(icon == null); editToolbarIcon(actionId, mutableNode); } } return true; } }); super.doOKAction(); CustomActionsSchema.setCustomizationSchemaForCurrentProjects(); }
public ComponentTree() { newModel(); setScrollsOnExpand(true); installCellRenderer(); setRootVisible(false); setShowsRootHandles(true); // Enable tooltips ToolTipManager.sharedInstance().registerComponent(this); // Install convenient keyboard navigation TreeUtil.installActions(this); myInplaceEditingAction = DesignerActionPanel.createInplaceEditingAction(this); }
@Override public void applyPresentation(@Nullable Icon icon, @NotNull XValuePresentation valuePresentation, boolean hasChildren) { // extra check for obsolete nodes - tree root was changed // too dangerous to put this into isObsolete - it is called from anywhere, not only EDT if (isObsolete()) return; XDebuggerTreeNode root = getTree().getRoot(); if (root != null && !TreeUtil.isAncestor(root, this)) return; setIcon(icon); myValuePresentation = valuePresentation; myRawValue = XValuePresentationUtil.computeValueText(valuePresentation); if (Registry.is("ide.debugger.inline")) { updateInlineDebuggerData(); } updateText(); setLeaf(!hasChildren); fireNodeChanged(); myTree.nodeLoaded(this, myName); }
public void expandAll() { ApplicationManager.getApplication().assertIsDispatchThread(); try { TreeUtil.expandAll(myTree); } finally { } }
public void selectPackage(final String qualifiedName) { /*ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() {*/ DefaultMutableTreeNode node = findNodeForPackage(qualifiedName); if (node != null) { TreePath path = new TreePath(node.getPath()); TreeUtil.selectPath(myTree, path); } /* } }, ModalityState.stateForComponent(getRootPane()));*/ }
@Override protected void onNodeStateChanged(CheckedTreeNode node) { final List<DetectedFrameworkDescription> checked = Arrays.asList(getCheckedNodes(DetectedFrameworkDescription.class, null)); final List<DetectedFrameworkDescription> disabled = FrameworkDetectionUtil.getDisabledDescriptions(checked, Collections.<DetectedFrameworkDescription>emptyList()); for (DetectedFrameworkDescription description : disabled) { final DefaultMutableTreeNode treeNode = TreeUtil.findNodeWithObject(getRoot(), description); if (treeNode instanceof CheckedTreeNode) { ((CheckedTreeNode)treeNode).setChecked(false); } } }
private void selectTemplate(@Nullable final String groupName, @Nullable final String templateKey) { TreeUtil.traverseDepth(myTreeRoot, new TreeUtil.Traverse() { @Override public boolean accept(Object node) { Object o = ((DefaultMutableTreeNode)node).getUserObject(); if (templateKey == null && o instanceof TemplateGroup && Comparing.equal(groupName, ((TemplateGroup)o).getName()) || o instanceof TemplateImpl && Comparing.equal(templateKey, ((TemplateImpl)o).getKey()) && Comparing.equal(groupName, ((TemplateImpl)o).getGroupName())) { setSelectedNode((DefaultMutableTreeNode)node); return false; } return true; } }); }
public void selectTemplate(@NotNull final PostfixTemplate postfixTemplate, @NotNull final String lang) { Consumer<PostfixTemplateCheckedTreeNode> consumer = new Consumer<PostfixTemplateCheckedTreeNode>() { @Override public void consume(PostfixTemplateCheckedTreeNode template) { if (lang.equals(template.getLang()) && postfixTemplate.getKey().equals(template.getTemplate().getKey())) { TreeUtil.selectInTree(template, true, PostfixTemplatesCheckboxTree.this, true); } } }; visit(consumer); }
private TreeModel build(final Set<PsiFile> files, boolean showProgress) { if (files.size() == 1) { myShowFiles = true; } Runnable buildingRunnable = new Runnable() { @Override public void run() { for (final PsiFile file : files) { if (file != null) { buildFileNode(file.getVirtualFile(), null); } } } }; if (showProgress) { ProgressManager.getInstance().runProcessWithProgressSynchronously(buildingRunnable, AnalysisScopeBundle .message("package.dependencies.build.process.title"), false, myProject); } else { buildingRunnable.run(); } TreeUtil.sort(myRoot, new DependencyNodeComparator()); return new TreeModel(myRoot, myTotalFileCount, myMarkedFileCount); }
/** * The constructor * * @param contentManager content manager * @param project the context project * @param skippedCommits the map with skipped commits */ public GitSkippedCommits(@NotNull ContentManager contentManager, Project project, SortedMap<VirtualFile, List<GitRebaseUtils.CommitInfo>> skippedCommits) { super(contentManager, null); myProject = project; DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("ROOT", true); for (Map.Entry<VirtualFile, List<GitRebaseUtils.CommitInfo>> e : skippedCommits.entrySet()) { DefaultMutableTreeNode vcsRoot = new DefaultMutableTreeNode(new VcsRoot(e.getKey())); int missed = 0; for (GitRebaseUtils.CommitInfo c : e.getValue()) { if (c != null) { vcsRoot.add(new DefaultMutableTreeNode(new Commit(e.getKey(), c))); } else { missed++; } } treeRoot.add(vcsRoot); if (missed > 0) { vcsRoot.add(new DefaultMutableTreeNode("The " + missed + " commit(s) were not parsed due to unsupported rebase directory format")); } } myTree = new Tree(treeRoot); myTree.setCellRenderer(createTreeCellRenderer()); myTree.setRootVisible(false); myCenterComponent = new JBScrollPane(myTree); init(); TreeUtil.expandAll(myTree); }
/** * @return a created tree component (to be used as */ private JComponent createTreeComponent() { myExplanationTree = new Tree(new DefaultTreeModel(buildTree())); myExplanationTree.setRootVisible(false); myExplanationTree.setCellRenderer(new ExplanationTreeRenderer()); DataManager.registerDataProvider(myExplanationTree, this); TreeUtil.expandAll(myExplanationTree); final NavigateAction navigateAction = new NavigateAction(); navigateAction.registerCustomShortcutSet(new CustomShortcutSet(CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myExplanationTree); DefaultActionGroup group = new DefaultActionGroup(); group.addAction(navigateAction); PopupHandler.installUnknownPopupHandler(myExplanationTree, group, ActionManager.getInstance()); return new JBScrollPane(myExplanationTree); }
private static void initTree(JTree tree) { UIUtil.setLineStyleAngled(tree); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.updateUI(); ToolTipManager.sharedInstance().registerComponent(tree); TreeUtil.installActions(tree); new TreeSpeedSearch(tree); }
public void removeLibraries(@NotNull List<LibraryProjectStructureElement> libraries) { List<TreePath> pathsToRemove = new ArrayList<TreePath>(); for (LibraryProjectStructureElement element : libraries) { getModelProvider().getModifiableModel().removeLibrary(element.getLibrary()); MyNode node = findNodeByObject(myRoot, element.getLibrary()); if (node != null) { pathsToRemove.add(TreeUtil.getPathFromRoot(node)); } } myContext.getDaemonAnalyzer().removeElements(libraries); removePaths(pathsToRemove.toArray(new TreePath[pathsToRemove.size()])); }
private void updateModel() { final List<CommittedChangeList> filteredChangeLists = myFilteringStrategy.filterChangeLists(myChangeLists); final TreePath[] paths = myChangesTree.getSelectionPaths(); myChangesTree.setModel(buildTreeModel(filteredChangeLists)); TreeUtil.expandAll(myChangesTree); myChangesTree.setSelectionPaths(paths); }
private void rebuildTreeView(DefaultMutableTreeNode root, boolean expandAll) { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); myTreeTablePanel.removeAll(); final JScrollPane treeTable = createTable(root); if (expandAll) { TreeUtil.expandAll(myTreeTable.getTree()); } myTreeTablePanel.add(treeTable); myTreeTablePanel.revalidate(); }