Search in sources :

Example 1 with EvaluatingExpressionRootNode

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

the class XDebuggerEvaluationDialog method evaluate.

private void evaluate() {
    final XDebuggerEditorBase inputEditor = getInputEditor();
    int offset = -1;
    //try to save caret position
    Editor editor = inputEditor.getEditor();
    if (editor != null) {
        offset = editor.getCaretModel().getOffset();
    }
    final XDebuggerTree tree = myTreePanel.getTree();
    tree.markNodesObsolete();
    tree.setRoot(new EvaluatingExpressionRootNode(this, tree), false);
    myResultPanel.invalidate();
    //editor is already changed
    editor = inputEditor.getEditor();
    //selectAll puts focus back
    inputEditor.selectAll();
    //try to restore caret position and clear selection
    if (offset >= 0 && editor != null) {
        offset = Math.min(editor.getDocument().getTextLength(), offset);
        editor.getCaretModel().moveToOffset(offset);
        editor.getSelectionModel().setSelection(offset, offset);
    }
}
Also used : EvaluatingExpressionRootNode(com.intellij.xdebugger.impl.ui.tree.nodes.EvaluatingExpressionRootNode) XDebuggerEditorBase(com.intellij.xdebugger.impl.ui.XDebuggerEditorBase) Editor(com.intellij.openapi.editor.Editor) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)

Aggregations

Editor (com.intellij.openapi.editor.Editor)1 XDebuggerEditorBase (com.intellij.xdebugger.impl.ui.XDebuggerEditorBase)1 XDebuggerTree (com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)1 EvaluatingExpressionRootNode (com.intellij.xdebugger.impl.ui.tree.nodes.EvaluatingExpressionRootNode)1