[completion] IJPL-207762 allow ActionRemoteBehaviorSpecification to default to null behavior

GitOrigin-RevId: 3f6c460ab7f327779ec057b2352d0c0430502a71
This commit is contained in:
Max Medvedev
2025-10-14 00:05:43 +00:00
committed by intellij-monorepo-bot
parent d098eb720d
commit 323a3bbf72
2 changed files with 3 additions and 3 deletions
@@ -69,7 +69,7 @@ enum class ActionRemoteBehavior {
@ApiStatus.Internal
@ApiStatus.Experimental
interface ActionRemoteBehaviorSpecification {
fun getBehavior(): ActionRemoteBehavior
fun getBehavior(): ActionRemoteBehavior?
interface Frontend : ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.FrontendOnly
@@ -40,7 +40,7 @@ private fun ActionRuntimeRegistrar.replaceExistingAction(
}
private fun hideActionOnWelcomeScreen(action: AnAction): AnAction {
return if (action is ActionRemoteBehaviorSpecification) {
return if (action is ActionRemoteBehaviorSpecification && action.getBehavior() != null) {
WelcomeScreenHiddenActionWithRemoteSpec(action)
}
else {
@@ -51,7 +51,7 @@ private fun hideActionOnWelcomeScreen(action: AnAction): AnAction {
private class WelcomeScreenHiddenActionWithRemoteSpec<T>(val actionWithSpec: T) : WelcomeScreenHiddenAction(actionWithSpec),
ActionRemoteBehaviorSpecification
where T : AnAction, T : ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = actionWithSpec.getBehavior()
override fun getBehavior(): ActionRemoteBehavior? = actionWithSpec.getBehavior()
}
private open class WelcomeScreenHiddenAction(action: AnAction) : AnActionWrapper(action) {