IDEA-74190 Debugger:Evaluate: Code Fragment mode parsing is broken

This commit is contained in:
peter
2011-09-13 10:17:47 +02:00
parent 1d6bd69e35
commit fe296fd7f0
2 changed files with 8 additions and 3 deletions
@@ -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();
@@ -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;