Package com.heroku.api

Examples of com.heroku.api.App


    public int getColumnCount() {
        return Columns.values().length;
    }

    public Object getValueAt(int row, int column) {
        App app = getApplication(row);
        switch (columnFor(column)) {
            case InProject:
                return hightlightedApp !=null && app.getName().equals(hightlightedApp.getName());
            case Name:
                return app.getName();
            case Owner:
                return app.getOwnerEmail();
            case Url:
                return app.getWebUrl();
            case Created:
                return app.getCreatedAt();
            case Dynos:
                return app.getDynos();
            case Workers:
                return app.getWorkers();
        }
        return null;
    }
View Full Code Here


        builder.append(table(appsModel,selectedApp), 10);
        builder.append(new JButton(new BackgroundAction("Add Application") {
            public void runActionPerformed(ActionEvent e) {
                Pair<String,Heroku.Stack> newApplicationInfo = Notifications.showCreateNewAppDialog();
                if (newApplicationInfo==null) return;
                App newApp = herokuApplicationService.createApplication(newApplicationInfo.first, newApplicationInfo.second);
                Notifications.notifyModalInfo("Created App", "Sucessfully created App " + newApp.getName() + " on " + newApp.getStack());
                appsModel.update(herokuApplicationService.listApps());
            }
        }), 1);
        builder.append(new JButton(new BackgroundAction("Destroy App") {
            public void runActionPerformed(ActionEvent e) {
                App app = appsModel.getApplication(selectedApp.get());
                if (app==null) return;
                if (Messages.showYesNoDialog("Really destroy app "+app.getName()+" this is irrecoverable!","Destroy App",Messages.getWarningIcon())!=Messages.YES) return;
                herokuApplicationService.destroyApp(app);
                Notifications.notifyModalInfo("Destroyed App", "Sucessfully Destroyed App " + app.getName());
                appsModel.update(herokuApplicationService.listApps());
            }
        }), 1);
        builder.nextLine();
    }
View Full Code Here

        builder.append(table(applicationsTableModel, selectedApplication), 8);
        builder.append(updateButton(updater));

        builder.append(new JButton(new AbstractAction("Attach") {
            public void actionPerformed(ActionEvent actionEvent) {
                final App app = applicationsTableModel.getApplication(selectedApplication.get());
                if (app != null) {
                    herokuProjectService.update(app);
                    attachRemote(project, app);
                    updatePanels(herokuProjectService);
                }
            }
        }));
        builder.append(new JButton(new AbstractAction("Clone") {
            {
                setEnabled(false);
            }

            public void actionPerformed(ActionEvent actionEvent) {
                final App app = applicationsTableModel.getApplication(selectedApplication.get());
                if (app != null) {
                    // todo git clone
                }
            }
        }));
        builder.append(new JButton(new AbstractAction("Create New") {
            public void actionPerformed(ActionEvent actionEvent) {
                try {
                    String newApplicationName = Messages.showInputDialog(project, "Please enter the new Heroku Application Name or leave blank for default:", "New Heroku Application Name", Messages.getQuestionIcon());
                    App newApp = herokuProjectService.getApplicationService().createApplication(newApplicationName,null);
                    herokuProjectService.update(newApp);
                    attachRemote(project, newApp);
                    updatePanels(herokuProjectService);
                } catch (Exception e) {
                    Messages.showMessageDialog(project, "Error creating application: " + e.getMessage(), "Error Creating Heroku Application", Messages.getErrorIcon());
View Full Code Here

        final boolean gitEnabled = GitHelper.isGitEnabled(project);
        presentGitStatus(gitEnabled);
        final GitRemoteInfo existingRemote = GitHelper.findHerokuOrigin(project);
        final List<App> apps = load();
        tableModel.update(apps);
        final App appWithRemote = findAppForRemote(apps, existingRemote);
        tableModel.highlight(appWithRemote);
        representExistingRemote(existingRemote, appWithRemote!=null);
    }
View Full Code Here

                    public void update(AnActionEvent e) {
                        setEnabled(!herokuProjectService.isHerokuProject());
                    }

                    public void runActionPerformed(AnActionEvent anActionEvent) {
                        final App app = tableModel.getApplication(selectedRow.get());
                        if (app == null) return;
                        final GitRemoteInfo attachedRemote = GitHelper.attachRemote(getProject(), app);
                        if (attachedRemote != null) {
                            LOG.info("Attached remote " + attachedRemote.getName() + ":" + attachedRemote.getUrl() + " to project " + getProject().getName());
                            herokuProjectService.update(app);
                            updatePanels();
                            HerokuSetupWindow.this.doUpdate();
                        } else {
                            LOG.warn("No attached remote attached to project " + getProject().getName());
                        }

                    }
                },
                new JBBackgroundAction("New App", "Create and Attach Heroku Application", icon("/general/add.png")) {
                    {
                        update(null);
                    }

                    @Override
                    public void update(AnActionEvent e) {
                        setEnabled(!herokuProjectService.isHerokuProject());
                    }

                    public void runActionPerformed(AnActionEvent anActionEvent) {
                        try {
                            Pair<String,Heroku.Stack> newApplicationInfo = Notifications.showCreateNewAppDialog();
                            if (newApplicationInfo==null) return;
                            App newApp = herokuProjectService.getApplicationService().createApplication(newApplicationInfo.first, newApplicationInfo.second);
                            herokuProjectService.update(newApp);
                            GitHelper.attachRemote(getProject(), newApp);
                            updatePanels();
                        } catch (Exception e) {
                            LOG.warn("Error creating application: "+e.getMessage(),e);
                            Messages.showErrorDialog("Error creating application: " + e.getMessage(), "Error Creating Heroku Application");
                        }
                    }
                },
                new JBBackgroundAction("Destroy App", "Destroy Heroku Application", icon("/general/remove.png")) {
                    {
                        update(null);
                    }

                    @Override
                    public void update(AnActionEvent e) {
                        setEnabled(herokuProjectService.isHerokuProject());
                    }

                    public void runActionPerformed(AnActionEvent anActionEvent) {
                        try {
                            App app = tableModel.getApplication(selectedRow.get());
                            if (app==null) return;
                            if (Messages.showYesNoDialog("Really destroy app "+app.getName()+" this is irrecoverable!","Destroy App",Messages.getWarningIcon())!=Messages.YES) return;
                            herokuProjectService.getApplicationService().destroyApp(app);
                            Notifications.notifyModalInfo("Destroyed App", "Sucessfully Destroyed App " + app.getName());
                            HerokuSetupWindow.this.doUpdate();
                            if (app.getName().equals(herokuProjectService.getApp().getName())) {
                                herokuProjectService.update(null);
                                GitHelper.removeRemote(getProject(), app);
                                updatePanels();
                            }
                        } catch (Exception e) {
View Full Code Here

    }

    private JComponent createApplicationView() {
        if (!herokuProjectService.isHerokuProject()) return null;

        final App app = herokuProjectService.getApp();

        final DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout(
                "right:pref, 6dlu, right:pref, 10dlu, right:pref, 6dlu, right:pref, pref:grow", // columns
                "pref"));// rows
        builder.appendSeparator("Heroku Application: " + herokuProjectService.getHerokuAppName());
        builder.append("URL", link(app.getWebUrl()));
        builder.append("Owner", label(app.getOwnerEmail()));
        builder.append("Id", label(app.getId()));
        builder.append("Domain", domainLabel(app));
        builder.append("Requested Stack", label(app.getRequestedStack()));
        builder.append("Stack", label(app.getStack()));
        builder.append("Dynos", label(getDynos(app)));
        builder.append("Workers", label(getWorkers(app)));
        builder.append("Created At", label(app.getCreatedAt()));
        builder.append("Create Status", label(app.getCreateStatus()));
        builder.append("Repo Size", label(app.getRepoSize()));
        builder.append("Slug Size", label(app.getSlugSize()));

        builder.append("Remote", label(getGitRemote(app)));

        return builder.getPanel();
    }
View Full Code Here

TOP

Related Classes of com.heroku.api.App

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.