Search in sources :

Example 1 with XDebuggerTreeState

use of com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState 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 2 with XDebuggerTreeState

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

the class DebuggerUIUtil method setTreeNodeValue.

public static void setTreeNodeValue(XValueNodeImpl valueNode, String text, Consumer<String> errorConsumer) {
    XDebuggerTree tree = valueNode.getTree();
    Project project = tree.getProject();
    XValueModifier modifier = valueNode.getValueContainer().getModifier();
    if (modifier == null)
        return;
    XDebuggerTreeState treeState = XDebuggerTreeState.saveState(tree);
    valueNode.setValueModificationStarted();
    modifier.setValue(text, new XValueModifier.XModificationCallback() {

        @Override
        public void valueModified() {
            if (tree.isDetached()) {
                AppUIUtil.invokeOnEdt(() -> tree.rebuildAndRestore(treeState));
            }
            XDebuggerUtilImpl.rebuildAllSessionsViews(project);
        }

        @Override
        public void errorOccurred(@NotNull final String errorMessage) {
            AppUIUtil.invokeOnEdt(() -> {
                tree.rebuildAndRestore(treeState);
                errorConsumer.consume(errorMessage);
            });
            XDebuggerUtilImpl.rebuildAllSessionsViews(project);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) XDebuggerTreeState(com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState) XValueModifier(com.intellij.xdebugger.frame.XValueModifier) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)

Aggregations

XDebuggerTreeState (com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState)2 Project (com.intellij.openapi.project.Project)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 XValue (com.intellij.xdebugger.frame.XValue)1 XValueModifier (com.intellij.xdebugger.frame.XValueModifier)1 XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)1 ValueMarkerPresentationDialog (com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog)1 ValueMarkup (com.intellij.xdebugger.impl.ui.tree.ValueMarkup)1 XDebuggerTree (com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)1 XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)1