void (final PsiClass newClass, final PsiClass oldClass) { final Collection<PsiReference> all = ReferencesSearch.search(oldClass, new LocalSearchScope(newClass.getContainingFile())).findAll(); for (PsiReference reference : all) { final PsiElement element = reference.getElement(); final PsiElement parent = element.getParent(); if (parent instanceof GrImportStatement && !((GrImportStatement)parent).isStatic()) { parent.delete(); } reference.bindToElement(newClass); } }