private static PsiFile getTargetFile(@NotNull DataContext dataContext) {
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project == null) return null;
    VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles();
    if (files.length == 0) return null;
    return PsiManager.getInstance(project).findFile(files[0]);
  }
private static PsiFile getTargetFile(@NotNull DataContext dataContext)