From e23de95da07175aa9ae76948afc21b5cf1701e4e Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 24 Mar 2010 16:11:50 +0300 Subject: [PATCH] "add to watches" action fixed for java debugger --- .../actions/AddToWatchActionHandler.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java index e1df811cee25..c4e82a0cb116 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java @@ -32,10 +32,8 @@ import com.intellij.debugger.ui.impl.MainWatchPanel; import com.intellij.debugger.ui.impl.VariablesPanel; import com.intellij.debugger.ui.impl.WatchDebuggerTree; import com.intellij.debugger.ui.impl.watch.*; -import com.intellij.ide.DataManager; import com.intellij.idea.ActionsBundle; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; @@ -47,15 +45,10 @@ import org.jetbrains.annotations.NotNull; public class AddToWatchActionHandler extends DebuggerActionHandler { @Override public boolean isEnabled(@NotNull Project project, AnActionEvent event) { - DataContext context = DataManager.getInstance().getDataContext(); - if (context == null) { - return false; - } - - DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(context); + DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(event.getDataContext()); boolean enabled = false; if (selectedNodes != null && selectedNodes.length > 0) { - if (DebuggerAction.getPanel(context) instanceof VariablesPanel) { + if (DebuggerAction.getPanel(event.getDataContext()) instanceof VariablesPanel) { enabled = true; for (DebuggerTreeNodeImpl node : selectedNodes) { NodeDescriptorImpl descriptor = node.getDescriptor(); @@ -75,10 +68,7 @@ public class AddToWatchActionHandler extends DebuggerActionHandler { @Override public void perform(@NotNull Project project, AnActionEvent event) { - DataContext context = DataManager.getInstance().getDataContext(); - if (context == null) return; - - final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(context); + final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(event.getDataContext()); if(debuggerContext == null) return; @@ -92,7 +82,7 @@ public class AddToWatchActionHandler extends DebuggerActionHandler { return; } - final DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(context); + final DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(event.getDataContext()); if(selectedNodes != null && selectedNodes.length > 0) { addFromNodes(debuggerContext, watchPanel, selectedNodes);