}
@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();
}
}
);