Search in sources :

Example 11 with TextWithImportsImpl

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;
}
Also used : TextWithImportsImpl(com.intellij.debugger.engine.evaluation.TextWithImportsImpl)

Aggregations

TextWithImportsImpl (com.intellij.debugger.engine.evaluation.TextWithImportsImpl)11 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)3 PsiElement (com.intellij.psi.PsiElement)3 TextWithImports (com.intellij.debugger.engine.evaluation.TextWithImports)2 Editor (com.intellij.openapi.editor.Editor)2 JavaCodeFragment (com.intellij.psi.JavaCodeFragment)2 ArrayList (java.util.ArrayList)2 SmaliCodeFragmentFactory (org.jf.smalidea.debugging.SmaliCodeFragmentFactory)2 CodeCompletionHandlerBase (com.intellij.codeInsight.completion.CodeCompletionHandlerBase)1 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 InstanceFilter (com.intellij.debugger.InstanceFilter)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 UserExpressionData (com.intellij.debugger.impl.descriptors.data.UserExpressionData)1 MessageDescriptor (com.intellij.debugger.ui.impl.watch.MessageDescriptor)1 NodeManagerImpl (com.intellij.debugger.ui.impl.watch.NodeManagerImpl)1 PsiClass (com.intellij.psi.PsiClass)1 PsiEnumConstant (com.intellij.psi.PsiEnumConstant)1 PsiReferenceExpressionImpl (com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl)1 ClassFilter (com.intellij.ui.classFilter.ClassFilter)1 XExpression (com.intellij.xdebugger.XExpression)1