protected void prepareTestRun() { String s = PsiElementRenameHandler.renameabilityStatus(myProject, myPrimaryElement); if (!StringUtil.isEmpty(s)) { if (inTestsProduceExceptionOnBadRenameabilityStatus()) { PsiElementRenameHandler.showErrorMessage(myProject, null, s); } return; } prepareRenaming(myPrimaryElement, myNewName, myAllRenames); }
/** * Substitutes element to be renamed and initiate rename procedure. Should be used in order to * prevent modal dialogs to appear during inplace rename * * @param element the element on which refactoring was invoked * @param editor the editor in which inplace refactoring was invoked * @param renameCallback rename procedure which should be called on the chosen substitution */ public void substituteElementToRename( @NotNull final PsiElement element, @NotNull Editor editor, @NotNull Pass<PsiElement> renameCallback) { final PsiElement psiElement = substituteElementToRename(element, editor); if (psiElement == null) return; if (!PsiElementRenameHandler.canRename(psiElement.getProject(), editor, psiElement)) return; renameCallback.pass(psiElement); }