Search in sources :

Example 6 with BreakpointItem

use of com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem in project intellij-community by JetBrains.

the class BreakpointsCheckboxTree method convertValueToText.

public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    if (value instanceof BreakpointItemNode) {
        final BreakpointItem breakpointItem = ((BreakpointItemNode) value).getBreakpointItem();
        final String displayText = breakpointItem != null ? breakpointItem.getDisplayText() : null;
        if (!StringUtil.isEmptyOrSpaces(displayText)) {
            return displayText;
        }
    }
    return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
}
Also used : BreakpointItem(com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem)

Example 7 with BreakpointItem

use of com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem in project intellij-community by JetBrains.

the class BreakpointsTreeCellRenderer method customizeRenderer.

private static void customizeRenderer(Project project, Object value, boolean selected, boolean expanded, ColoredTreeCellRenderer renderer) {
    if (value instanceof BreakpointItemNode) {
        BreakpointItemNode node = (BreakpointItemNode) value;
        BreakpointItem breakpoint = node.getBreakpointItem();
        breakpoint.setupRenderer(renderer, project, selected);
    } else if (value instanceof BreakpointsGroupNode) {
        XBreakpointGroup group = ((BreakpointsGroupNode) value).getGroup();
        renderer.setIcon(group.getIcon(expanded));
        if (group instanceof XBreakpointCustomGroup && ((XBreakpointCustomGroup) group).isDefault()) {
            renderer.append(group.getName(), SIMPLE_CELL_ATTRIBUTES_BOLD);
        } else {
            renderer.append(group.getName(), SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES);
        }
    }
}
Also used : XBreakpointCustomGroup(com.intellij.xdebugger.impl.breakpoints.ui.grouping.XBreakpointCustomGroup) BreakpointItem(com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem) XBreakpointGroup(com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup)

Example 8 with BreakpointItem

use of com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem in project intellij-community by JetBrains.

the class BreakpointItemsTreeController method rebuildTree.

public void rebuildTree(Collection<BreakpointItem> items) {
    List<BreakpointItem> selectedBreakpoints = getSelectedBreakpoints(false);
    TreePath path = myTreeView.getSelectionPath();
    buildTree(items);
    if (myTreeView.getRowForPath(path) == -1 && !selectedBreakpoints.isEmpty()) {
        selectBreakpointItem(selectedBreakpoints.get(0), path);
    } else {
        selectBreakpointItem(null, path);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) BreakpointItem(com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem)

Example 9 with BreakpointItem

use of com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem in project intellij-community by JetBrains.

the class BreakpointItemsTreeController method getSelectedBreakpoints.

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<>();
    for (TreePath selectionPath : selectionPaths) {
        TreeNode startNode = (TreeNode) selectionPath.getLastPathComponent();
        if (traverse) {
            TreeUtil.traverseDepth(startNode, node -> {
                if (node instanceof BreakpointItemNode) {
                    list.add(((BreakpointItemNode) node).getBreakpointItem());
                }
                return true;
            });
        } else {
            if (startNode instanceof BreakpointItemNode) {
                list.add(((BreakpointItemNode) startNode).getBreakpointItem());
            }
        }
    }
    return list;
}
Also used : TreePath(javax.swing.tree.TreePath) TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CheckedTreeNode(com.intellij.ui.CheckedTreeNode) BreakpointItem(com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem)

Example 10 with BreakpointItem

use of com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem in project intellij-community by JetBrains.

the class BreakpointItemsTreeController method buildTree.

public void buildTree(@NotNull Collection<? extends BreakpointItem> breakpoints) {
    final TreeState state = TreeState.createOn(myTreeView, myRoot);
    myRoot.removeAllChildren();
    myNodes.clear();
    myGroups.clear();
    for (BreakpointItem breakpoint : breakpoints) {
        BreakpointItemNode node = new BreakpointItemNode(breakpoint);
        CheckedTreeNode parent = getParentNode(breakpoint);
        parent.add(node);
        myNodes.put(breakpoint, node);
    }
    TreeUtil.sortRecursively(myRoot, myComparator);
    myInBuild = true;
    ((DefaultTreeModel) (myTreeView.getModel())).nodeStructureChanged(myRoot);
    state.applyTo(myTreeView, myRoot);
    myInBuild = false;
}
Also used : TreeState(com.intellij.ide.util.treeView.TreeState) BreakpointItem(com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem) CheckedTreeNode(com.intellij.ui.CheckedTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

BreakpointItem (com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem)10 CheckedTreeNode (com.intellij.ui.CheckedTreeNode)3 TreePath (javax.swing.tree.TreePath)3 XBreakpointGroup (com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup)2 DebuggerSupport (com.intellij.xdebugger.impl.DebuggerSupport)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 TreeNode (javax.swing.tree.TreeNode)2 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 TreeState (com.intellij.ide.util.treeView.TreeState)1 XBreakpointGroupingRule (com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule)1 BreakpointPanelProvider (com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider)1 XBreakpointCustomGroup (com.intellij.xdebugger.impl.breakpoints.ui.grouping.XBreakpointCustomGroup)1 ArrayList (java.util.ArrayList)1 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1 Nullable (org.jetbrains.annotations.Nullable)1