mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
"add to watches" action fixed for java debugger
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user