void (final RadRootContainer root, final String oldName, final String newName, final String fieldClassName) { final String classToBind = root.getClassToBind(); if (classToBind == null) return; final Project project = root.getProject(); if (newName.length() == 0) { checkRemoveUnusedField(root, oldName, FormEditingUtil.getNextSaveUndoGroupId(project)); return; } final PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(classToBind, GlobalSearchScope.allScope(project)); if(aClass == null){ return; } if(oldName == null) { if (aClass.findFieldByName(newName, true) == null) { CreateFieldFix.runImpl(project, root, aClass, fieldClassName, newName, false, FormEditingUtil.getNextSaveUndoGroupId(project)); } return; } final PsiField oldField = aClass.findFieldByName(oldName, true); if(oldField == null){ return; } if(aClass.findFieldByName(newName, true) != null) { checkRemoveUnusedField(root, oldName, FormEditingUtil.getNextSaveUndoGroupId(project)); return; } // Show question to the user if (!isFieldUnreferenced(oldField)) { final int option = Messages.showYesNoDialog(project, UIDesignerBundle.message("message.rename.field", oldName, newName), UIDesignerBundle.message("title.rename"), Messages.getQuestionIcon() ); if(option != Messages.YES/*Yes*/){ return; } } // Commit document before refactoring starts GuiEditor editor = DesignerToolWindowManager.getInstance(project).getActiveFormEditor(); if (editor != null) { editor.refreshAndSave(false); } PsiDocumentManager.getInstance(project).commitAllDocuments(); if (!CommonRefactoringUtil.checkReadOnlyStatus(project, aClass)) { return; } try (AccessToken ignore = SlowOperations.knownIssue("IDEA-307701, EA-337740")) { final RenameProcessor processor = new RenameProcessor(project, oldField, newName, true, true); processor.run(); } }