xdebugger api: position passed to 'evaluate' method when showing value tooltip in...
[fedora-idea.git] / platform / xdebugger-api / src / com / intellij / xdebugger / evaluation / XDebuggerEvaluator.java
blob3e5857bbce46e061d5b4711942c8d73dd72f1cdd
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.xdebugger.evaluation;
18 import com.intellij.openapi.editor.Document;
19 import com.intellij.openapi.project.Project;
20 import com.intellij.openapi.util.TextRange;
21 import com.intellij.xdebugger.*;
22 import com.intellij.xdebugger.breakpoints.XBreakpoint;
23 import com.intellij.xdebugger.frame.*;
24 import org.jetbrains.annotations.NotNull;
25 import org.jetbrains.annotations.Nullable;
27 /**
28 * @author nik
30 public abstract class XDebuggerEvaluator {
32 /**
33 * Evaluate <code>expression</code> to boolean
34 * @param expression expression to evaluate
35 * @return result
37 * @deprecated This method is used to evaluate breakpoints' conditions only. Instead of implementing it you should evaluate breakpoint's condition
38 * in your code and call {@link XDebugSession#breakpointReached(XBreakpoint, XSuspendContext)}
39 * only if the condition evaluates to <code>true</code>.
41 * @see XBreakpoint#getCondition()
43 @Deprecated
44 public boolean evaluateCondition(@NotNull String expression) {
45 return true;
48 /**
49 * Evaluate <code>expression</code> to string
50 * @param expression expression to evaluate
51 * @return result
53 * @deprecated This method is used to evaluate breakpoints' log messages only. Instead of implementing it you should evaluate breakpoint's
54 * log message in your code and pass it to {@link XDebugSession#breakpointReached(XBreakpoint, String, XSuspendContext)}.
56 @Deprecated
57 @Nullable
58 public String evaluateMessage(@NotNull String expression) {
59 return null;
62 /**
63 * Start evaluating expression.
64 * @param expression expression to evaluate
65 * @param callback used to notify that the expression has been evaluated or an error occurs
67 public void evaluate(@NotNull String expression, XEvaluationCallback callback, @Nullable XSourcePosition expressionPosition) {
68 evaluate(expression, callback);
71 /**
72 * @deprecated override {@link XDebuggerEvaluator#evaluate(String, XEvaluationCallback, com.intellij.xdebugger.XSourcePosition)} instead
74 @Deprecated
75 public void evaluate(@NotNull String expression, XEvaluationCallback callback) {
78 /**
79 * Return text range of expression which can be evaluated.
80 * @param project project
81 * @param document document
82 * @param offset offset
83 * @return text range of expression
85 @Nullable
86 public abstract TextRange getExpressionRangeAtOffset(final Project project, final Document document, int offset);
88 /**
89 * @return delay before showing value tooltip (in ms)
91 public int getValuePopupDelay() {
92 return 700;
95 public interface XEvaluationCallback {
97 void evaluated(@NotNull XValue result);
99 void errorOccurred(@NotNull String errorMessage);
102 * @deprecated use {@link XEvaluationCallback#errorOccurred(String)}
104 @Deprecated
105 void errorOccured(@NotNull String errorMessage);