Search in sources :

Example 1 with ScriptPositionManagerHelper

use of org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper in project intellij-community by JetBrains.

the class GroovyPositionManager method getClassNameForJvm.

@Nullable
private static String getClassNameForJvm(@NotNull final PsiClass typeDefinition) {
    String suffix = typeDefinition instanceof GrTypeDefinition && ((GrTypeDefinition) typeDefinition).isTrait() ? "$Trait$Helper" : "";
    final PsiClass psiClass = typeDefinition.getContainingClass();
    if (psiClass != null) {
        String parent = getClassNameForJvm(psiClass);
        return parent == null ? null : parent + "$" + typeDefinition.getName() + suffix;
    }
    PsiFile file = typeDefinition.getContainingFile();
    if (file instanceof GroovyFile && ((GroovyFile) file).isScript()) {
        for (ScriptPositionManagerHelper helper : ScriptPositionManagerHelper.EP_NAME.getExtensions()) {
            String s = helper.isAppropriateScriptFile((GroovyFile) file) ? helper.customizeClassName(typeDefinition) : null;
            if (s != null) {
                return s;
            }
        }
    }
    String qname = typeDefinition.getQualifiedName();
    return qname == null ? null : qname + suffix;
}
Also used : GrTypeDefinition(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition) PsiClass(com.intellij.psi.PsiClass) ScriptPositionManagerHelper(org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper) PsiFile(com.intellij.psi.PsiFile) GroovyFile(org.jetbrains.plugins.groovy.lang.psi.GroovyFile) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PsiClass (com.intellij.psi.PsiClass)1 PsiFile (com.intellij.psi.PsiFile)1 Nullable (org.jetbrains.annotations.Nullable)1 ScriptPositionManagerHelper (org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper)1 GroovyFile (org.jetbrains.plugins.groovy.lang.psi.GroovyFile)1 GrTypeDefinition (org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition)1