当前位置: 首页>>代码示例>>Java>>正文


Java XDebuggerEvaluator类代码示例

本文整理汇总了Java中com.intellij.xdebugger.evaluation.XDebuggerEvaluator的典型用法代码示例。如果您正苦于以下问题:Java XDebuggerEvaluator类的具体用法?Java XDebuggerEvaluator怎么用?Java XDebuggerEvaluator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XDebuggerEvaluator类属于com.intellij.xdebugger.evaluation包,在下文中一共展示了XDebuggerEvaluator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluateAndAct

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
private static void evaluateAndAct(Project project,
                                   JavaStackFrame stackFrame,
                                   StringBuilder sb,
                                   XDebuggerEvaluator.XEvaluationCallback callback) {
  XDebuggerEvaluator evaluator = stackFrame.getEvaluator();
  if (evaluator != null) {
    evaluator.evaluate(XExpressionImpl.fromText(sb.toString(), EvaluationMode.CODE_FRAGMENT),
                       callback,
                       stackFrame.getSourcePosition());
  }
  else {
    Messages.showMessageDialog(project, XDebuggerBundle.message("xdebugger.evaluate.stack.frame.has.not.evaluator"),
                               UIUtil.removeMnemonic(ActionsBundle.actionText(DebuggerActions.POP_FRAME)),
                               Messages.getErrorIcon());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PopFrameAction.java

示例2: XValueHint

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
public XValueHint(@NotNull Project project, @NotNull Editor editor, @NotNull Point point, @NotNull ValueHintType type,
                  @NotNull ExpressionInfo expressionInfo, @NotNull XDebuggerEvaluator evaluator,
                  @NotNull XDebugSession session) {
  super(project, editor, point, type, expressionInfo.getTextRange());

  myEvaluator = evaluator;
  myDebugSession = session;
  myExpression = XDebuggerEvaluateActionHandler.getExpressionText(expressionInfo, editor.getDocument());
  myValueName = XDebuggerEvaluateActionHandler.getDisplayText(expressionInfo, editor.getDocument());
  myExpressionInfo = expressionInfo;

  VirtualFile file;
  ConsoleView consoleView = ConsoleViewImpl.CONSOLE_VIEW_IN_EDITOR_VIEW.get(editor);
  if (consoleView instanceof LanguageConsoleView) {
    LanguageConsoleView console = ((LanguageConsoleView)consoleView);
    file = console.getHistoryViewer() == editor ? console.getVirtualFile() : null;
  }
  else {
    file = FileDocumentManager.getInstance().getFile(editor.getDocument());
  }

  myExpressionPosition = file != null ? XDebuggerUtil.getInstance().createPositionByOffset(file, expressionInfo.getTextRange().getStartOffset()) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:XValueHint.java

示例3: computeChildren

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Override
public void computeChildren(@NotNull final XCompositeNode node) {
  XStackFrame frame = mySession.getCurrentStackFrame();
  if (frame != null) {
    myInstanceEvaluator.evaluate(new XDebuggerEvaluator.XEvaluationCallback() {
      @Override
      public void evaluated(@NotNull XValue result) {
        node.addChildren(XValueChildrenList.singleton(myName, result), true);
      }

      @Override
      public void errorOccurred(@NotNull String errorMessage) {

      }
    }, frame);
  }
  else {
    node.setErrorMessage("Frame is not available");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:XDebuggerInstanceTreeCreator.java

示例4: getTextToEvaluate

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Nullable
protected static String getTextToEvaluate(DataContext dataContext, XDebugSession session) {
  final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
  if (editor == null) {
    return null;
  }

  String text = editor.getSelectionModel().getSelectedText();
  if (text == null) {
    XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();
    if (evaluator != null) {
      text = XDebuggerEvaluateActionHandler.getExpressionText(evaluator, editor.getProject(), editor);
    }
  }

  return StringUtil.nullize(text, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XAddToWatchesFromEditorActionHandler.java

示例5: addWatchExpression

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
public void addWatchExpression(final @Nullable XDebuggerEvaluator evaluator,
                               final @NotNull XExpression expression,
                               int index, final boolean navigateToWatchNode) {
  WatchMessageNode message = evaluator != null ? WatchMessageNode.createEvaluatingNode(myTree, this, expression) : WatchMessageNode.createMessageNode(myTree, this, expression);
  if (index == -1) {
    myChildren.add(message);
    index = myChildren.size() - 1;
  }
  else {
    myChildren.add(index, message);
  }
  fireNodeInserted(index);
  if (navigateToWatchNode) {
    myTree.scrollPathToVisible(message.getPath());
  }
  if (evaluator != null) {
    evaluator.evaluate(expression, new MyEvaluationCallback(message), null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:WatchesRootNode.java

示例6: startComputingChildren

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Override
public void startComputingChildren() {
  if (Registry.is("debugger.watches.in.variables")) {
    XDebugSession session = XDebugView.getSession(getTree());
    XDebuggerEvaluator evaluator = getValueContainer().getEvaluator();
    if (session != null && evaluator != null) {
      XDebugSessionData data = ((XDebugSessionImpl)session).getSessionData();
      XExpression[] expressions = data.getWatchExpressions();
      for (final XExpression expression : expressions) {
        evaluator.evaluate(expression, new XDebuggerEvaluator.XEvaluationCallback() {
          @Override
          public void evaluated(@NotNull XValue result) {
            addChildren(XValueChildrenList.singleton(expression.getExpression(), result), false);
          }

          @Override
          public void errorOccurred(@NotNull String errorMessage) {
            // do not add anything
          }
        }, getValueContainer().getSourcePosition());
      }
    }
  }
  super.startComputingChildren();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:XStackFrameNode.java

示例7: selectionChanged

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Override
public void selectionChanged(final SelectionEvent e) {
  if (!Registry.is("debugger.valueTooltipAutoShowOnSelection") || myEditor.getCaretModel().getCaretCount() > 1) {
    return;
  }
  final String text = myEditor.getDocument().getText(e.getNewRange());
  if (!StringUtil.isEmpty(text) && !(text.contains("exec(") || text.contains("++") || text.contains("--") || text.contains("="))) {
    final XDebugSession session = getSession(getTree());
    if (session == null) return;
    XDebuggerEvaluator evaluator = myStackFrame.getEvaluator();
    if (evaluator == null) return;
    TextRange range = e.getNewRange();
    ExpressionInfo info = new ExpressionInfo(range);
    int offset = range.getStartOffset();
    LogicalPosition pos = myEditor.offsetToLogicalPosition(offset);
    Point point = myEditor.logicalPositionToXY(pos);
    new XValueHint(myProject, myEditor, point, ValueHintType.MOUSE_OVER_HINT, info, evaluator, session).invokeHint();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XVariablesViewBase.java

示例8: createValueHint

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
public AbstractValueHint createValueHint(@NotNull final Project project, @NotNull final Editor editor, @NotNull final Point point, final ValueHintType type) {
  final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  if (session == null) return null;

  XStackFrame stackFrame = session.getCurrentStackFrame();
  if (stackFrame == null) return null;
  final XDebuggerEvaluator evaluator = stackFrame.getEvaluator();
  if (evaluator == null) return null;

  return PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Computable<XValueHint>() {
    public XValueHint compute() {
      int offset = AbstractValueHint.calculateOffset(editor, point);
      TextRange range = getExpressionRange(evaluator, project, type, editor, offset);
      if (range == null) return null;
      int textLength = editor.getDocument().getTextLength();
      if (range.getStartOffset() > range.getEndOffset() || range.getStartOffset() < 0 || range.getEndOffset() > textLength) {
        LOG.error("invalid range: " + range + ", text length = " + textLength + ", evaluator: " + evaluator);
        return null;
      }

      return new XValueHint(project, editor, point, type, range, evaluator, session);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:XQuickEvaluateHandler.java

示例9: getTextToEvaluate

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Nullable
private static String getTextToEvaluate(DataContext dataContext, XDebugSession session) {
  final Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
  if (editor == null) {
    return null;
  }

  String text = editor.getSelectionModel().getSelectedText();
  if (text == null && session.isSuspended()) {
    final XStackFrame stackFrame = session.getCurrentStackFrame();
    if (stackFrame != null) {
      final XDebuggerEvaluator evaluator = stackFrame.getEvaluator();
      if (evaluator != null) {
        final int offset = editor.getCaretModel().getOffset();
        final Document document = editor.getDocument();
        final TextRange textRange = evaluator.getExpressionRangeAtOffset(session.getProject(), document, offset, false);
        if (textRange != null) {
          text = document.getText(textRange);
        }
      }
    }
  }

  return StringUtil.isEmptyOrSpaces(text) ? null : text;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:XAddToWatchesFromEditorActionHandler.java

示例10: addWatchExpression

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
public void addWatchExpression(final @Nullable XDebuggerEvaluator evaluator,
                               final @NotNull String expression,
                               int index, final boolean navigateToWatchNode) {
  WatchMessageNode message = evaluator != null ? WatchMessageNode.createEvaluatingNode(myTree, this, expression) : WatchMessageNode.createMessageNode(myTree, this, expression);
  if (index == -1) {
    myChildren.add(message);
    index = myChildren.size() - 1;
  }
  else {
    myChildren.add(index, message);
  }
  fireNodeInserted(index);
  if (navigateToWatchNode) {
    myTree.scrollPathToVisible(message.getPath());
  }
  if (evaluator != null) {
    evaluator.evaluate(expression, new MyEvaluationCallback(message), null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:WatchesRootNode.java

示例11: XValueHint

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
public XValueHint(@Nonnull Project project, @Nonnull Editor editor, @Nonnull Point point, @Nonnull ValueHintType type,
                  @Nonnull ExpressionInfo expressionInfo, @Nonnull XDebuggerEvaluator evaluator,
                  @Nonnull XDebugSession session) {
  super(project, editor, point, type, expressionInfo.getTextRange());

  myEvaluator = evaluator;
  myDebugSession = session;
  myExpression = XDebuggerEvaluateActionHandler.getExpressionText(expressionInfo, editor.getDocument());
  myValueName = XDebuggerEvaluateActionHandler.getDisplayText(expressionInfo, editor.getDocument());
  myExpressionInfo = expressionInfo;

  VirtualFile file;
  ConsoleView consoleView = ConsoleViewImpl.CONSOLE_VIEW_IN_EDITOR_VIEW.get(editor);
  if (consoleView instanceof LanguageConsoleView) {
    LanguageConsoleView console = ((LanguageConsoleView)consoleView);
    file = console.getHistoryViewer() == editor ? console.getVirtualFile() : null;
  }
  else {
    file = FileDocumentManager.getInstance().getFile(editor.getDocument());
  }

  myExpressionPosition = file != null ? XDebuggerUtil.getInstance().createPositionByOffset(file, expressionInfo.getTextRange().getStartOffset()) : null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:XValueHint.java

示例12: getExpressionInfo

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Nullable
private static ExpressionInfo getExpressionInfo(final XDebuggerEvaluator evaluator,
                                                final Project project,
                                                final ValueHintType type,
                                                final Editor editor,
                                                final int offset) {
  SelectionModel selectionModel = editor.getSelectionModel();
  int selectionStart = selectionModel.getSelectionStart();
  int selectionEnd = selectionModel.getSelectionEnd();
  if ((type == ValueHintType.MOUSE_CLICK_HINT || type == ValueHintType.MOUSE_ALT_OVER_HINT) &&
      selectionModel.hasSelection() &&
      selectionStart <= offset &&
      offset <= selectionEnd) {
    return new ExpressionInfo(new TextRange(selectionStart, selectionEnd));
  }
  return evaluator.getExpressionInfoAtOffset(project, editor.getDocument(), offset,
                                             type == ValueHintType.MOUSE_CLICK_HINT || type == ValueHintType.MOUSE_ALT_OVER_HINT);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:XQuickEvaluateHandler.java

示例13: getTextToEvaluate

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Nullable
protected static String getTextToEvaluate(DataContext dataContext, XDebugSession session) {
  final Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
  if (editor == null) {
    return null;
  }

  String text = editor.getSelectionModel().getSelectedText();
  if (text == null) {
    XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();
    if (evaluator != null) {
      text = XDebuggerEvaluateActionHandler.getExpressionText(evaluator, editor.getProject(), editor);
    }
  }

  return StringUtil.nullize(text, true);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:XAddToWatchesFromEditorActionHandler.java

示例14: selectionChanged

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Override
public void selectionChanged(final SelectionEvent e) {
  if (!XDebuggerSettingsManager.getInstance().getDataViewSettings().isValueTooltipAutoShowOnSelection() || myEditor.getCaretModel().getCaretCount() > 1) {
    return;
  }
  final String text = myEditor.getDocument().getText(e.getNewRange());
  if (!StringUtil.isEmpty(text) && !(text.contains("exec(") || text.contains("++") || text.contains("--") || text.contains("="))) {
    final XDebugSession session = getSession(getTree());
    if (session == null) return;
    XDebuggerEvaluator evaluator = myStackFrame.getEvaluator();
    if (evaluator == null) return;
    TextRange range = e.getNewRange();
    ExpressionInfo info = new ExpressionInfo(range);
    int offset = range.getStartOffset();
    LogicalPosition pos = myEditor.offsetToLogicalPosition(offset);
    Point point = myEditor.logicalPositionToXY(pos);
    new XValueHint(myProject, myEditor, point, ValueHintType.MOUSE_OVER_HINT, info, evaluator, session).invokeHint();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:XVariablesViewBase.java

示例15: getEvaluator

import com.intellij.xdebugger.evaluation.XDebuggerEvaluator; //导入依赖的package包/类
@Nullable
@Override
public XDebuggerEvaluator getEvaluator() {
    final XStackFrame currentStackFrame = getSession().getCurrentStackFrame();

    if (currentStackFrame == null) return null;

    return currentStackFrame.getEvaluator();
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:10,代码来源:LuaDebugProcess.java


注:本文中的com.intellij.xdebugger.evaluation.XDebuggerEvaluator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。