void (PsiElement element, @Nullable RefactoringElementListener listener) { final String fqn = element instanceof PsiFile ? ((PsiFile)element).getVirtualFile().getPath() : FqnUtil.elementToFqn(element, null); if (fqn != null) { UndoableAction action = new BasicUndoableAction() { @Override public void undo() { if (listener instanceof UndoRefactoringElementListener) { ((UndoRefactoringElementListener)listener).undoElementMovedOrRenamed(element, fqn); } } @Override public void redo() { } }; UndoManager.getInstance(element.getProject()).undoableActionPerformed(action); } }