IDEA-172133 "Add to Watches" action does not "follow" editor selection

This commit is contained in:
Egor.Ushakov
2017-05-02 19:45:51 +03:00
parent 411ca11c96
commit 151fbba790
6 changed files with 31 additions and 8 deletions
@@ -1031,7 +1031,6 @@ action.XDebugger.JumpToTypeSource.text=Jump To Type Source
action.XDebugger.JumpToTypeSource.description=Open source of the selected value's type
action.XDebugger.Inspect.text=Inspect...
action.Debugger.Tree.AddToWatches.text=Add to Watches
action.Debugger.Tree.EvaluateInConsole.text=Evaluate In Console
action.XDebugger.RemoveWatch.text=Remove Watch
@@ -730,7 +730,6 @@
<action id="XDebugger.JumpToTypeSource" class="com.intellij.xdebugger.impl.ui.tree.actions.XJumpToTypeSourceAction"
use-shortcut-of="Debugger.EditTypeSource"/>
<action id="Debugger.Tree.AddToWatches" class="com.intellij.xdebugger.impl.ui.tree.actions.XAddToWatchesAction" icon="AllIcons.Debugger.AddToWatch"/>
<action id="Debugger.Tree.EvaluateInConsole" class="com.intellij.xdebugger.impl.ui.tree.actions.EvaluateInConsoleFromTreeAction"/>
<action id="XDebugger.NewWatch" class="com.intellij.xdebugger.impl.frame.actions.XNewWatchAction" icon="AllIcons.Debugger.NewWatch"/>
@@ -796,7 +795,7 @@
<separator/>
<reference ref="EvaluateExpression"/>
<reference ref="Debugger.Tree.EvaluateInConsole"/>
<reference ref="Debugger.Tree.AddToWatches"/>
<reference ref="Debugger.AddToWatch"/>
<reference ref="Debugger.ShowReferring"/>
<separator/>
<reference ref="XDebugger.JumpToSource"/>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,15 @@
*/
package com.intellij.xdebugger.impl.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.xdebugger.impl.DebuggerSupport;
import com.intellij.xdebugger.impl.ui.tree.actions.XAddToWatchesTreeAction;
import com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase;
import org.jetbrains.annotations.NotNull;
final class AddToWatchesAction extends XDebuggerActionBase {
private static final XAddToWatchesTreeAction TREE_ACTION = new XAddToWatchesTreeAction();
public AddToWatchesAction() {
super(true);
}
@@ -28,4 +33,24 @@ final class AddToWatchesAction extends XDebuggerActionBase {
protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) {
return debuggerSupport.getAddToWatchesActionHandler();
}
@Override
public void update(AnActionEvent event) {
if (XDebuggerTreeActionBase.getSelectedNode(event.getDataContext()) != null) {
TREE_ACTION.update(event);
}
else {
super.update(event);
}
}
@Override
public void actionPerformed(AnActionEvent event) {
if (XDebuggerTreeActionBase.getSelectedNode(event.getDataContext()) != null) {
TREE_ACTION.actionPerformed(event);
}
else {
super.actionPerformed(event);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class EvaluateInConsoleFromTreeAction extends XAddToWatchesAction {
class EvaluateInConsoleFromTreeAction extends XAddToWatchesTreeAction {
@Override
protected boolean isEnabled(@NotNull XValueNodeImpl node, @NotNull AnActionEvent e) {
return super.isEnabled(node, e) && getConsoleExecuteAction(e) != null;
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
* This action works only in the variables view
* @see com.intellij.xdebugger.impl.actions.AddToWatchesAction
*/
class XAddToWatchesAction extends XDebuggerTreeActionBase {
public class XAddToWatchesTreeAction extends XDebuggerTreeActionBase {
@Override
protected boolean isEnabled(@NotNull final XValueNodeImpl node, @NotNull AnActionEvent e) {
return super.isEnabled(node, e) && DebuggerUIUtil.hasEvaluationExpression(node.getValueContainer()) && getWatchesView(e) != null;
+1 -1
View File
@@ -835,7 +835,7 @@
</action>
<action id="PyDebugger.ViewArray" class="com.jetbrains.python.debugger.containerview.PyViewNumericContainerAction" text="View as Array">
<add-to-group group-id="XDebugger.ValueGroup" anchor="after" relative-to-action="Debugger.Tree.AddToWatches"/>
<add-to-group group-id="XDebugger.ValueGroup" anchor="after" relative-to-action="Debugger.AddToWatch"/>
</action>
<action id="PyConvertModuleToPackage" class="com.jetbrains.python.refactoring.convertModulePackage.PyConvertModuleToPackageAction"