Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Q panel will get stuck while signin if users have multiple windows"
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
project.messageBus.connect(toolWindow.disposable).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line project is shadowing outside AmazonQToolWindowFactory.project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thus the following 2 lines also use the wrong project

AmazonQToolWindow.getInstance(project).disposeAndRecreate()
qPanel.setContent(AmazonQToolWindow.getInstance(project).component)

override fun onProfileSelected(profile: QRegionProfile?) {
if (project.isDisposed) return
AmazonQToolWindow.getInstance(project).disposeAndRecreate()
qPanel.setContent(AmazonQToolWindow.getInstance(project).component)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class CodeScanChatApp(private val scope: CoroutineScope) : AmazonQApp {
context.project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
chatSessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package software.aws.toolkits.jetbrains.services.amazonqCodeTest

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnection
Expand Down Expand Up @@ -78,7 +77,7 @@ class CodeTestChatApp(private val scope: CoroutineScope) : AmazonQApp {
context.project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
chatSessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package software.aws.toolkits.jetbrains.services.amazonqDoc

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import kotlinx.coroutines.launch
import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnection
Expand Down Expand Up @@ -81,7 +80,7 @@ class DocApp : AmazonQApp {
context.project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
chatSessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package software.aws.toolkits.jetbrains.services.amazonqFeatureDev

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import kotlinx.coroutines.launch
import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnection
Expand Down Expand Up @@ -82,7 +81,7 @@ class FeatureDevApp : AmazonQApp {
context.project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
chatSessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class FeatureDevController(
context.project.messageBus.connect().subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
chatSessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package software.aws.toolkits.jetbrains.services.cwc

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.launch
import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope
Expand Down Expand Up @@ -82,7 +81,7 @@ class App : AmazonQApp {
ApplicationManager.getApplication().messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
inboundAppMessagesHandler.processSessionClear()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class InlineChatController(
project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
sessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
stopModernize()
codeTransformationSession?.let {
Disposer.dispose(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package software.aws.toolkits.jetbrains.services.codemodernizer

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.launch
import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope
Expand Down Expand Up @@ -168,7 +167,7 @@ class CodeTransformChatApp : AmazonQApp {
context.project.messageBus.connect(this).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
chatSessionStorage.deleteAllSessions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class QRegionProfileManagerTest {
project.messageBus.connect(disposableRule.disposable).subscribe(
QRegionProfileSelectedListener.TOPIC,
object : QRegionProfileSelectedListener {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
override fun onProfileSelected(profile: QRegionProfile?) {
cnt += 1
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ class QRegionProfileManager : PersistentStateComponent<QProfileState>, Disposabl
}
}

project.messageBus
ApplicationManager.getApplication().messageBus
.syncPublisher(QRegionProfileSelectedListener.TOPIC)
.onProfileSelected(project, newProfile)
.onProfileSelected(newProfile)
}

private fun invalidateProfile(arn: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

package software.aws.toolkits.jetbrains.services.amazonq.profile

import com.intellij.openapi.project.Project
import com.intellij.util.messages.Topic

interface QRegionProfileSelectedListener {
companion object {
@Topic.ProjectLevel
@Topic.AppLevel
val TOPIC = Topic.create("QRegionProfileSelected", QRegionProfileSelectedListener::class.java)
}

fun onProfileSelected(project: Project, profile: QRegionProfile?)
fun onProfileSelected(profile: QRegionProfile?)
}
Loading