void (@NotNull PsiReference reference, @NotNull List<? super UsageInfo> usages, @NotNull PsiElement typeParameter, int paramsCount, int index) { if (reference instanceof GrCodeReferenceElementImpl) { final @Nullable GrTypeArgumentList parameterList = ((GrCodeReferenceElementImpl)reference).getTypeArgumentList(); if (parameterList != null) { GrTypeElement[] typeArgs = parameterList.getTypeArgumentElements(); if (typeArgs.length > index) { usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(typeArgs.length == 1 ? parameterList : typeArgs[index], typeParameter, true) { @Override public void deleteElement() throws IncorrectOperationException { PsiElement element = getElement(); if (element != null) { PsiElement parent = element.getParent(); if (parent != null && parent.isValid()) { @Nullable PsiElement next = PsiTreeUtil.skipWhitespacesAndCommentsForward(element); if (next != null && PsiUtilCore.getElementType(next) == GroovyElementTypes.T_COMMA) { next.delete(); } else { @Nullable PsiElement prev = PsiTreeUtil.skipWhitespacesAndCommentsBackward(element); if (prev != null && PsiUtilCore.getElementType(prev) == GroovyElementTypes.T_COMMA) { prev.delete(); } } } } super.deleteElement(); } }); } } } }