protected void performRenameInner(PsiElement element, String newName) { final RenamePsiElementProcessor elementProcessor = RenamePsiElementProcessor.forElement(element); final RenameProcessor renameProcessor = new RenameProcessor( myProject, element, newName, elementProcessor.isToSearchInComments(element), elementProcessor.isToSearchForTextOccurrences(element)) { @Override public void doRun() { try { super.doRun(); } finally { restoreCaretOffsetAfterRename(); } } }; for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) { if (factory.getOptionName() != null && factory.isApplicable(element)) { renameProcessor.addRenamerFactory(factory); } } renameProcessor.run(); }
public void findUsages( List<UsageInfo> result, final boolean searchInStringsAndComments, final boolean searchInNonJavaFiles, List<UnresolvableCollisionUsageInfo> unresolvedUsages, Map<PsiElement, String> allRenames) { for (Iterator<PsiNamedElement> iterator = myElements.iterator(); iterator.hasNext(); ) { final PsiNamedElement variable = iterator.next(); RenameProcessor.assertNonCompileElement(variable); final boolean success = findUsagesForElement( variable, result, searchInStringsAndComments, searchInNonJavaFiles, unresolvedUsages, allRenames); if (!success) { iterator.remove(); } } }
private static void addOverriddenAndImplemented( @NotNull final PsiMethod methodPrototype, @NotNull final String newName, @Nullable final String newPropertyName, @NotNull final String oldParameterName, @NotNull final JavaCodeStyleManager manager, @NotNull final Map<PsiElement, String> allRenames) { PsiMethod[] methods = methodPrototype.findDeepestSuperMethods(); if (methods.length == 0) { methods = new PsiMethod[] {methodPrototype}; } for (PsiMethod method : methods) { addGetterOrSetterWithParameter( method, newName, newPropertyName, oldParameterName, manager, allRenames); OverridingMethodsSearch.search(method) .forEach( psiMethod -> { RenameProcessor.assertNonCompileElement(psiMethod); addGetterOrSetterWithParameter( psiMethod, newName, newPropertyName, oldParameterName, manager, allRenames); return true; }); } }