void (Project project, Editor editor, PsiFile file, PsiClass aClass) { RefactoringActionHandler moveHandler = RefactoringActionHandlerFactory.getInstance().createMoveHandler(); DataContext dataContext = EditorUtil.getEditorDataContext(editor); String fqName = aClass.getQualifiedName(); LOG.assertTrue(fqName != null); PsiDirectory directory = PackageUtil .findOrCreateDirectoryForPackage(myCurrentModule, StringUtil.getPackageName(fqName), mySourceRoot, true); DataContext context = directory == null ? dataContext : SimpleDataContext.getSimpleContext(LangDataKeys.TARGET_PSI_ELEMENT, directory, dataContext); moveHandler.invoke(project, new PsiElement[]{aClass}, context); PsiReference reference = file.findReferenceAt(editor.getCaretModel().getOffset()); PsiClass newClass = JavaPsiFacade.getInstance(project).findClass(fqName, GlobalSearchScope.moduleScope(myCurrentModule)); if (reference != null && newClass != null) { QuestionAction action = new AddImportAction(project, reference, editor, newClass); action.execute(); } }