package com.cleverCloud.cleverIdea.action;

import com.cleverCloud.cleverIdea.Settings;
import com.cleverCloud.cleverIdea.api.json.Application;
import com.cleverCloud.cleverIdea.vcs.GitProjectDetector;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;

public class DeployAction extends AnAction {
  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    if (e.getProject() == null) return;

    Settings settings = ServiceManager.getService(e.getProject(), Settings.class);
    ArrayList<Application> apps = settings.apps;
    if (apps.isEmpty()) {
      GitProjectDetector gitProjectDetector = new GitProjectDetector(e.getProject());
      apps = gitProjectDetector.detect();
    }
    DeployDialog dialog = new DeployDialog(e.getProject(), apps);
    if (dialog.showAndGet()) {
    }
  }
}

@@ -195,16 +195,56 @@
 tector;%0A
+import com.intellij.dvcs.push.PushSpec;%0A
 import c
@@ -282,24 +282,24 @@
 m.AnAction;%0A
-
 import com.i
@@ -397,16 +397,125 @@
 anager;%0A
+import git4idea.push.GitPushSupport;%0Aimport git4idea.push.GitPushTarget;%0Aimport git4idea.repo.GitRepository;%0A
 import o
@@ -576,16 +576,46 @@
 rayList;
+%0Aimport java.util.Collections;
 %0A%0Apublic
@@ -1118,24 +1118,24 @@
 t(), apps);%0A
-
     if (dial
@@ -1149,24 +1149,702 @@
 AndGet()) %7B%0A
+      /*GitPushSupport pushSupport = ServiceManager.getService(e.getProject(), GitPushSupport.class);%0A      // this simply creates the GitPushSource wrapper around the current branch or current revision in case of the detached HEAD%0A      GitPushSource source = pushSupport.getSource(repository);%0A%0A      //GitPushTarget target = // create target either directly, or by using some methods from GitPushSupport. Just check them, most%0A      // probably you'll find what's needed.%0A      Map%3CGitRepository, PushSpec%3CGitPushSource, GitPushTarget%3E pushSpecs = Collections.singletonMap(repository, new PushSpec(source, target));%0A%0A      pushSupport.getPusher().push(specs, null, false);*/%0A
     %7D%0A  %7D%0A%7D%0A

Add potentil push solution