Package com.intellij.openapi.actionSystem

Examples of com.intellij.openapi.actionSystem.AnAction


    }

    @Override
    protected List<AnAction> createActions() {
        return Arrays.asList(
                new AnAction("Scale Dynos", "", icon("/debugger/threadSuspended.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final ScaleInputValidator parser = new ScaleInputValidator(1, MAX_WEB_PROCESSES);
                        final List<Proc> webProcesses = herokuProjectService.getProcesses("web");
                        String webProcessText = Messages.showInputDialog(getProject(), "New Number of Web-Processes:", "Scale Web-Processes", Messages.getQuestionIcon(), String.valueOf(webProcesses.size()), parser);
                        Integer webProcessCount = parser.parse(webProcessText);
                        if (webProcessCount == null) return;
                        herokuProjectService.scaleWeb(webProcessCount);
                        HerokuProcessesWindow.this.doUpdate();
                    }
                },
                new AnAction("Scale Workers", "", icon("/debugger/threadRunning.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final ScaleInputValidator parser = new ScaleInputValidator(0, MAX_WEB_PROCESSES);
                        final List<Proc> workerProcesses = herokuProjectService.getProcesses("worker");
                        String workersText = Messages.showInputDialog(getProject(), "New Number of Workers:", "Scale Workers", Messages.getQuestionIcon(), String.valueOf(workerProcesses.size()), parser);
                        Integer workers = parser.parse(workersText);
                        if (workers == null) return;
                        herokuProjectService.scaleWorkers(workers);
                        HerokuProcessesWindow.this.doUpdate();
                    }
                },
                new AnAction("Update", "", icon("/actions/sync.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        HerokuProcessesWindow.this.doUpdate();
                    }
                }
        );
View Full Code Here


    }

    @Override
    protected List<AnAction> createActions() {
        return Arrays.<AnAction>asList(
                new AnAction("Add Add-On", "", icon("/general/add.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final Addon addon = tableModel.getAddOn(selectedRow.get());
                        if (addon==null || tableModel.isInstalled(addon)) return;
                        final Price price = new Price(addon.getPriceCents(), addon.getPriceUnit());
                        if (Messages.showYesNoDialog("Add the Add-On: "+addon.getName()+" for "+price,"Add Add-On",Messages.getQuestionIcon())!=Messages.YES) return;
                        // ask confirmation
                        herokuProjectService.addAddon(addon);
                        HerokuAddonsWindow.this.doUpdate();
                    }
                },
                new AnAction("Remove Add-On", "", icon("/general/remove.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final Addon addon = tableModel.getAddOn(selectedRow.get());
                        if (addon==null || !tableModel.isInstalled(addon)) return;
                        // ask confirmation
                        if (Messages.showYesNoDialog("Remove the Add-On:"+addon.getName(),"Remove Add-On",Messages.getQuestionIcon())!=Messages.YES) return;
                        herokuProjectService.removeAddon(addon);
                        HerokuAddonsWindow.this.doUpdate();
                    }
                },
                new AnAction("Show Documentation", "", icon("/xml/web_preview.png","/actions/preview.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final Addon addon = tableModel.getAddOn(selectedRow.get());
                        if (addon==null) return;
                        BrowserUtil.launchBrowser(addonUrl(addon));
                    }
                },
                new AnAction("Update", "", icon("/actions/sync.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        HerokuAddonsWindow.this.doUpdate();
                    }
                }
        );
View Full Code Here

                            LOG.warn("Error destroying application: "+e.getMessage(),e);
                            Messages.showErrorDialog("Error destroying application: " + e.getMessage(), "Error Destroying Heroku Application");
                        }
                    }
                },
                new AnAction("Update", "", icon("/actions/sync.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        HerokuSetupWindow.this.doUpdate();
                    }
                }
        );
View Full Code Here

    }

    @Override
    protected List<AnAction> createActions() {
        return Arrays.asList(
                new AnAction("Add Config Variable", "", icon("/general/add.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final AddConfigVariableDialog dialog = new AddConfigVariableDialog();
                        dialog.show();
                        if (dialog.getExitCode()==AddConfigVariableDialog.OK_EXIT_CODE && dialog.validateInput()) {
                            herokuProjectService.addConfigVar(dialog.getKey(), dialog.getValue());
                            HerokuConfigWindow.this.doUpdate();
                        }
                    }
                },
                new AnAction("Remove Config Variable", "", icon("/general/remove.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        final String varName = tableModel.getKey(selectedRow.get());
                        herokuProjectService.removeConfigVar(varName);
                        HerokuConfigWindow.this.doUpdate();
                    }
                },
                new AnAction("Update", "", icon("/actions/sync.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        HerokuConfigWindow.this.doUpdate();
                    }
                }
        );
View Full Code Here

    }

    @Override
    protected List<AnAction> createActions() {
        return Arrays.asList(
                new AnAction("Restart", "", icon("/general/toolWindowRun.png","/actions/restart.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        herokuProjectService.restartApplication();
                        HerokuApplicationWindow.this.doUpdate();
                    }
                },
                new AnAction("Stop", "", icon("/actions/suspend.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        herokuProjectService.stopApplication();
                        HerokuApplicationWindow.this.doUpdate();
                    }
                },
                new AnAction("Deploy", "", icon("/actions/resume.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        GitHelper.pushToHeroku(getProject());

                        HerokuApplicationWindow.this.doUpdate();
                    }
                },
                new AnAction("Update", "", icon("/actions/sync.png")) {
                    public void actionPerformed(AnActionEvent anActionEvent) {
                        HerokuApplicationWindow.this.doUpdate();
                    }
                }
/*                new AnAction("Change Stack", "", icon("/runConfigurations/scrollToStackTrace.png")) {
View Full Code Here

        return null;
    }

    public static void executeAction(final String actionId, final InputEvent e) {
        final ActionManager actionManager = ActionManager.getInstance();
        final AnAction action = actionManager.getAction(actionId);
        if (action != null) {
            final Presentation presentation = new Presentation();
            final AnActionEvent
                    event =
                    new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation,
                            actionManager, 0);
            action.update(event);
            if (presentation.isEnabled()) {
                action.actionPerformed(event);
            }
        }
    }
View Full Code Here

    return false;
  }

  private void createUIComponents() {
    myLinkContainer = new JPanel(new BorderLayout());
    ActionLink link = new ActionLink("Download the latest Rebar version", new AnAction() {
      @Override
      public void actionPerformed(AnActionEvent e) {
        DownloadableFileService service = DownloadableFileService.getInstance();
        DownloadableFileDescription rebar = service.createFileDescription("https://github.com/rebar/rebar/wiki/rebar", "rebar");
        FileDownloader downloader = service.createDownloader(ContainerUtil.list(rebar), "rebar");
View Full Code Here

        final String addText = UIBundle.message("action.add.less.profile.text");
        final String addDescription = UIBundle.message("action.add.less.profile.description");
        final String addPromptTitle = UIBundle.message("action.add.less.profile.prompt.title");

        result.add(new AnAction(addText, addDescription, PlatformIcons.ADD_ICON) {
            {
                registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
            }

            public void actionPerformed(final AnActionEvent event) {
                final String name = askForProfileName(addPromptTitle, "");
                if (name == null) return;
                final LessProfile lessProfile = new LessProfile(getNextId(), name);
                addProfileNode(lessProfile);
            }
        });

        result.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));

        final String copyText = UIBundle.message("action.copy.less.profile.text");
        final String copyDescription = UIBundle.message("action.copy.less.profile.description");
        final String copyPromptTitle = UIBundle.message("action.copy.less.profile.prompt.title");

        result.add(new AnAction(copyText, copyDescription, PlatformIcons.COPY_ICON) {
            {
                registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_MASK)), myTree);
            }
            public void actionPerformed(final AnActionEvent event) {
                final String profileName = askForProfileName(copyPromptTitle, "");
View Full Code Here

            }
        };

        CommonActionsManager actionsManager = CommonActionsManager.getInstance();

        final AnAction expandAllAction = actionsManager.createExpandAllAction(treeExpander, resultPanel);
        final AnAction collapseAllAction = actionsManager.createCollapseAllAction(treeExpander, resultPanel);

        Disposer.register(this, new Disposable() {
            @Override
            public void dispose() {
                collapseAllAction.unregisterCustomShortcutSet(resultPanel);
                expandAllAction.unregisterCustomShortcutSet(resultPanel);
            }
        });

        actionResultGroup.add(expandAllAction);
View Full Code Here

            }
        };

        CommonActionsManager actionsManager = CommonActionsManager.getInstance();

        final AnAction expandAllAction = actionsManager.createExpandAllAction(treeExpander, rootPanel);
        final AnAction collapseAllAction = actionsManager.createCollapseAllAction(treeExpander, rootPanel);

        Disposer.register(this, new Disposable() {
            @Override
            public void dispose() {
                collapseAllAction.unregisterCustomShortcutSet(rootPanel);
                expandAllAction.unregisterCustomShortcutSet(rootPanel);
            }
        });

View Full Code Here

TOP

Related Classes of com.intellij.openapi.actionSystem.AnAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.