Skip to content

Commit 9f76d55

Browse files
authored
Fix cloudwatch logs open existing tab (#3260)
* revert changes * fixed edt issues * detekt changes * test * fixed test * Remove unused parameters * remove spaces * added changelog
1 parent 3a762c6 commit 9f76d55

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix opening toolwindow tabs in incorrect thread in Cloudwatch Logs"
4+
}

jetbrains-core/src/software/aws/toolkits/jetbrains/core/toolwindow/ToolkitToolWindow.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ interface ToolkitToolWindow {
7070

7171
val content = find(id)
7272
if (content != null) {
73-
toolWindow.activate(null, true)
74-
toolWindow.contentManager.setSelectedContent(content)
73+
runInEdt {
74+
toolWindow.activate(null, true)
75+
toolWindow.contentManager.setSelectedContent(content)
76+
}
77+
7578
return true
7679
}
7780

jetbrains-core/src/software/aws/toolkits/jetbrains/services/cloudwatch/logs/insights/DetailedLogRecord.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package software.aws.toolkits.jetbrains.services.cloudwatch.logs.insights
55

66
import com.intellij.openapi.Disposable
7+
import com.intellij.openapi.application.runInEdt
78
import com.intellij.openapi.project.Project
89
import com.intellij.ui.TableSpeedSearch
910
import com.intellij.ui.components.breadcrumbs.Breadcrumbs
@@ -61,8 +62,11 @@ class DetailedLogRecord(
6162
coroutineScope.launch {
6263
val record = recordLoadTask.await()
6364
val items = record.map { it.key to it.value }
64-
tableView.listTableModel.items = items
65-
tableView.setPaintBusy(false)
65+
66+
runInEdt {
67+
tableView.listTableModel.items = items
68+
tableView.setPaintBusy(false)
69+
}
6670

6771
if (items.isNotEmpty()) {
6872
val logGroup = record["@log"] ?: return@launch

jetbrains-core/tst/software/aws/toolkits/jetbrains/services/cloudwatch/logs/insights/DetailedLogRecordTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package software.aws.toolkits.jetbrains.services.cloudwatch.logs.insights
55

66
import com.intellij.testFramework.EdtRule
77
import com.intellij.testFramework.RuleChain
8-
import com.intellij.testFramework.RunsInEdt
98
import kotlinx.coroutines.delay
109
import kotlinx.coroutines.runBlocking
1110
import org.assertj.core.api.Assertions.assertThat
@@ -23,7 +22,6 @@ import software.aws.toolkits.jetbrains.core.MockClientManagerRule
2322
import software.aws.toolkits.jetbrains.utils.rules.JavaCodeInsightTestFixtureRule
2423
import software.aws.toolkits.jetbrains.utils.waitForModelToBeAtLeast
2524

26-
@RunsInEdt
2725
class DetailedLogRecordTest {
2826
val projectRule = JavaCodeInsightTestFixtureRule()
2927

@@ -50,6 +48,7 @@ class DetailedLogRecordTest {
5048
)
5149
val sut = DetailedLogRecord(projectRule.project, client, "ptr")
5250
val model = sut.tableView.listTableModel
51+
5352
runBlocking {
5453
model.waitForModelToBeAtLeast(1)
5554
}

0 commit comments

Comments
 (0)