-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the DumbAwareBGTAction interface to silence the update thread warning. #1332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6ffeb82
to
d6c9822
Compare
didUseShortcut(shortcut) | ||
} | ||
} | ||
SimpleDumbAwareBGTAction { didUseShortcut(shortcut) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -124,7 +124,7 @@ class RemoteRepoPopupController(val project: Project) { | |||
.createPopup() | |||
|
|||
val okAction = | |||
object : DumbAwareAction() { | |||
object : DumbAwareBGTAction() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimpleDumbAwareBGTAction
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SimpleDumbAwareBGTAction
doesn't give the lambda access to the action event class. In its current form, it isn't applicable when the event is actually used, though I may consider refactoring it to remove this restriction.
P.S. This action also uses AnAction#unregisterCustomShortcutSet
, so the simple wrapper is definitely not applicable here.
@@ -19,7 +20,7 @@ private constructor(title: String, content: String, shouldShowUpgradeOption: Boo | |||
init { | |||
icon = Icons.CodyLogo | |||
val learnMoreAction: AnAction = | |||
object : DumbAwareAction("Learn more") { | |||
object : DumbAwareBGTAction("Learn more") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimpleDumbAwareBGTAction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
|
||
if (shouldShowUpgradeOption) { | ||
val upgradeAction: AnAction = | ||
object : DumbAwareAction("Upgrade") { | ||
object : DumbAwareBGTAction("Upgrade") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimpleDumbAwareBGTAction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
class SimpleDumbAwareBGTAction( | ||
text: @NlsActions.ActionText String? = null, | ||
private val action: () -> Unit | ||
) : DumbAwareAction(text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is that supposed to work? Shouldn't it inherit from DumbAwareBGTAction
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
…lence the update thread warning.
This should fix #1327.
Test plan
I have clicked around a little bit in IntelliJ IDEA 2024.1.1 RC, and I haven't seen any OLD_EDT warnings in the log.