Skip to content

Commit 7ec5868

Browse files
committed
switch cus will switch profile
1 parent f319283 commit 7ec5868

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import software.amazon.awssdk.arns.Arn
2626
import software.aws.toolkits.core.utils.debug
2727
import software.aws.toolkits.core.utils.getLogger
2828
import software.aws.toolkits.core.utils.tryOrNull
29+
import software.aws.toolkits.jetbrains.services.amazonq.profile.QProfileSwitchIntent
2930
import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfile
3031
import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager
3132
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.Q_CUSTOM_LEARN_MORE_URI
@@ -108,6 +109,9 @@ class CodeWhispererCustomizationDialog(
108109
RadioButtonOption.Customization -> run {
109110
CodeWhispererModelConfigurator.getInstance().switchCustomization(project, modal.selectedCustomization?.customization)
110111
notifyCustomizationIsSelected(project, modal.selectedCustomization)
112+
if (modal.selectedCustomization?.customization?.profile?.arn != QRegionProfileManager.getInstance().activeProfile(project)?.arn){
113+
QRegionProfileManager.getInstance().switchProfile(project, modal.selectedCustomization?.customization?.profile, QProfileSwitchIntent.Customization)
114+
}
111115
}
112116
}
113117

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/profile/QProfileSwitchIntent.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ package software.aws.toolkits.jetbrains.services.amazonq.profile
88
* 'auth' -> users change the profile through webview profile selector page
99
* 'update' -> plugin auto select the profile on users' behalf as there is only 1 profile
1010
* 'reload' -> on plugin restart, plugin will try to reload previous selected profile
11+
* - 'customization' -> users selected a customization tied to a different profile, triggering a profile switch
1112
*/
1213
enum class QProfileSwitchIntent(val value: String) {
1314
User("user"),
1415
Auth("auth"),
1516
Update("update"),
16-
Reload("reload"), ;
17+
Reload("reload"),
18+
Customization("customization"), ;
1719

1820
override fun toString() = value
1921
}

0 commit comments

Comments
 (0)