mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CR-IC-5700 - move polling to ui
This commit is contained in:
-21
@@ -20,8 +20,6 @@ import java.util.Map;
|
||||
*/
|
||||
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();
|
||||
|
||||
@@ -34,29 +32,10 @@ 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) {
|
||||
|
||||
+23
-1
@@ -6,6 +6,7 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.ide.util.treeView.NodeDescriptor;
|
||||
import com.intellij.ide.util.treeView.NodeRenderer;
|
||||
import com.intellij.ide.util.treeView.TreeVisitor;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.ServersTreeStructure;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -13,7 +14,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.remoteServer.configuration.RemoteServer;
|
||||
import com.intellij.remoteServer.impl.runtime.log.LoggingHandlerImpl;
|
||||
import com.intellij.remoteServer.impl.runtime.ui.tree.DeploymentNode;
|
||||
@@ -28,6 +28,7 @@ import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.SideBorder;
|
||||
import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -56,6 +57,8 @@ public class ServersToolWindowContent extends JPanel implements Disposable {
|
||||
private static final String MESSAGE_CARD = "message";
|
||||
private static final String EMPTY_SELECTION_MESSAGE = "Select a server or deployment in the tree to view details";
|
||||
|
||||
private static final int POLL_DEPLOYMENTS_DELAY = 2000;
|
||||
|
||||
private final Tree myTree;
|
||||
private final CardLayout myPropertiesPanelLayout;
|
||||
private final JPanel myPropertiesPanel;
|
||||
@@ -188,6 +191,7 @@ public class ServersToolWindowContent extends JPanel implements Disposable {
|
||||
@Override
|
||||
public void onConnectionCreated(@NotNull ServerConnection<?> connection) {
|
||||
getBuilder().queueUpdate();
|
||||
pollDeployments(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,6 +214,24 @@ public class ServersToolWindowContent extends JPanel implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private static void pollDeployments(final ServerConnection connection) {
|
||||
connection.computeDeployments(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new Alarm().addRequest(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (connection == ServerConnectionManager.getInstance().getConnection(connection.getServer())) {
|
||||
pollDeployments(connection);
|
||||
}
|
||||
}
|
||||
}, POLL_DEPLOYMENTS_DELAY, ModalityState.any());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private JComponent createToolbar() {
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
group.add(ActionManager.getInstance().getAction(SERVERS_TOOL_WINDOW_TOOLBAR));
|
||||
|
||||
Reference in New Issue
Block a user