|
25 | 25 | import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager; |
26 | 26 | import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation; |
27 | 27 | import com.microsoft.azure.toolkit.lib.common.operation.OperationBundle; |
| 28 | +import com.microsoft.azure.toolkit.lib.common.task.AzureTask; |
28 | 29 | import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager; |
29 | 30 | import com.microsoft.azure.toolkit.lib.compute.virtualmachine.VirtualMachine; |
30 | 31 | import org.apache.commons.lang3.reflect.MethodUtils; |
@@ -56,16 +57,18 @@ public static void browseRemoteHost(VirtualMachine vm, @Nonnull Project project) |
56 | 57 | private static void tryConnecting(@Nonnull Project project, SshConfig sshConfig, Runnable callback) { |
57 | 58 | final SshUiData sshUiData = new SshUiData(sshConfig); |
58 | 59 | final AzureString title = OperationBundle.description("vm.connecting.vm", sshConfig.getName()); |
59 | | - AzureTaskManager.getInstance().runInModal(title, () -> { |
| 60 | + final AzureTask<Void> task = new AzureTask<>(title, () -> { |
60 | 61 | try { |
61 | 62 | RemoteCredentialsUtil.connectionBuilder(sshUiData, project) |
62 | | - .withConnectionTimeout(10L, TimeUnit.SECONDS) |
63 | | - .checkCanAuthenticate(true); |
| 63 | + .withConnectionTimeout(10L, TimeUnit.SECONDS) |
| 64 | + .checkCanAuthenticate(true); |
64 | 65 | AzureTaskManager.getInstance().runLater(callback); |
65 | 66 | } catch (final SshException e) { |
66 | 67 | AzureMessager.getMessager().error(e, title.toString()); |
67 | 68 | } |
68 | 69 | }); |
| 70 | + task.setBackgroundable(false); |
| 71 | + AzureTaskManager.getInstance().runInModal(task); |
69 | 72 | } |
70 | 73 |
|
71 | 74 | private static void selectServerInToolWindow(ToolWindow toolWindow, String serverName, @Nonnull Project project) { |
|
0 commit comments