public State getState() {
   synchronized (myStateLock) {
     validateRecentProjects();
     return myState;
   }
 }
  /**
   * @param addClearListItem - used for detecting whether the "Clear List" action should be added to
   *     the end of the returned list of actions
   * @return
   */
  public AnAction[] getRecentProjectsActions(boolean addClearListItem) {
    validateRecentProjects();

    final Set<String> openedPaths = ContainerUtil.newHashSet();
    for (Project openProject : ProjectManager.getInstance().getOpenProjects()) {
      ContainerUtil.addIfNotNull(openedPaths, getProjectPath(openProject));
    }

    final LinkedHashSet<String> paths;
    synchronized (myStateLock) {
      paths = ContainerUtil.newLinkedHashSet(myState.recentPaths);
    }
    paths.remove(null);
    paths.removeAll(openedPaths);

    ArrayList<AnAction> actions = new ArrayList<AnAction>();
    Set<String> duplicates = getDuplicateProjectNames(openedPaths, paths);
    for (final String path : paths) {
      final String projectName = getProjectName(path);
      String displayName;
      synchronized (myStateLock) {
        displayName = myState.names.get(path);
      }
      if (StringUtil.isEmptyOrSpaces(displayName)) {
        displayName = duplicates.contains(path) ? path : projectName;
      }

      // It's better don't to remove non-existent projects. Sometimes projects stored
      // on USB-sticks or flash-cards, and it will be nice to have them in the list
      // when USB device or SD-card is mounted
      if (new File(path).exists()) {
        actions.add(new ReopenProjectAction(path, projectName, displayName));
      }
    }

    if (actions.isEmpty()) {
      return AnAction.EMPTY_ARRAY;
    }

    ArrayList<AnAction> list = new ArrayList<AnAction>();
    for (AnAction action : actions) {
      list.add(action);
    }
    if (addClearListItem) {
      AnAction clearListAction =
          new AnAction(IdeBundle.message("action.clear.list")) {
            public void actionPerformed(AnActionEvent e) {
              final int rc =
                  Messages.showOkCancelDialog(
                      e.getData(PlatformDataKeys.PROJECT),
                      "Would you like to clear the list of recent projects?",
                      "Clear Recent Projects List",
                      Messages.getQuestionIcon());

              if (rc == 0) {
                synchronized (myStateLock) {
                  myState.recentPaths.clear();
                }
                WelcomeFrame.clearRecents();
              }
            }
          };

      list.add(Separator.getInstance());
      list.add(clearListAction);
    }

    return list.toArray(new AnAction[list.size()]);
  }