drop RunnerContentUi.ToggleSeparateWatches

Besides cleanup, fixes
IJPL-158013 `BackendToggleAction.isSelected` must not be called

GitOrigin-RevId: 012be42757842f7589e7cc5ac1f9c67ef99ad0db
This commit is contained in:
Gregory.Shrago
2024-07-10 03:20:11 +04:00
committed by intellij-monorepo-bot
parent 9592fceda6
commit 30fe2c837e
6 changed files with 13 additions and 48 deletions

View File

@@ -18,7 +18,6 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbAwareToggleAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.AbstractPainter;
import com.intellij.openapi.ui.ShadowAction;
@@ -1478,19 +1477,20 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
private void updateRestoreLayoutActionVisibility() {
List<AnAction> specialActions = new ArrayList<>();
for (AnAction action : myViewActions.getChildren(ActionManager.getInstance())) {
ActionManager actionManager = ActionManager.getInstance();
for (AnAction action : myViewActions.getChildren(actionManager)) {
if (!(action instanceof ViewLayoutModificationAction)) specialActions.add(action);
}
if (myMinimizeActionEnabled) {
if (specialActions.isEmpty()) {
var separateWatchesInVariables = ActionManager.getInstance().getAction("XDebugger.SwitchWatchesInVariables");
if (separateWatchesInVariables instanceof ToggleAction) {
myViewActions.addAction(new Separator()).setAsSecondary(true);
myViewActions.addAction(new ToggleSeparateWatches((ToggleAction)separateWatchesInVariables, true)).setAsSecondary(true);
}
myViewActions.addAction(new Separator()).setAsSecondary(true);
myViewActions.addAction(ActionManager.getInstance().getAction("Runner.ToggleTabLabels")).setAsSecondary(true);
myViewActions.addAction(ActionManager.getInstance().getAction("Runner.RestoreLayout")).setAsSecondary(true);
AnAction separateWatches = actionManager.getAction("XDebugger.SeparateWatches");
if (separateWatches != null) {
myViewActions.addAction(separateWatches).setAsSecondary(true);
myViewActions.addAction(new Separator()).setAsSecondary(true);
}
myViewActions.addAction(actionManager.getAction("Runner.ToggleTabLabels")).setAsSecondary(true);
myViewActions.addAction(actionManager.getAction("Runner.RestoreLayout")).setAsSecondary(true);
}
}
else {
@@ -2093,34 +2093,6 @@ public final class RunnerContentUi implements ContentUI, Disposable, CellTransfo
}
}
private static final class ToggleSeparateWatches extends DumbAwareToggleAction {
private final @NotNull ToggleAction delegate;
private final boolean myInverted;
private ToggleSeparateWatches(@NotNull ToggleAction delegate, boolean inverted) {
super(ExecutionBundle.messagePointer("show.separate.watches.action.name"));
this.delegate = delegate;
myInverted = inverted;
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
boolean isSelected = delegate.isSelected(e);
return myInverted != isSelected;
}
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return delegate.getActionUpdateThread();
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
delegate.setSelected(e, myInverted != state);
}
}
private void fireContentOpened(@NotNull Content content) {
for (Listener each : myDockingListeners) {
each.contentAdded(content);

View File

@@ -699,7 +699,6 @@ notification.group.services=Run configurations in Services tool window
notification.group.execution=External process execution failed
notification.group.execution.silent=External process execution log
show.separate.watches.action.name=Separate Watches
terminal.default.title=Unnamed
dialog.title.preparing.execution=Preparing Execution...
new.folder=New Folder

View File

@@ -1353,7 +1353,7 @@ action.XDebugger.EditWatch.text=Edit...
action.XDebugger.CopyWatch.text=Duplicate Watch
action.XDebugger.MoveWatchUp.text=Move Watch Up
action.XDebugger.MoveWatchDown.text=Move Watch Down
action.XDebugger.SwitchWatchesInVariables.text=Show Watches in Variables Tab
action.XDebugger.SeparateWatches.text=Separate Watches
action.XDebugger.ToggleEvaluateExpressionField.text=Show Evaluate Expression Field
action.XDebugger.PreviewTab.text=Open Files in Preview Tab
action.XDebugger.Inline.text=Show Variable Values in Editor

View File

@@ -1225,7 +1225,7 @@
use-shortcut-of="$Delete"/>
<action id="XDebugger.MoveWatchUp" class="com.intellij.xdebugger.impl.frame.actions.XMoveWatchUp" use-shortcut-of="MoveLineUp"/>
<action id="XDebugger.MoveWatchDown" class="com.intellij.xdebugger.impl.frame.actions.XMoveWatchDown" use-shortcut-of="MoveLineDown"/>
<action id="XDebugger.SwitchWatchesInVariables" class="com.intellij.xdebugger.impl.frame.actions.XSwitchWatchesInVariables"
<action id="XDebugger.SeparateWatches" class="com.intellij.xdebugger.impl.frame.actions.XSeparateWatchesAndVariables"
icon="AllIcons.Debugger.Watch"/>
<action id="XDebugger.ToggleEvaluateExpressionField" class="com.intellij.xdebugger.impl.frame.actions.XToggleEvaluateExpressionFieldAction"/>
<action id="XDebugger.RemoveAllWatches" class="com.intellij.xdebugger.impl.frame.actions.XRemoveAllWatchesAction"/>

View File

@@ -1950,12 +1950,6 @@ c:com.intellij.xdebugger.impl.frame.actions.XRemoveWatchAction
- getActionUpdateThread():com.intellij.openapi.actionSystem.ActionUpdateThread
- p:perform(com.intellij.openapi.actionSystem.AnActionEvent,com.intellij.xdebugger.impl.ui.tree.XDebuggerTree,com.intellij.xdebugger.impl.frame.XWatchesView):V
- update(com.intellij.openapi.actionSystem.AnActionEvent):V
c:com.intellij.xdebugger.impl.frame.actions.XSwitchWatchesInVariables
- com.intellij.openapi.actionSystem.ToggleAction
- <init>():V
- getActionUpdateThread():com.intellij.openapi.actionSystem.ActionUpdateThread
- isSelected(com.intellij.openapi.actionSystem.AnActionEvent):Z
- setSelected(com.intellij.openapi.actionSystem.AnActionEvent,Z):V
c:com.intellij.xdebugger.impl.frame.actions.XToggleEvaluateExpressionFieldAction
- com.intellij.openapi.project.DumbAwareToggleAction
- <init>():V

View File

@@ -8,12 +8,12 @@ import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
import org.jetbrains.annotations.NotNull;
public class XSwitchWatchesInVariables extends ToggleAction {
final class XSeparateWatchesAndVariables extends ToggleAction {
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(e.getData(XDebugSession.DATA_KEY) != null);
XDebugSessionTab tab = e.getData(XDebugSessionTab.TAB_KEY);
return tab == null || tab.isWatchesInVariables();
return tab != null && !tab.isWatchesInVariables();
}
@Override