Search in sources :

Example 11 with InspectionConfigTreeNode

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

the class SingleInspectionProfilePanel method updateProperSettingsForSelection.

private void updateProperSettingsForSelection() {
    final TreePath selectionPath = myTreeTable.getTree().getSelectionPath();
    if (selectionPath != null) {
        InspectionConfigTreeNode node = (InspectionConfigTreeNode) selectionPath.getLastPathComponent();
        final Descriptor descriptor = node.getDefaultDescriptor();
        if (descriptor != null) {
            final boolean properSetting = myProfile.isProperSetting(descriptor.getKey().toString());
            if (node.isProperSetting() != properSetting) {
                myAlarm.cancelAllRequests();
                myAlarm.addRequest(() -> myTreeTable.repaint(), 300);
                node.dropCache();
                updateUpHierarchy((InspectionConfigTreeNode) node.getParent());
            }
        }
    }
}
Also used : TreePath(javax.swing.tree.TreePath) InspectionConfigTreeNode(com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode)

Example 12 with InspectionConfigTreeNode

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

the class VisibleTreeState method saveVisibleState.

public void saveVisibleState(Tree tree) {
    myExpandedNodes.clear();
    final DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) tree.getModel().getRoot();
    Enumeration<TreePath> expanded = tree.getExpandedDescendants(new TreePath(rootNode.getPath()));
    if (expanded != null) {
        while (expanded.hasMoreElements()) {
            final TreePath treePath = expanded.nextElement();
            final InspectionConfigTreeNode node = (InspectionConfigTreeNode) treePath.getLastPathComponent();
            myExpandedNodes.add(getState(node));
        }
    }
    setSelectionPaths(tree.getSelectionPaths());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreePath(javax.swing.tree.TreePath) InspectionConfigTreeNode(com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode)

Example 13 with InspectionConfigTreeNode

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

the class VisibleTreeState method traverseNodes.

private void traverseNodes(final DefaultMutableTreeNode root, List<TreePath> pathsToExpand, List<TreePath> toSelect) {
    final State state = getState((InspectionConfigTreeNode) root);
    final TreeNode[] rootPath = root.getPath();
    if (mySelectedNodes.contains(state)) {
        toSelect.add(new TreePath(rootPath));
    }
    if (myExpandedNodes.contains(state)) {
        pathsToExpand.add(new TreePath(rootPath));
    }
    for (int i = 0; i < root.getChildCount(); i++) {
        traverseNodes((DefaultMutableTreeNode) root.getChildAt(i), pathsToExpand, toSelect);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) TreeNode(javax.swing.tree.TreeNode) InspectionConfigTreeNode(com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Aggregations

InspectionConfigTreeNode (com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode)13 TreePath (javax.swing.tree.TreePath)7 THashSet (gnu.trove.THashSet)3 Project (com.intellij.openapi.project.Project)2 InspectionsConfigTreeComparator (com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeComparator)2 InspectionsConfigTreeRenderer (com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionsConfigTreeRenderer)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 Nullable (org.jetbrains.annotations.Nullable)2 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)1 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)1 HighlightInfoType (com.intellij.codeInsight.daemon.impl.HighlightInfoType)1 SeverityRegistrar (com.intellij.codeInsight.daemon.impl.SeverityRegistrar)1 HintUtil (com.intellij.codeInsight.hint.HintUtil)1 InspectionsBundle (com.intellij.codeInspection.InspectionsBundle)1 com.intellij.codeInspection.ex (com.intellij.codeInspection.ex)1 AllIcons (com.intellij.icons.AllIcons)1 com.intellij.ide (com.intellij.ide)1 SearchUtil (com.intellij.ide.ui.search.SearchUtil)1 SearchableOptionsRegistrar (com.intellij.ide.ui.search.SearchableOptionsRegistrar)1 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)1