private static @Nullable VirtualFile getSelectedFile(@NotNull AnActionEvent e) {
    VirtualFile[] array = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
    if (array == null || array.length != 1 || array[0].isDirectory()) {
      return null;
    }

    return array[0];
  }
private static @Nullable VirtualFile getSelectedFile(@NotNull AnActionEvent e)