Search in sources :

Example 1 with XDebuggerEditorBase

use of com.intellij.xdebugger.impl.ui.XDebuggerEditorBase 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)

Example 2 with XDebuggerEditorBase

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

the class XDebuggerEvaluationDialog method startEvaluation.

public void startEvaluation(@NotNull XDebuggerEvaluator.XEvaluationCallback evaluationCallback) {
    final XDebuggerEditorBase inputEditor = getInputEditor();
    inputEditor.saveTextInHistory();
    XExpression expression = inputEditor.getExpression();
    XDebuggerEvaluator evaluator = mySession.getDebugProcess().getEvaluator();
    if (evaluator == null) {
        evaluationCallback.errorOccurred(XDebuggerBundle.message("xdebugger.evaluate.stack.frame.has.not.evaluator"));
    } else {
        evaluator.evaluate(expression, evaluationCallback, null);
    }
}
Also used : XDebuggerEvaluator(com.intellij.xdebugger.evaluation.XDebuggerEvaluator) XDebuggerEditorBase(com.intellij.xdebugger.impl.ui.XDebuggerEditorBase)

Aggregations

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