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);
}
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()));
}
}
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 };
}
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);
}
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;
}
Aggregations