本文整理汇总了Java中com.intellij.xdebugger.frame.XStackFrame.getEvaluator方法的典型用法代码示例。如果您正苦于以下问题:Java XStackFrame.getEvaluator方法的具体用法?Java XStackFrame.getEvaluator怎么用?Java XStackFrame.getEvaluator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.xdebugger.frame.XStackFrame
的用法示例。
在下文中一共展示了XStackFrame.getEvaluator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createValueHint
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的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);
}
});
}
示例2: getTextToEvaluate
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的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;
}
示例3: getEvaluator
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
@Nullable
@Override
public XDebuggerEvaluator getEvaluator() {
final XStackFrame currentStackFrame = getSession().getCurrentStackFrame();
if (currentStackFrame == null) return null;
return currentStackFrame.getEvaluator();
}
示例4: getEvaluator
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
@Nullable
public static XDebuggerEvaluator getEvaluator(final XSuspendContext suspendContext) {
XExecutionStack executionStack = suspendContext.getActiveExecutionStack();
if (executionStack != null) {
XStackFrame stackFrame = executionStack.getTopFrame();
if (stackFrame != null) {
return stackFrame.getEvaluator();
}
}
return null;
}
示例5: isEnabled
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
public boolean isEnabled(@NotNull final Project project) {
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session == null || !session.isSuspended()) {
return false;
}
XStackFrame stackFrame = session.getCurrentStackFrame();
return stackFrame != null && stackFrame.getEvaluator() != null;
}
示例6: getValueLookupDelay
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
public int getValueLookupDelay(final Project project) {
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session != null) {
XStackFrame stackFrame = session.getCurrentStackFrame();
if (stackFrame != null) {
XDebuggerEvaluator evaluator = stackFrame.getEvaluator();
if (evaluator != null) {
return evaluator.getValuePopupDelay();
}
}
}
return 700;
}
示例7: perform
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) {
XDebuggerEditorsProvider editorsProvider = session.getDebugProcess().getEditorsProvider();
XStackFrame stackFrame = session.getCurrentStackFrame();
if (stackFrame == null) return;
final XDebuggerEvaluator evaluator = stackFrame.getEvaluator();
if (evaluator == null) return;
@Nullable Project project = PlatformDataKeys.PROJECT.getData(dataContext);
@Nullable Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
String selectedText = editor != null ? editor.getSelectionModel().getSelectedText() : null;
if (selectedText != null) {
selectedText = evaluator.formatTextForEvaluation(selectedText);
}
String text = selectedText;
if (text == null && editor != null) {
Document document = editor.getDocument();
TextRange range = evaluator.getExpressionRangeAtOffset(project, document, editor.getCaretModel().getOffset(), true);
text = range == null ? null : document.getText(range);
}
if (text == null) {
XValue value = XDebuggerTreeActionBase.getSelectedValue(dataContext);
if (value != null) {
text = value.getEvaluationExpression();
}
}
if (text == null) {
text = "";
}
final XDebuggerEvaluationDialog dialog = new XDebuggerEvaluationDialog(session, editorsProvider, evaluator, text,
stackFrame.getSourcePosition());
dialog.show();
}
示例8: isEnabled
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
protected boolean isEnabled(final @NotNull XDebugSession session, final DataContext dataContext) {
if (!super.isEnabled(session, dataContext)) {
return false;
}
XStackFrame stackFrame = session.getCurrentStackFrame();
return stackFrame != null && stackFrame.getEvaluator() != null;
}
示例9: addWatchExpression
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
public void addWatchExpression(@NotNull String expression, int index, final boolean navigateToWatchNode) {
XDebuggerEvaluator evaluator = null;
XStackFrame stackFrame = mySession.getCurrentStackFrame();
if (stackFrame != null) {
evaluator = stackFrame.getEvaluator();
}
myRootNode.addWatchExpression(evaluator, expression, index, navigateToWatchNode);
updateSessionData();
}
示例10: getEvaluator
import com.intellij.xdebugger.frame.XStackFrame; //导入方法依赖的package包/类
@Nullable
public XDebuggerEvaluator getEvaluator() {
XStackFrame frame = getSession().getCurrentStackFrame();
return frame == null ? null : frame.getEvaluator();
}