use of com.intellij.psi.impl.light.LightMethodBuilder in project intellij-community by JetBrains.
the class AntTasksProvider method getAntTasks.
public static Set<LightMethodBuilder> getAntTasks(PsiElement place) {
final PsiFile file = place.getContainingFile();
if (!(file instanceof GroovyFile)) {
return Collections.emptySet();
}
return CachedValuesManager.getManager(file.getProject()).getCachedValue(file, GANT_METHODS, () -> {
Map<String, Class> antObjects = getAntObjects((GroovyFile) file);
final Set<LightMethodBuilder> methods = new HashSet<>();
final Project project = file.getProject();
final PsiType closureType = TypesUtil.createType(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, file);
final PsiClassType stringType = TypesUtil.createType(CommonClassNames.JAVA_LANG_STRING, file);
for (String name : antObjects.keySet()) {
methods.add(new AntBuilderMethod(file, name, closureType, antObjects.get(name), stringType));
}
return CachedValueProvider.Result.create(methods, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, ProjectRootManager.getInstance(project));
}, false);
}
use of com.intellij.psi.impl.light.LightMethodBuilder in project intellij-community by JetBrains.
the class SimpleBuilderStrategySupport method createFieldSetter.
@NotNull
public static LightMethodBuilder createFieldSetter(@NotNull PsiClass builderClass, @NotNull GrVariable field, @NotNull PsiAnnotation annotation) {
final String name = field.getName();
final LightMethodBuilder fieldSetter = new LightMethodBuilder(builderClass.getManager(), getFieldMethodName(annotation, name));
fieldSetter.addModifier(PsiModifier.PUBLIC);
fieldSetter.addParameter(name, field.getType(), false);
fieldSetter.setMethodReturnType(createType(builderClass));
fieldSetter.setNavigationElement(field);
fieldSetter.setOriginInfo(ORIGIN_INFO);
return fieldSetter;
}
Aggregations