Search in sources :

Example 11 with XValueNodeImpl

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

the class XFetchValueActionBase method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    List<XValueNodeImpl> nodes = XDebuggerTreeActionBase.getSelectedNodes(e.getDataContext());
    if (nodes.isEmpty()) {
        return;
    }
    ValueCollector valueCollector = createCollector(e);
    for (XValueNodeImpl node : nodes) {
        addToCollector(nodes, node, valueCollector);
    }
    valueCollector.processed = true;
    valueCollector.finish();
}
Also used : XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)

Example 12 with XValueNodeImpl

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

the class XDebuggerEditorLinePainter method getLineExtensions.

@Override
public Collection<LineExtensionInfo> getLineExtensions(@NotNull Project project, @NotNull VirtualFile file, int lineNumber) {
    if (!XDebuggerSettingsManager.getInstance().getDataViewSettings().isShowValuesInline()) {
        return null;
    }
    XVariablesView.InlineVariablesInfo data = project.getUserData(XVariablesView.DEBUG_VARIABLES);
    final Document doc = FileDocumentManager.getInstance().getDocument(file);
    if (data == null || doc == null) {
        return null;
    }
    Map<Variable, VariableValue> oldValues = project.getUserData(CACHE);
    if (oldValues == null) {
        oldValues = new HashMap<>();
        project.putUserData(CACHE, oldValues);
    }
    List<XValueNodeImpl> values = data.get(file, lineNumber, doc.getModificationStamp());
    if (values != null && !values.isEmpty()) {
        XDebugSession session = XDebugView.getSession(values.iterator().next().getTree());
        final int bpLine = getCurrentBreakPointLineInFile(session, file);
        boolean isTopFrame = session instanceof XDebugSessionImpl && ((XDebugSessionImpl) session).isTopFrameSelected();
        final TextAttributes attributes = bpLine == lineNumber && isTopFrame && ((XDebuggerManagerImpl) XDebuggerManager.getInstance(project)).isFullLineHighlighter() ? getTopFrameSelectedAttributes() : getNormalAttributes();
        ArrayList<VariableText> result = new ArrayList<>();
        for (XValueNodeImpl value : values) {
            SimpleColoredText text = new SimpleColoredText();
            XValueTextRendererImpl renderer = new XValueTextRendererImpl(text);
            final XValuePresentation presentation = value.getValuePresentation();
            if (presentation == null)
                continue;
            try {
                if (presentation instanceof XValueCompactPresentation && !value.getTree().isUnderRemoteDebug()) {
                    ((XValueCompactPresentation) presentation).renderValue(renderer, value);
                } else {
                    presentation.renderValue(renderer);
                }
                if (StringUtil.isEmpty(text.toString())) {
                    final String type = value.getValuePresentation().getType();
                    if (!StringUtil.isEmpty(type)) {
                        text.append(type, SimpleTextAttributes.REGULAR_ATTRIBUTES);
                    }
                }
            } catch (Exception ignored) {
                continue;
            }
            final String name = value.getName();
            if (StringUtil.isEmpty(text.toString())) {
                continue;
            }
            final VariableText res = new VariableText();
            result.add(res);
            res.add(new LineExtensionInfo("  " + name + ": ", attributes));
            Variable var = new Variable(name, lineNumber);
            VariableValue variableValue = oldValues.computeIfAbsent(var, k -> new VariableValue(text.toString(), null, value.hashCode()));
            if (variableValue.valueNodeHashCode != value.hashCode()) {
                variableValue.old = variableValue.actual;
                variableValue.actual = text.toString();
                variableValue.valueNodeHashCode = value.hashCode();
            }
            if (!variableValue.isChanged()) {
                for (String s : text.getTexts()) {
                    res.add(new LineExtensionInfo(s, attributes));
                }
            } else {
                variableValue.produceChangedParts(res.infos);
            }
        }
        final List<LineExtensionInfo> infos = new ArrayList<>();
        for (VariableText text : result) {
            infos.addAll(text.infos);
        }
        return infos.size() > LINE_EXTENSIONS_MAX_COUNT ? infos.subList(0, LINE_EXTENSIONS_MAX_COUNT) : infos;
    }
    return null;
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) XValuePresentation(com.intellij.xdebugger.frame.presentation.XValuePresentation) LineExtensionInfo(com.intellij.openapi.editor.LineExtensionInfo) Document(com.intellij.openapi.editor.Document) TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) XDebuggerManagerImpl(com.intellij.xdebugger.impl.XDebuggerManagerImpl) XValueTextRendererImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueTextRendererImpl) XVariablesView(com.intellij.xdebugger.impl.frame.XVariablesView) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 13 with XValueNodeImpl

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

the class XDebuggerInstanceTreeCreator method createTree.

@NotNull
@Override
public Tree createTree(@NotNull Pair<XInstanceEvaluator, String> descriptor) {
    final XDebuggerTree tree = new XDebuggerTree(myProject, myProvider, myPosition, XDebuggerActions.INSPECT_TREE_POPUP_GROUP, myMarkers);
    final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(), new InstanceEvaluatorTreeRootValue(descriptor.getFirst(), descriptor.getSecond()));
    tree.setRoot(root, false);
    Condition<TreeNode> visibleRootCondition = node -> node.getParent() == root;
    tree.expandNodesOnLoad(visibleRootCondition);
    tree.selectNodeOnLoad(visibleRootCondition);
    return tree;
}
Also used : XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) TreeNode(javax.swing.tree.TreeNode) XDebuggerActions(com.intellij.xdebugger.impl.actions.XDebuggerActions) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree) ResultConsumer(com.intellij.concurrency.ResultConsumer) XDebuggerEditorsProvider(com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider) XSourcePosition(com.intellij.xdebugger.XSourcePosition) XInstanceEvaluator(com.intellij.xdebugger.evaluation.XInstanceEvaluator) com.intellij.xdebugger.frame(com.intellij.xdebugger.frame) Pair(com.intellij.openapi.util.Pair) Project(com.intellij.openapi.project.Project) Tree(com.intellij.ui.treeStructure.Tree) DebuggerTreeCreator(com.intellij.xdebugger.impl.evaluate.quick.common.DebuggerTreeCreator) XValueMarkers(com.intellij.xdebugger.impl.frame.XValueMarkers) NotNull(org.jetbrains.annotations.NotNull) XDebugSession(com.intellij.xdebugger.XDebugSession) Condition(com.intellij.openapi.util.Condition) XDebuggerEvaluator(com.intellij.xdebugger.evaluation.XDebuggerEvaluator) TreeNode(javax.swing.tree.TreeNode) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with XValueNodeImpl

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

the class XDebuggerInstanceTreeCreator method createDescriptorByNode.

@Override
public void createDescriptorByNode(Object node, ResultConsumer<Pair<XInstanceEvaluator, String>> resultConsumer) {
    if (node instanceof XValueNodeImpl) {
        XValueNodeImpl valueNode = (XValueNodeImpl) node;
        resultConsumer.onSuccess(Pair.create(valueNode.getValueContainer().getInstanceEvaluator(), valueNode.getName()));
    }
}
Also used : XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)

Example 15 with XValueNodeImpl

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

the class XDebuggerTreeCreator method createTree.

@NotNull
@Override
public Tree createTree(@NotNull Pair<XValue, String> descriptor) {
    final XDebuggerTree tree = new XDebuggerTree(myProject, myProvider, myPosition, XDebuggerActions.INSPECT_TREE_POPUP_GROUP, myMarkers);
    final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(), descriptor.getFirst());
    tree.setRoot(root, true);
    tree.setSelectionRow(0);
    // expand root on load
    tree.expandNodesOnLoad(node -> node == root);
    return tree;
}
Also used : XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)22 NotNull (org.jetbrains.annotations.NotNull)7 Project (com.intellij.openapi.project.Project)6 XValue (com.intellij.xdebugger.frame.XValue)6 XDebugSession (com.intellij.xdebugger.XDebugSession)5 XDebuggerTree (com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)5 TreePath (javax.swing.tree.TreePath)5 JavaValue (com.intellij.debugger.engine.JavaValue)4 ObjectReference (com.sun.jdi.ObjectReference)3 Nullable (org.jetbrains.annotations.Nullable)3 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)2 XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)2 ResultConsumer (com.intellij.concurrency.ResultConsumer)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 MemoryViewDebugProcessData (com.intellij.debugger.memory.component.MemoryViewDebugProcessData)1 InstancesWindow (com.intellij.debugger.memory.ui.InstancesWindow)1 NodeDescriptorProvider (com.intellij.debugger.ui.impl.watch.NodeDescriptorProvider)1