[r=cdr] fix regression: empty default log message text when add breakpoint action with shift-click

This commit is contained in:
Eugene Zhuravlev
2010-12-07 18:55:29 +03:00
parent 0077402ee6
commit 34f1169f82
2 changed files with 5 additions and 3 deletions
@@ -18,6 +18,7 @@ package com.intellij.debugger.impl;
import com.intellij.debugger.engine.evaluation.TextWithImports;
import com.intellij.lang.LanguageExtension;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
/**
* Provides text in the editor for Evaluate expression action
@@ -26,5 +27,6 @@ import com.intellij.psi.PsiElement;
public interface EditorTextProvider {
LanguageExtension<EditorTextProvider> EP = new LanguageExtension<EditorTextProvider>("com.intellij.debuggerEditorTextProvider");
@Nullable
TextWithImports getEditorText(PsiElement elementAtCaret);
}
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
public class JavaEditorTextProviderImpl implements EditorTextProvider {
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
String result = "";
String result = null;
PsiElement element = findExpression(elementAtCaret);
if (element != null) {
if (element instanceof PsiReferenceExpression) {
@@ -43,11 +43,11 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
}
}
}
if (result.length() == 0) {
if (result == null) {
result = element.getText();
}
}
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result);
return result != null? new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result) : null;
}
@Nullable