mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-116466 - Heroku deployment: provide possibility to refresh ApplicationServers view w/o server restart
This commit is contained in:
+7
-12
@@ -67,18 +67,13 @@ public class DeployToServerState<S extends ServerConfiguration, D extends Deploy
|
||||
else {
|
||||
debugConnector = null;
|
||||
}
|
||||
connection.computeDeployments(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
connection.deploy(new DeploymentTaskImpl(mySource, myConfiguration, project, debugConnector, myEnvironment),
|
||||
new ParameterizedRunnable<String>() {
|
||||
@Override
|
||||
public void run(String s) {
|
||||
RemoteServersView.getInstance(project).showDeployment(connection, s);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
connection.deploy(new DeploymentTaskImpl(mySource, myConfiguration, project, debugConnector, myEnvironment),
|
||||
new ParameterizedRunnable<String>() {
|
||||
@Override
|
||||
public void run(String s) {
|
||||
RemoteServersView.getInstance(project).showDeployment(connection, s);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -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<RemoteServer<?>, ServerConnection> myConnections = new HashMap<RemoteServer<?>, 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 <C extends ServerConfiguration> ServerConnection createTemporaryConnection(@NotNull RemoteServer<C> server) {
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public class ServersToolWindowContent extends JPanel implements Disposable {
|
||||
Set<ServersTreeStructure.RemoteServerNode> 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;
|
||||
|
||||
+1
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user