}
private void appendAppsTable(DefaultFormBuilder builder) {
selectedApp = new AtomicInteger(-1);
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);