Search in sources :

Example 1 with WatchNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode in project google-cloud-intellij by GoogleCloudPlatform.

the class BreakpointConfigurationPanel method removeWatches.

@Override
public void removeWatches(List<? extends XDebuggerTreeNode> nodes) {
    List<? extends WatchNode> children = rootNode.getAllChildren();
    int minIndex = Integer.MAX_VALUE;
    List<XDebuggerTreeNode> toRemove = new ArrayList<XDebuggerTreeNode>();
    if (children != null) {
        for (XDebuggerTreeNode node : nodes) {
            @SuppressWarnings("SuspiciousMethodCalls") int index = children.indexOf(node);
            if (index != -1) {
                toRemove.add(node);
                minIndex = Math.min(minIndex, index);
            }
        }
    }
    rootNode.removeChildren(toRemove);
    List<? extends WatchNode> newChildren = rootNode.getAllChildren();
    if (newChildren != null && !newChildren.isEmpty()) {
        WatchNode node = minIndex < newChildren.size() ? newChildren.get(minIndex) : newChildren.get(newChildren.size() - 1);
        TreeUtil.selectNode(treePanel.getTree(), node);
    }
}
Also used : WatchNode(com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode) ArrayList(java.util.ArrayList) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode) XLineBreakpoint(com.intellij.xdebugger.breakpoints.XLineBreakpoint) Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint)

Example 2 with WatchNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode in project google-cloud-intellij by GoogleCloudPlatform.

the class BreakpointConfigurationPanel method saveTo.

@SuppressWarnings("ConstantConditions")
@Override
public void saveTo(@NotNull final XLineBreakpoint<CloudLineBreakpointProperties> ideBreakpoint) {
    CloudLineBreakpointProperties properties = ideBreakpoint.getProperties();
    if (properties == null) {
        LOG.error("Could not save changes to the breakpoint because for some reason it does not have cloud " + "properties.");
        return;
    }
    XBreakpointBase lineBreakpointImpl = ideBreakpoint instanceof XBreakpointBase ? (XBreakpointBase) ideBreakpoint : null;
    if (rootNode != null && lineBreakpointImpl != null) {
        List<String> expressionsToSave = new ArrayList<String>();
        List<? extends WatchNode> children = rootNode.getAllChildren();
        if (children != null) {
            for (WatchNode node : rootNode.getAllChildren()) {
                expressionsToSave.add(node.getExpression().getExpression());
            }
            if (properties.setWatchExpressions(expressionsToSave.toArray(new String[expressionsToSave.size()]))) {
                lineBreakpointImpl.fireBreakpointChanged();
            }
        }
    }
}
Also used : WatchNode(com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode) XBreakpointBase(com.intellij.xdebugger.impl.breakpoints.XBreakpointBase) ArrayList(java.util.ArrayList) CloudLineBreakpointProperties(com.google.cloud.tools.intellij.debugger.CloudLineBreakpointProperties)

Example 3 with WatchNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode in project intellij-community by JetBrains.

the class XSetValueAction method update.

@Override
public void update(final AnActionEvent e) {
    super.update(e);
    XValueNodeImpl node = getSelectedNode(e.getDataContext());
    Presentation presentation = e.getPresentation();
    if (node instanceof WatchNode) {
        presentation.setVisible(false);
        presentation.setEnabled(false);
    } else {
        presentation.setVisible(true);
    }
}
Also used : WatchNode(com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) Presentation(com.intellij.openapi.actionSystem.Presentation)

Aggregations

WatchNode (com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode)3 ArrayList (java.util.ArrayList)2 CloudLineBreakpointProperties (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointProperties)1 Breakpoint (com.intellij.debugger.ui.breakpoints.Breakpoint)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 XLineBreakpoint (com.intellij.xdebugger.breakpoints.XLineBreakpoint)1 XBreakpointBase (com.intellij.xdebugger.impl.breakpoints.XBreakpointBase)1 XDebuggerTreeNode (com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)1 XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)1