diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java index e4c129bd31ab..22694cb0b683 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/EvaluateActionHandler.java @@ -121,13 +121,17 @@ public class EvaluateActionHandler extends DebuggerActionHandler { defaultExpression = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""); } + CodeFragmentKind kind = DebuggerSettings.EVALUATE_FRAGMENT.equals(dialogType) ? CodeFragmentKind.CODE_BLOCK : CodeFragmentKind.EXPRESSION; + DebuggerSettings.getInstance().EVALUATION_DIALOG_TYPE = dialogType; + TextWithImportsImpl text = new TextWithImportsImpl(kind, defaultExpression.getText(), defaultExpression.getImports(), defaultExpression.getFileType()); + final DialogWrapper dialog; if(DebuggerSettings.EVALUATE_FRAGMENT.equals(dialogType)) { - dialog = new StatementEvaluationDialog(project, defaultExpression); + dialog = new StatementEvaluationDialog(project, text); } else { - dialog = new ExpressionEvaluationDialog(project, defaultExpression); + dialog = new ExpressionEvaluationDialog(project, text); } dialog.show(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java index 215f9317388b..4eda8984e285 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java @@ -27,6 +27,7 @@ import com.intellij.psi.PsiExpression; import com.intellij.psi.PsiExpressionCodeFragment; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public final class TextWithImportsImpl implements TextWithImports{ @@ -52,7 +53,7 @@ public final class TextWithImportsImpl implements TextWithImports{ } } - public TextWithImportsImpl (CodeFragmentKind kind, @NotNull String text, @NotNull String imports, @NotNull FileType fileType) { + public TextWithImportsImpl (CodeFragmentKind kind, @NotNull String text, @NotNull String imports, @Nullable FileType fileType) { myKind = kind; myText = text; myImports = imports;