use of org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMethodParameter in project intellij-community by JetBrains.
the class GrDocMethodParamsImpl method getParameterTypes.
@Override
public PsiType[] getParameterTypes() {
ArrayList<PsiType> types = new ArrayList<>();
PsiManagerEx manager = getManager();
GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
for (GrDocMethodParameter parameter : getParameters()) {
GrDocReferenceElement typeElement = parameter.getTypeElement();
try {
PsiType type = factory.createTypeFromText(typeElement.getText(), this);
type = TypesUtil.boxPrimitiveType(type, manager, scope);
types.add(type);
} catch (IncorrectOperationException e) {
LOG.info(e);
types.add(null);
}
}
return types.toArray(PsiType.createArray(types.size()));
}
use of org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMethodParameter in project intellij-community by JetBrains.
the class GroovyDocMethodHandler method shortenParamterReferences.
private static int shortenParamterReferences(InsertionContext context, int startOffset, PsiMethod method, StringBuffer buffer) {
Document document = context.getEditor().getDocument();
int offset = startOffset + method.getName().length();
String paramText = buffer.toString();
document.insertString(offset, paramText);
int endOffset = offset + paramText.length();
final Project project = context.getProject();
PsiDocumentManager.getInstance(project).commitDocument(document);
PsiReference ref = context.getFile().findReferenceAt(startOffset);
if (ref instanceof GrDocMethodReference) {
GrDocMethodReference methodReference = (GrDocMethodReference) ref;
GrDocMethodParams list = methodReference.getParameterList();
for (GrDocMethodParameter parameter : list.getParameters()) {
JavaCodeStyleManager.getInstance(project).shortenClassReferences(parameter);
}
endOffset = methodReference.getTextRange().getEndOffset() + 1;
}
return endOffset;
}
Aggregations