[RIDER] Fix BackendOnly actions for Rider and Nova

GitOrigin-RevId: 167354d75c53f8ead9818b3d45371d6419f376f0
This commit is contained in:
Nikita.Lyubimov
2024-06-06 16:02:11 +02:00
committed by intellij-monorepo-bot
parent a74c7e04ef
commit e159378fd8
8 changed files with 17 additions and 34 deletions

View File

@@ -57,6 +57,13 @@ interface ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.FrontendThenBackend
}
interface BackendOnly : ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior {
if (PlatformUtils.isRider() || PlatformUtils.isCLion()) return ActionRemoteBehavior.FrontendThenBackend
return ActionRemoteBehavior.BackendOnly
}
}
interface Duplicated : ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.Duplicated
}

View File

@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Objects;
import java.util.function.Supplier;
public abstract class BaseRunConfigurationAction extends ActionGroup implements ActionRemoteBehaviorSpecification, DumbAware {
public abstract class BaseRunConfigurationAction extends ActionGroup implements ActionRemoteBehaviorSpecification.BackendOnly, DumbAware {
protected static final Logger LOG = Logger.getInstance(BaseRunConfigurationAction.class);
protected BaseRunConfigurationAction(@NotNull Supplier<String> text, @NotNull Supplier<String> description, final Icon icon) {
@@ -55,11 +55,6 @@ public abstract class BaseRunConfigurationAction extends ActionGroup implements
return ActionUpdateThread.BGT;
}
@Override
public @NotNull ActionRemoteBehavior getBehavior() {
return ActionRemoteBehavior.BackendOnly;
}
@Override
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
return e != null ? getChildren(e.getDataContext(), e.getPlace()) : EMPTY_ARRAY;

View File

@@ -83,9 +83,7 @@ private const val TAG_REGULAR_SHOW = "regular-show" // shown regularly
private const val TAG_REGULAR_DUPE = "regular-dupe" // shown regularly until search (pinned/recent duplicate)
private const val TAG_HIDDEN = "hidden" // hidden until search
class RunConfigurationsActionGroup : ActionGroup(), ActionRemoteBehaviorSpecification {
override fun getBehavior() = if (PlatformUtils.isRider() || PlatformUtils.isCLion()) ActionRemoteBehavior.FrontendThenBackend else ActionRemoteBehavior.BackendOnly
class RunConfigurationsActionGroup : ActionGroup(), ActionRemoteBehaviorSpecification.BackendOnly {
override fun getChildren(e: AnActionEvent?): Array<AnAction> {
val project = e?.project ?: return emptyArray()
val selectedFile = e.getData(PlatformDataKeys.LAST_ACTIVE_FILE_EDITOR)?.file

View File

@@ -36,9 +36,7 @@ import com.intellij.psi.util.PsiTreeUtil
import java.util.function.Predicate
class ShowSettingsWithAddedPattern : AnAction(), ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.BackendOnly
class ShowSettingsWithAddedPattern : AnAction(), ActionRemoteBehaviorSpecification.BackendOnly {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
@@ -65,9 +63,7 @@ class ShowSettingsWithAddedPattern : AnAction(), ActionRemoteBehaviorSpecificati
}
}
class ShowParameterHintsSettings : AnAction(), ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.BackendOnly
class ShowParameterHintsSettings : AnAction(), ActionRemoteBehaviorSpecification.BackendOnly {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
@@ -264,9 +260,7 @@ private fun InlayParameterHintsProvider.hasDisabledOptionHintInfo(element: PsiEl
}
class ToggleInlineHintsAction : AnAction(), ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.BackendOnly
class ToggleInlineHintsAction : AnAction(), ActionRemoteBehaviorSpecification.BackendOnly {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT

View File

@@ -11,13 +11,7 @@ import com.intellij.openapi.actionSystem.remoting.ActionRemoteBehaviorSpecificat
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
public final class ToggleCompletionHintsAction extends ToggleAction implements ActionRemoteBehaviorSpecification {
@NotNull
@Override
public ActionRemoteBehavior getBehavior() {
return ActionRemoteBehavior.BackendOnly;
}
public final class ToggleCompletionHintsAction extends ToggleAction implements ActionRemoteBehaviorSpecification.BackendOnly {
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {

View File

@@ -41,7 +41,7 @@ import kotlinx.coroutines.withContext
import java.io.File
import java.nio.file.Files
open class OpenFileAction : AnAction(), DumbAware, LightEditCompatible, ActionRemoteBehaviorSpecification {
open class OpenFileAction : AnAction(), DumbAware, LightEditCompatible, ActionRemoteBehaviorSpecification.BackendOnly {
companion object {
@JvmStatic
fun openFile(filePath: String, project: Project) {
@@ -67,9 +67,7 @@ open class OpenFileAction : AnAction(), DumbAware, LightEditCompatible, ActionRe
init {
templatePresentation.isApplicationScope = true
}
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.BackendOnly
override fun actionPerformed(e: AnActionEvent) {
val project = e.project
val showFiles = project != null || PlatformProjectOpenProcessor.getInstanceIfItExists() != null

View File

@@ -62,13 +62,11 @@ internal class CacheRecoveryActionGroup: ActionGroup(), DumbAware {
private fun RecoveryAction.toAnAction(): AnAction {
val recoveryAction = this
return object: DumbAwareAction(recoveryAction.presentableName), ActionRemoteBehaviorSpecification {
return object: DumbAwareAction(recoveryAction.presentableName), ActionRemoteBehaviorSpecification.BackendOnly {
init {
templatePresentation.isApplicationScope = true
}
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.BackendOnly
override fun actionPerformed(e: AnActionEvent) {
val scope = RecoveryScope.createInstance(e)
recoveryAction.performUnderProgress(scope,false)

View File

@@ -17,8 +17,7 @@ import com.intellij.platform.ide.progress.withBackgroundProgress
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
private class ShowTipsAction : AnAction(), DumbAware, ActionRemoteBehaviorSpecification {
override fun getBehavior(): ActionRemoteBehavior = ActionRemoteBehavior.BackendOnly
private class ShowTipsAction : AnAction(), DumbAware, ActionRemoteBehaviorSpecification.BackendOnly {
override fun actionPerformed(e: AnActionEvent) {
val project = e.project