Search in sources :

Example 6 with XValueNodeImpl

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

the class XDebuggerTreeCreator method createDescriptorByNode.

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

Example 7 with XValueNodeImpl

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

the class XMarkObjectActionHandler method perform.

@Override
public void perform(@NotNull Project project, AnActionEvent event) {
    XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    if (session == null)
        return;
    XValueMarkers<?, ?> markers = ((XDebugSessionImpl) session).getValueMarkers();
    XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
    if (markers == null || node == null)
        return;
    XValue value = node.getValueContainer();
    boolean detachedView = DebuggerUIUtil.isInDetachedTree(event);
    XDebuggerTreeState treeState = XDebuggerTreeState.saveState(node.getTree());
    ValueMarkup existing = markers.getMarkup(value);
    if (existing != null) {
        markers.unmarkValue(value);
    } else {
        ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(event.getData(CONTEXT_COMPONENT), node.getName());
        dialog.show();
        ValueMarkup markup = dialog.getConfiguredMarkup();
        if (dialog.isOK() && markup != null) {
            markers.markValue(value, markup);
        }
    }
    if (detachedView) {
        node.getTree().rebuildAndRestore(treeState);
    }
    session.rebuildViews();
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) XDebuggerTreeState(com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState) ValueMarkerPresentationDialog(com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XValue(com.intellij.xdebugger.frame.XValue) ValueMarkup(com.intellij.xdebugger.impl.ui.tree.ValueMarkup) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 8 with XValueNodeImpl

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

the class XDebuggerTreeRenderer method customizeCellRenderer.

public void customizeCellRenderer(@NotNull final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
    myHaveLink = false;
    myLink.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    XDebuggerTreeNode node = (XDebuggerTreeNode) value;
    node.appendToComponent(this);
    setIcon(node.getIcon());
    Rectangle treeVisibleRect = tree.getParent() instanceof JViewport ? ((JViewport) tree.getParent()).getViewRect() : tree.getVisibleRect();
    TreePath path = tree.getPathForRow(row);
    int rowX = path != null ? getRowX((BasicTreeUI) tree.getUI(), row, path.getPathCount() - 1) : 0;
    if (myHaveLink) {
        setupLinkDimensions(treeVisibleRect, rowX);
    } else {
        int visibleRectRightX = treeVisibleRect.x + treeVisibleRect.width;
        int notFittingWidth = rowX + super.getPreferredSize().width - visibleRectRightX;
        if (node instanceof XValueNodeImpl && notFittingWidth > 0) {
            // text does not fit visible area - show link
            String rawValue = DebuggerUIUtil.getNodeRawValue((XValueNodeImpl) node);
            if (!StringUtil.isEmpty(rawValue) && tree.isShowing()) {
                Point treeRightSideOnScreen = new Point(visibleRectRightX, 0);
                SwingUtilities.convertPointToScreen(treeRightSideOnScreen, tree);
                Rectangle screen = ScreenUtil.getScreenRectangle(treeRightSideOnScreen);
                // text may fit the screen in ExpandableItemsHandler
                if (screen.x + screen.width < treeRightSideOnScreen.x + notFittingWidth) {
                    myLongTextLink.setupComponent(rawValue, ((XDebuggerTree) tree).getProject());
                    append(myLongTextLink.getLinkText(), myLongTextLink.getTextAttributes(), myLongTextLink);
                    setupLinkDimensions(treeVisibleRect, rowX);
                    myLinkWidth = 0;
                }
            }
        }
    }
    putClientProperty(ExpandableItemsHandler.RENDERER_DISABLED, myHaveLink);
}
Also used : TreePath(javax.swing.tree.TreePath) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) BasicTreeUI(javax.swing.plaf.basic.BasicTreeUI) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)

Example 9 with XValueNodeImpl

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

the class XDebuggerTreeActionBase method update.

@Override
public void update(final AnActionEvent e) {
    XValueNodeImpl node = getSelectedNode(e.getDataContext());
    e.getPresentation().setEnabled(node != null && isEnabled(node, e));
}
Also used : XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)

Example 10 with XValueNodeImpl

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

the class XDebuggerTreeActionBase method getSelectedNodes.

@NotNull
public static List<XValueNodeImpl> getSelectedNodes(DataContext dataContext) {
    XDebuggerTree tree = XDebuggerTree.getTree(dataContext);
    if (tree == null)
        return Collections.emptyList();
    TreePath[] paths = tree.getSelectionPaths();
    if (paths == null || paths.length == 0) {
        return Collections.emptyList();
    }
    return StreamEx.of(paths).map(TreePath::getLastPathComponent).select(XValueNodeImpl.class).toList();
}
Also used : TreePath(javax.swing.tree.TreePath) 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