Search in sources :

Example 1 with ReopenProjectAction

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

the class ChangeProjectIconAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    List<AnAction> elements = getSelectedElements(e);
    String path = ((ReopenProjectAction) elements.get(0)).getProjectPath();
    final ChangeProjectIconForm form = new ChangeProjectIconForm(path);
    DialogWrapper dialog = new DialogWrapper(null) {

        {
            init();
        }

        @Nullable
        @Override
        protected JComponent createCenterPanel() {
            return form.myRootPanel;
        }
    };
    dialog.show();
    if (dialog.isOK()) {
        try {
            form.apply();
        } catch (IOException e1) {
            System.out.println(e1);
        }
    }
}
Also used : ReopenProjectAction(com.intellij.ide.ReopenProjectAction) IOException(java.io.IOException) AnAction(com.intellij.openapi.actionSystem.AnAction) DialogWrapper(com.intellij.openapi.ui.DialogWrapper)

Example 2 with ReopenProjectAction

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

the class MoveProjectToGroupAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final List<AnAction> elements = getSelectedElements(e);
    for (AnAction element : elements) {
        if (element instanceof ReopenProjectAction) {
            final String path = ((ReopenProjectAction) element).getProjectPath();
            for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
                group.removeProject(path);
                myGroup.addProject(path);
            }
        }
    }
    rebuildRecentProjectsList(e);
}
Also used : ReopenProjectAction(com.intellij.ide.ReopenProjectAction) AnAction(com.intellij.openapi.actionSystem.AnAction) ProjectGroup(com.intellij.ide.ProjectGroup)

Example 3 with ReopenProjectAction

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

the class OpenSelectedProjectsAction method update.

@Override
public void update(AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    List<AnAction> selectedElements = getSelectedElements(e);
    boolean hasProject = false;
    boolean hasGroup = false;
    for (AnAction element : selectedElements) {
        if (element instanceof ReopenProjectAction) {
            hasProject = true;
        }
        if (element instanceof ProjectGroupActionGroup) {
            hasGroup = true;
        }
        if (hasGroup && hasProject) {
            e.getPresentation().setEnabled(false);
            return;
        }
    }
    if (ActionPlaces.WELCOME_SCREEN.equals(e.getPlace())) {
        presentation.setEnabledAndVisible(true);
        if (selectedElements.size() == 1 && selectedElements.get(0) instanceof ProjectGroupActionGroup) {
            presentation.setText("Open All Projects in Group");
        } else {
            presentation.setText("Open Selected");
        }
    } else {
        presentation.setEnabledAndVisible(false);
    }
}
Also used : ReopenProjectAction(com.intellij.ide.ReopenProjectAction) ProjectGroupActionGroup(com.intellij.ide.ProjectGroupActionGroup) Presentation(com.intellij.openapi.actionSystem.Presentation) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 4 with ReopenProjectAction

use of com.intellij.ide.ReopenProjectAction 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 5 with ReopenProjectAction

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

the class RemoveSelectedProjectsFromGroupsAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final List<AnAction> elements = getSelectedElements(e);
    for (AnAction element : elements) {
        if (element instanceof ReopenProjectAction) {
            for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
                group.removeProject(((ReopenProjectAction) element).getProjectPath());
            }
        }
    }
    rebuildRecentProjectsList(e);
}
Also used : ReopenProjectAction(com.intellij.ide.ReopenProjectAction) AnAction(com.intellij.openapi.actionSystem.AnAction) ProjectGroup(com.intellij.ide.ProjectGroup)

Aggregations

ReopenProjectAction (com.intellij.ide.ReopenProjectAction)6 AnAction (com.intellij.openapi.actionSystem.AnAction)6 ProjectGroup (com.intellij.ide.ProjectGroup)2 ProjectGroupActionGroup (com.intellij.ide.ProjectGroupActionGroup)2 RecentProjectsManager (com.intellij.ide.RecentProjectsManager)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 IOException (java.io.IOException)1