Search in sources :

Example 1 with RecentProjectsManager

use of com.intellij.ide.RecentProjectsManager in project intellij-community by JetBrains.

the class RemoveSelectedProjectsAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    RecentProjectsManager mgr = RecentProjectsManager.getInstance();
    for (AnAction action : getSelectedElements(e)) {
        if (action instanceof ReopenProjectAction) {
            String path = ((ReopenProjectAction) action).getProjectPath();
            mgr.removePath(path);
        } else if (action instanceof ProjectGroupActionGroup) {
            ProjectGroupActionGroup group = (ProjectGroupActionGroup) action;
            for (String path : group.getGroup().getProjects()) {
                mgr.removePath(path);
            }
            mgr.removeGroup(group.getGroup());
        }
        rebuildRecentProjectsList(e);
        JList list = getList(e);
        if (list != null) {
            ScrollingUtil.ensureSelectionExists(list);
        }
    }
}
Also used : ReopenProjectAction(com.intellij.ide.ReopenProjectAction) RecentProjectsManager(com.intellij.ide.RecentProjectsManager) ProjectGroupActionGroup(com.intellij.ide.ProjectGroupActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 2 with RecentProjectsManager

use of com.intellij.ide.RecentProjectsManager in project intellij-community by JetBrains.

the class MacDockDelegate method updateRecentProjectsMenu.

@Override
public void updateRecentProjectsMenu() {
    RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
    if (projectsManager == null)
        return;
    final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
    recentProjectsMenu.removeAll();
    for (final AnAction action : recentProjectActions) {
        MenuItem menuItem = new MenuItem(((ReopenProjectAction) action).getProjectName());
        menuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext(null)));
            }
        });
        recentProjectsMenu.add(menuItem);
    }
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) RecentProjectsManager(com.intellij.ide.RecentProjectsManager) AnAction(com.intellij.openapi.actionSystem.AnAction)

Aggregations

RecentProjectsManager (com.intellij.ide.RecentProjectsManager)2 AnAction (com.intellij.openapi.actionSystem.AnAction)2 ProjectGroupActionGroup (com.intellij.ide.ProjectGroupActionGroup)1 ReopenProjectAction (com.intellij.ide.ReopenProjectAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1