use of org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocTagValueToken in project intellij-community by JetBrains.
the class GrChageSignatureUsageSearcher method findSimpleUsagesWithoutParameters.
private PsiMethod[] findSimpleUsagesWithoutParameters(final PsiMethod method, final ArrayList<UsageInfo> result, boolean isToModifyArgs, boolean isToThrowExceptions, boolean isOriginal) {
GlobalSearchScope projectScope = GlobalSearchScope.projectScope(method.getProject());
PsiMethod[] overridingMethods = OverridingMethodsSearch.search(method).toArray(PsiMethod.EMPTY_ARRAY);
for (PsiMethod overridingMethod : overridingMethods) {
if (GroovyLanguage.INSTANCE.equals(overridingMethod.getLanguage())) {
result.add(new OverriderUsageInfo(overridingMethod, method, isOriginal, isToModifyArgs, isToThrowExceptions));
}
}
boolean needToChangeCalls = !myChangeInfo.isGenerateDelegate() && (myChangeInfo.isNameChanged() || myChangeInfo.isParameterSetOrOrderChanged() || myChangeInfo.isExceptionSetOrOrderChanged() || myChangeInfo.isVisibilityChanged());
if (needToChangeCalls) {
PsiReference[] refs = MethodReferencesSearch.search(method, projectScope, true).toArray(PsiReference.EMPTY_ARRAY);
for (PsiReference ref : refs) {
PsiElement element = ref.getElement();
if (!GroovyLanguage.INSTANCE.equals(element.getLanguage()))
continue;
boolean isToCatchExceptions = isToThrowExceptions && needToCatchExceptions(RefactoringUtil.getEnclosingMethod(element));
if (PsiUtil.isMethodUsage(element)) {
result.add(new GrMethodCallUsageInfo(element, isToModifyArgs, isToCatchExceptions, method));
} else if (element instanceof GrDocTagValueToken) {
result.add(new UsageInfo(ref.getElement()));
} else if (element instanceof GrMethod && ((GrMethod) element).isConstructor()) {
DefaultConstructorImplicitUsageInfo implicitUsageInfo = new DefaultConstructorImplicitUsageInfo((GrMethod) element, ((GrMethod) element).getContainingClass(), method);
result.add(implicitUsageInfo);
} else if (element instanceof PsiClass) {
LOG.assertTrue(method.isConstructor());
final PsiClass psiClass = (PsiClass) element;
if (psiClass instanceof GrAnonymousClassDefinition) {
result.add(new GrMethodCallUsageInfo(element, isToModifyArgs, isToCatchExceptions, method));
continue;
}
/*if (!(myChangeInfo instanceof JavaChangeInfoImpl)) continue; todo propagate methods
if (shouldPropagateToNonPhysicalMethod(method, result, psiClass,
((JavaChangeInfoImpl)myChangeInfo).propagateParametersMethods)) {
continue;
}
if (shouldPropagateToNonPhysicalMethod(method, result, psiClass,
((JavaChangeInfoImpl)myChangeInfo).propagateExceptionsMethods)) {
continue;
}*/
result.add(new NoConstructorClassUsageInfo(psiClass));
} else if (ref instanceof PsiCallReference) {
result.add(new CallReferenceUsageInfo((PsiCallReference) ref));
} else {
result.add(new MoveRenameUsageInfo(element, ref, method));
}
}
} else if (myChangeInfo.isParameterTypesChanged()) {
PsiReference[] refs = MethodReferencesSearch.search(method, projectScope, true).toArray(PsiReference.EMPTY_ARRAY);
for (PsiReference reference : refs) {
final PsiElement element = reference.getElement();
if (element instanceof GrDocTagValueToken) {
result.add(new UsageInfo(reference));
}
}
}
// Conflicts
if (method instanceof GrMethod) {
detectLocalsCollisionsInMethod((GrMethod) method, result, isOriginal);
}
for (final PsiMethod overridingMethod : overridingMethods) {
if (overridingMethod instanceof GrMethod) {
detectLocalsCollisionsInMethod((GrMethod) overridingMethod, result, isOriginal);
}
}
return overridingMethods;
}
Aggregations