diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java index c633976df2be..68cbafb202b6 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/DeployToServerState.java @@ -67,18 +67,13 @@ public class DeployToServerState() { - @Override - public void run(String s) { - RemoteServersView.getInstance(project).showDeployment(connection, s); - } - }); - } - }); + connection.deploy(new DeploymentTaskImpl(mySource, myConfiguration, project, debugConnector, myEnvironment), + new ParameterizedRunnable() { + @Override + public void run(String s) { + RemoteServersView.getInstance(project).showDeployment(connection, s); + } + }); return null; } } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java index 71f04e2265f1..f12e646a72b9 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java @@ -1,10 +1,12 @@ package com.intellij.remoteServer.impl.runtime; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.remoteServer.configuration.RemoteServer; import com.intellij.remoteServer.configuration.ServerConfiguration; import com.intellij.remoteServer.runtime.ServerConnection; import com.intellij.remoteServer.runtime.ServerConnectionManager; +import com.intellij.util.Alarm; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,6 +19,9 @@ import java.util.Map; * @author nik */ public class ServerConnectionManagerImpl extends ServerConnectionManager { + + private static final int POLL_DEPLOYMENTS_DELAY = 2000; + private final Map, ServerConnection> myConnections = new HashMap, ServerConnection>(); private final ServerConnectionEventDispatcher myEventDispatcher = new ServerConnectionEventDispatcher(); @@ -29,10 +34,29 @@ public class ServerConnectionManagerImpl extends ServerConnectionManager { connection = doCreateConnection(server, this); myConnections.put(server, connection); myEventDispatcher.fireConnectionCreated(connection); + pollDeployments(connection); } return connection; } + private void pollDeployments(final ServerConnection connection) { + connection.computeDeployments(new Runnable() { + + @Override + public void run() { + new Alarm().addRequest(new Runnable() { + + @Override + public void run() { + if (connection == getConnection(connection.getServer())) { + pollDeployments(connection); + } + } + }, POLL_DEPLOYMENTS_DELAY, ModalityState.any()); + } + }); + } + @NotNull @Override public ServerConnection createTemporaryConnection(@NotNull RemoteServer server) { diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java index df649453ee4e..f860d6dfa98c 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java @@ -108,7 +108,7 @@ public class ServersToolWindowContent extends JPanel implements Disposable { Set nodes = getSelectedRemoteServerNodes(); if (nodes.size() == 1) { RemoteServer server = nodes.iterator().next().getValue(); - ServerConnectionManager.getInstance().getOrCreateConnection(server).computeDeployments(EmptyRunnable.INSTANCE); + ServerConnectionManager.getInstance().getOrCreateConnection(server); return true; } return false; diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java index 96cd0fa87c56..4cb1c01943be 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java @@ -255,8 +255,7 @@ public class ServersTreeStructure extends AbstractTreeStructureBase { @Override public void startServer(@NotNull Executor executor) { - ServerConnection connection = ServerConnectionManager.getInstance().getOrCreateConnection(getValue()); - connection.computeDeployments(EmptyRunnable.INSTANCE); + ServerConnectionManager.getInstance().getOrCreateConnection(getValue()); } @Override