Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexander Marchuk
2014-11-18 14:09:02 +03:00
3 changed files with 49 additions and 0 deletions
@@ -40,6 +40,7 @@ import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
import com.intellij.xdebugger.impl.frame.actions.XDuplicateWatchAction;
import com.intellij.xdebugger.impl.ui.XDebugSessionData;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
@@ -88,6 +89,8 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
CustomShortcutSet f2Shortcut = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
actionManager.getAction(XDebuggerActions.XEDIT_WATCH).registerCustomShortcutSet(f2Shortcut, tree);
new XDuplicateWatchAction().registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_EDITOR_DUPLICATE).getShortcutSet(), tree);
DnDManager.getInstance().registerTarget(this, tree);
myRootNode = new WatchesRootNode(tree, this, session.getSessionData().getWatchExpressions());
tree.setRoot(myRootNode, false);
@@ -0,0 +1,45 @@
/*
* Copyright 2000-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.xdebugger.impl.frame.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.xdebugger.impl.frame.XWatchesView;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
import com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode;
import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author 1
*/
public class XDuplicateWatchAction extends XWatchesTreeActionBase {
protected boolean isEnabled(@NotNull final AnActionEvent e, @NotNull XDebuggerTree tree) {
return !getSelectedNodes(tree, WatchNode.class).isEmpty();
}
@Override
protected void perform(@NotNull AnActionEvent e, @NotNull XDebuggerTree tree, @NotNull XWatchesView watchesView) {
XDebuggerTreeNode root = tree.getRoot();
List<? extends WatchNode> nodes = getSelectedNodes(tree, WatchNode.class);
for (WatchNode node : nodes) {
int index = root.getIndex(node);
watchesView.addWatchExpression(node.getExpression(), index + 1, true);
}
}
}
@@ -30,6 +30,7 @@ import java.util.List;
* @author nik
*/
public abstract class XWatchesTreeActionBase extends AnAction {
@NotNull
protected static <T extends TreeNode> List<? extends T> getSelectedNodes(final @NotNull XDebuggerTree tree, Class<T> nodeClass) {
List<T> list = new ArrayList<T>();
TreePath[] selectionPaths = tree.getSelectionPaths();