void (@NotNull AnActionEvent e) { Project project = e.getProject(); VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); if (virtualFile instanceof BackedVirtualFile) { virtualFile = ((BackedVirtualFile)virtualFile).getOriginFile(); } if (project == null || virtualFile == null) return; PsiElement element = PsiManager.getInstance(project).findFile(virtualFile); if (element == null) return; CopyHandler.doCopy(new PsiElement[]{element.getContainingFile()}, null); }