public static boolean canBeInvoked(final Editor editor, final Project project) {
    if (isReadOnly(editor)) {
      return false;
    }
    if (getPsiFile(editor, project) == null) {
      return false;
    }

    return true;
  }
public static boolean canBeInvoked(final Editor editor, final Project project)