mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restore executor action customization logic
1. reuse `NonEmptyActionGroup` (childExecutors size does not work in RemDev) 2. reuse `Executor.isApplicable` for checks from dropped `updateDisabledActionPresentation`. Follow-up after c38d4fb403fba5f0f61d0db24bda52a02f242713 GitOrigin-RevId: f878d73cae35660c5746f7ecbc6f4d351cfe30db
This commit is contained in:
committed by
intellij-monorepo-bot
parent
625f1ca96d
commit
8919a8ea99
@@ -19,6 +19,7 @@ import com.intellij.execution.runners.ExecutionUtil;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.ui.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.actions.NonEmptyActionGroup;
|
||||
import com.intellij.ide.ui.ToolbarSettings;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionIdProvider;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -837,7 +838,7 @@ public final class ExecutorRegistryImpl extends ExecutorRegistry {
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static class ExecutorGroupActionGroup extends ActionGroup implements DumbAware {
|
||||
public static class ExecutorGroupActionGroup extends NonEmptyActionGroup implements DumbAware {
|
||||
protected final ExecutorGroup<?> myExecutorGroup;
|
||||
private final Function<? super Executor, ? extends AnAction> myChildConverter;
|
||||
|
||||
@@ -861,19 +862,18 @@ public final class ExecutorRegistryImpl extends ExecutorRegistry {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ActionUpdateThread getActionUpdateThread() {
|
||||
return ActionUpdateThread.BGT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
final Project project = e.getProject();
|
||||
Project project = e.getProject();
|
||||
if (project == null || !project.isInitialized() || project.isDisposed()) {
|
||||
e.getPresentation().setEnabled(false);
|
||||
return;
|
||||
}
|
||||
e.getPresentation().setEnabledAndVisible(myExecutorGroup.isApplicable(project));
|
||||
if (!myExecutorGroup.isApplicable(project)) {
|
||||
e.getPresentation().setEnabledAndVisible(false);
|
||||
return;
|
||||
}
|
||||
super.update(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,12 +70,8 @@ class ExecutorAction private constructor(val origin: AnAction,
|
||||
}
|
||||
|
||||
private fun wrapEvent(e: AnActionEvent, order : Int): AnActionEvent {
|
||||
val dataContext = wrapContext(e.dataContext, order)
|
||||
return AnActionEvent(e.inputEvent, dataContext, e.place, e.presentation, e.actionManager, e.modifiers)
|
||||
}
|
||||
|
||||
private fun wrapContext(dataContext: DataContext, order : Int): DataContext {
|
||||
return if (order == 0) dataContext else MyDataContext(dataContext, order)
|
||||
return if (order == 0) e
|
||||
else e.withDataContext(MyDataContext(e.dataContext, order))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
Reference in New Issue
Block a user