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
;
30 public abstract class XDebuggerEvaluator
{
33 * Evaluate <code>expression</code> to boolean
34 * @param expression expression to evaluate
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()
44 public boolean evaluateCondition(@NotNull String expression
) {
49 * Evaluate <code>expression</code> to string
50 * @param expression expression to evaluate
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)}.
58 public String
evaluateMessage(@NotNull String expression
) {
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
);
72 * @deprecated override {@link XDebuggerEvaluator#evaluate(String, XEvaluationCallback, com.intellij.xdebugger.XSourcePosition)} instead
75 public void evaluate(@NotNull String expression
, XEvaluationCallback callback
) {
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
86 public abstract TextRange
getExpressionRangeAtOffset(final Project project
, final Document document
, int offset
);
89 * @return delay before showing value tooltip (in ms)
91 public int getValuePopupDelay() {
95 public interface XEvaluationCallback
{
97 void evaluated(@NotNull XValue result
);
99 void errorOccurred(@NotNull String errorMessage
);
102 * @deprecated use {@link XEvaluationCallback#errorOccurred(String)}
105 void errorOccured(@NotNull String errorMessage
);