Search in sources :

Example 26 with PsiClassType

use of com.intellij.psi.PsiClassType in project intellij-community by JetBrains.

the class BaseScriptTransformationSupport method getBaseClassType.

@NotNull
private static PsiClassType getBaseClassType(@NotNull GroovyScriptClass scriptClass) {
    PsiClassType type = getSuperClassTypeFromBaseScriptAnnotatedVariable(scriptClass);
    if (type != null)
        return type;
    final PsiClassType superClassFromDSL = GroovyDslFileIndex.processScriptSuperClasses(scriptClass.getContainingFile());
    if (superClassFromDSL != null)
        return superClassFromDSL;
    return TypesUtil.createTypeByFQClassName(GroovyCommonClassNames.GROOVY_LANG_SCRIPT, scriptClass);
}
Also used : PsiClassType(com.intellij.psi.PsiClassType) NotNull(org.jetbrains.annotations.NotNull)

Example 27 with PsiClassType

use of com.intellij.psi.PsiClassType in project intellij-community by JetBrains.

the class CategoryTransformationSupport method applyTransformation.

@Override
public void applyTransformation(@NotNull TransformationContext context) {
    PsiClassType type = GdkMethodUtil.getCategoryType(context.getCodeClass());
    if (type == null)
        return;
    for (GrMethod method : context.getCodeClass().getCodeMethods()) {
        context.removeMethod(method);
        context.addMethods(GrReflectedMethodImpl.doCreateReflectedMethods(method, type, method.getParameters()));
    }
}
Also used : PsiClassType(com.intellij.psi.PsiClassType) GrMethod(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod)

Example 28 with PsiClassType

use of com.intellij.psi.PsiClassType in project intellij-community by JetBrains.

the class GrListOrMapInfo method multiResolveClass.

@Override
public GroovyResolveResult[] multiResolveClass() {
    PsiClassType type = myReference.getConstructedClassType();
    if (type == null)
        return GroovyResolveResult.EMPTY_ARRAY;
    final GroovyResolveResult result = GroovyResolveResultImpl.from(type.resolveGenerics());
    if (result == GroovyResolveResult.EMPTY_RESULT)
        return GroovyResolveResult.EMPTY_ARRAY;
    return new GroovyResolveResult[] { result };
}
Also used : PsiClassType(com.intellij.psi.PsiClassType) GroovyResolveResult(org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult)

Example 29 with PsiClassType

use of com.intellij.psi.PsiClassType in project intellij-community by JetBrains.

the class GrReplacePrimitiveTypeWithWrapperFix method doFix.

@Override
protected void doFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) throws IncorrectOperationException {
    final PsiElement element = descriptor.getPsiElement();
    assert element instanceof GrTypeElement : element;
    GrTypeElement typeElement = (GrTypeElement) element;
    final PsiType type = typeElement.getType();
    if (!(type instanceof PsiPrimitiveType))
        return;
    final PsiClassType boxed = ((PsiPrimitiveType) type).getBoxedType(typeElement);
    if (boxed == null)
        return;
    final GrTypeElement newTypeElement = GroovyPsiElementFactory.getInstance(project).createTypeElement(boxed);
    final PsiElement replaced = typeElement.replace(newTypeElement);
    JavaCodeStyleManager.getInstance(project).shortenClassReferences(replaced);
}
Also used : GrTypeElement(org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement) PsiClassType(com.intellij.psi.PsiClassType) PsiPrimitiveType(com.intellij.psi.PsiPrimitiveType) PsiElement(com.intellij.psi.PsiElement) PsiType(com.intellij.psi.PsiType)

Example 30 with PsiClassType

use of com.intellij.psi.PsiClassType in project intellij-community by JetBrains.

the class GrTypeParameterParameterExtendsListImpl method getReferencedTypes.

@Override
@NotNull
public PsiClassType[] getReferencedTypes() {
    final GrCodeReferenceElement[] refs = findChildrenByClass(GrCodeReferenceElement.class);
    PsiClassType[] result = new PsiClassType[refs.length];
    for (int i = 0; i < result.length; i++) {
        result[i] = new GrClassReferenceType(refs[i]);
    }
    return result;
}
Also used : GrCodeReferenceElement(org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement) PsiClassType(com.intellij.psi.PsiClassType) GrClassReferenceType(org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PsiClassType (com.intellij.psi.PsiClassType)39 PsiType (com.intellij.psi.PsiType)20 PsiClass (com.intellij.psi.PsiClass)16 PsiElement (com.intellij.psi.PsiElement)10 NotNull (org.jetbrains.annotations.NotNull)5 Nullable (org.jetbrains.annotations.Nullable)4 UExpression (org.jetbrains.uast.UExpression)4 Location (com.android.tools.klint.detector.api.Location)3 PsiPrimitiveType (com.intellij.psi.PsiPrimitiveType)3 ArrayList (java.util.ArrayList)3 AbstractResourceRepository (com.android.ide.common.res2.AbstractResourceRepository)2 ResourceItem (com.android.ide.common.res2.ResourceItem)2 ResourceUrl (com.android.ide.common.resources.ResourceUrl)2 PsiCFGClass (com.android.tools.idea.experimental.codeanalysis.datastructs.PsiCFGClass)2 PsiCFGMethod (com.android.tools.idea.experimental.codeanalysis.datastructs.PsiCFGMethod)2 JavaEvaluator (com.android.tools.klint.client.api.JavaEvaluator)2 LintClient (com.android.tools.klint.client.api.LintClient)2 Project (com.intellij.openapi.project.Project)2 PsiArrayType (com.intellij.psi.PsiArrayType)2 PsiField (com.intellij.psi.PsiField)2