use of com.intellij.debugger.engine.evaluation.TextWithImportsImpl in project intellij-community by JetBrains.
the class JavaEditorTextProviderImpl method getEditorText.
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
String result = null;
PsiElement element = findExpression(elementAtCaret);
if (element == null)
return null;
if (element instanceof PsiVariable) {
result = qualifyEnumConstant(element, ((PsiVariable) element).getName());
} else if (element instanceof PsiMethod) {
result = ((PsiMethod) element).getName() + "()";
} else if (element instanceof PsiReferenceExpression) {
PsiReferenceExpression reference = (PsiReferenceExpression) element;
result = qualifyEnumConstant(reference.resolve(), element.getText());
} else {
result = element.getText();
}
return result != null ? new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result) : null;
}
Aggregations