Debugger, XDebugger: ctrl+c to copy value

This commit is contained in:
Anton Makeev
2010-08-02 12:55:31 +04:00
parent 0f14a58c99
commit 54ddd29235
8 changed files with 20 additions and 9 deletions
@@ -38,6 +38,7 @@ public interface DebuggerActions extends XDebuggerActions {
@NonNls String NEW_WATCH = "Debugger.NewWatch";
@NonNls String EDIT_WATCH = "Debugger.EditWatch";
@NonNls String MARK_OBJECT = "Debugger.MarkObject";
@NonNls String COPY_VALUE = "Debugger.CopyValue";
@NonNls String SET_VALUE = "Debugger.SetValue";
@NonNls String EDIT_FRAME_SOURCE = "Debugger.EditFrameSource";
@NonNls String EDIT_NODE_SOURCE = "Debugger.EditNodeSource";
@@ -27,6 +27,7 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTree;
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionPopupMenu;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.project.Project;
import com.intellij.ui.ScrollPaneFactory;
import org.jetbrains.annotations.NotNull;
@@ -40,8 +41,9 @@ public class InspectPanel extends DebuggerTreePanel {
getInspectTree().setInspectDescriptor(inspectDescriptor);
add(ScrollPaneFactory.createScrollPane(getInspectTree()), BorderLayout.CENTER);
final Disposable disposable = DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE);
registerDisposable(disposable);
registerDisposable(DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE));
overrideShortcut(getInspectTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
setUpdateEnabled(true);
}
@@ -24,6 +24,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.project.Project;
import com.intellij.util.Alarm;
import com.sun.jdi.VMDisconnectedException;
@@ -124,7 +125,7 @@ public abstract class UpdatableDebuggerView extends JPanel implements DebuggerVi
myDisposables.clear();
}
protected void overrideShortcut(final JComponent forComponent, final String actionId, final CustomShortcutSet shortcutSet) {
protected void overrideShortcut(final JComponent forComponent, final String actionId, final ShortcutSet shortcutSet) {
final AnAction action = ActionManager.getInstance().getAction(actionId);
action.registerCustomShortcutSet(shortcutSet, forComponent);
registerDisposable(new Disposable() {
@@ -43,6 +43,7 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider{
add(ScrollPaneFactory.createScrollPane(frameTree), BorderLayout.CENTER);
registerDisposable(DebuggerAction.installEditAction(frameTree, DebuggerActions.EDIT_NODE_SOURCE));
overrideShortcut(frameTree, DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
overrideShortcut(frameTree, DebuggerActions.SET_VALUE, new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)));
new ValueNodeDnD(myTree, parent);
@@ -30,6 +30,7 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionPopupMenu;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.ui.ScrollPaneFactory;
@@ -44,8 +45,8 @@ public abstract class WatchPanel extends DebuggerTreePanel {
public WatchPanel(Project project, DebuggerStateManager stateManager) {
super(project, stateManager);
add(ScrollPaneFactory.createScrollPane(getWatchTree()), BorderLayout.CENTER);
final Disposable disposable = DebuggerAction.installEditAction(getWatchTree(), DebuggerActions.EDIT_NODE_SOURCE);
registerDisposable(disposable);
registerDisposable(DebuggerAction.installEditAction(getWatchTree(), DebuggerActions.EDIT_NODE_SOURCE));
overrideShortcut(getWatchTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
}
protected DebuggerTree createTreeView() {
@@ -39,6 +39,10 @@ public class CommonShortcuts {
public static final ShortcutSet DOUBLE_CLICK_1 = new CustomShortcutSet(new Shortcut[]{new MouseShortcut(MouseEvent.BUTTON1, 0, 2)});
public static ShortcutSet getCopy() {
return new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_COPY));
}
public static ShortcutSet getRerun() {
return new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_RERUN));
}
@@ -51,6 +51,7 @@ public interface XDebuggerActions {
@NonNls String XREMOVE_WATCH = "XDebugger.RemoveWatch";
@NonNls String XEDIT_WATCH = "XDebugger.EditWatch";
@NonNls String COPY_VALUE = "XDebugger.CopyValue";
@NonNls String SET_VALUE = "XDebugger.SetValue";
@NonNls String MUTE_BREAKPOINTS = "XDebugger.MuteBreakpoints";
@@ -59,10 +59,10 @@ public class XDebuggerTreePanel implements DnDSource {
popupMenu.getComponent().show(comp, x, y);
}
};
AnAction setValueAction = actionManager.getAction(XDebuggerActions.SET_VALUE);
setValueAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), myTree);
AnAction jumpToSourceAction = actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE);
jumpToSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myTree);
actionManager.getAction(XDebuggerActions.SET_VALUE).registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), myTree);
actionManager.getAction(XDebuggerActions.COPY_VALUE).registerCustomShortcutSet(CommonShortcuts.getCopy(), myTree);
actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE).registerCustomShortcutSet(CommonShortcuts.getEditSource(), myTree);
myTree.addMouseListener(myPopupHandler);
}