mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
IDEA-311960 Old reset frame icon in the context menu
GitOrigin-RevId: 99a5b7c8b3c22bcc06e74d9e00f1b2c834f15bba
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b5fa2c93e8
commit
04ed8dfddf
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.JavaDebuggerBundle;
|
||||
@@ -28,7 +28,7 @@ public class AddSteppingFilterAction extends DebuggerAction {
|
||||
if (process == null) {
|
||||
return;
|
||||
}
|
||||
final StackFrameProxyImpl proxy = PopFrameAction.getStackFrameProxy(e);
|
||||
StackFrameProxyImpl proxy = getStackFrameProxy(e);
|
||||
process.getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() {
|
||||
@@ -51,7 +51,7 @@ public class AddSteppingFilterAction extends DebuggerAction {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabledAndVisible(PopFrameAction.getStackFrameProxy(e) != null);
|
||||
e.getPresentation().setEnabledAndVisible(getStackFrameProxy(e) != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,10 +9,14 @@ package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.JavaDebugProcess;
|
||||
import com.intellij.debugger.engine.JavaStackFrame;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.ui.impl.DebuggerTreePanel;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
@@ -23,6 +27,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.DoubleClickListener;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -132,4 +137,56 @@ public abstract class DebuggerAction extends AnAction {
|
||||
XDebugSession session = DebuggerUIUtil.getSession(e);
|
||||
return session != null && session.getDebugProcess() instanceof JavaDebugProcess;
|
||||
}
|
||||
|
||||
static JavaStackFrame getStackFrame(AnActionEvent e) {
|
||||
StackFrameDescriptorImpl descriptor = getSelectedStackFrameDescriptor(e);
|
||||
if (descriptor != null) {
|
||||
return new JavaStackFrame(descriptor, false);
|
||||
}
|
||||
return getSelectedStackFrame(e);
|
||||
}
|
||||
|
||||
static StackFrameProxyImpl getStackFrameProxy(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
|
||||
if (node != null) {
|
||||
NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
if (descriptor instanceof StackFrameDescriptorImpl) {
|
||||
return ((StackFrameDescriptorImpl)descriptor).getFrameProxy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
JavaStackFrame stackFrame = getSelectedStackFrame(e);
|
||||
if (stackFrame != null) {
|
||||
return stackFrame.getStackFrameProxy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static StackFrameDescriptorImpl getSelectedStackFrameDescriptor(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
|
||||
if (selectedNode != null) {
|
||||
NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
|
||||
if (descriptor instanceof StackFrameDescriptorImpl) {
|
||||
return (StackFrameDescriptorImpl)descriptor;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JavaStackFrame getSelectedStackFrame(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project != null) {
|
||||
XDebugSession session = DebuggerUIUtil.getSession(e);
|
||||
if (session != null) {
|
||||
XStackFrame frame = session.getCurrentStackFrame();
|
||||
if (frame instanceof JavaStackFrame) {
|
||||
return ((JavaStackFrame)frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -28,6 +27,7 @@ import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
import com.intellij.xdebugger.frame.XValue;
|
||||
import com.intellij.xdebugger.impl.evaluate.XExpressionDialog;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,7 +39,7 @@ public class ForceEarlyReturnAction extends DebuggerAction {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = e.getProject();
|
||||
final JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
|
||||
final JavaStackFrame stackFrame = getStackFrame(e);
|
||||
if (stackFrame == null || project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -170,17 +170,12 @@ public class ForceEarlyReturnAction extends DebuggerAction {
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
boolean enable = false;
|
||||
|
||||
JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
|
||||
JavaStackFrame stackFrame = getStackFrame(e);
|
||||
if (stackFrame != null && stackFrame.getDescriptor().getUiIndex() == 0) {
|
||||
enable = stackFrame.getStackFrameProxy().getVirtualMachine().canForceEarlyReturn();
|
||||
}
|
||||
|
||||
if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
|
||||
e.getPresentation().setEnabled(enable);
|
||||
}
|
||||
else {
|
||||
e.getPresentation().setVisible(enable);
|
||||
}
|
||||
DebuggerUIUtil.setActionEnabled(e, enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -23,7 +22,6 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.UIBundle;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.evaluation.EvaluationMode;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
@@ -42,8 +40,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.debugger.actions.PopFrameAction.ACTION_NAME;
|
||||
|
||||
public class JvmDropFrameActionHandler implements XDropFrameHandler {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(JvmDropFrameActionHandler.class);
|
||||
@@ -69,7 +65,7 @@ public class JvmDropFrameActionHandler implements XDropFrameHandler {
|
||||
try {
|
||||
myDebugSession.setSteppingThrough(stackFrame.getStackFrameProxy().threadProxy());
|
||||
if (evaluateFinallyBlocks(project,
|
||||
UIUtil.removeMnemonic(ActionsBundle.actionText(ACTION_NAME)),
|
||||
XDebuggerBundle.message("xdebugger.reset.frame.title"),
|
||||
stackFrame,
|
||||
new XDebuggerEvaluator.XEvaluationCallback() {
|
||||
@Override
|
||||
@@ -80,7 +76,7 @@ public class JvmDropFrameActionHandler implements XDropFrameHandler {
|
||||
@Override
|
||||
public void errorOccurred(@NotNull final String errorMessage) {
|
||||
showError(project, JavaDebuggerBundle.message("error.executing.finally", errorMessage),
|
||||
UIUtil.removeMnemonic(ActionsBundle.actionText(ACTION_NAME)));
|
||||
XDebuggerBundle.message("xdebugger.reset.frame.title"));
|
||||
}
|
||||
})) {
|
||||
return;
|
||||
@@ -89,7 +85,7 @@ public class JvmDropFrameActionHandler implements XDropFrameHandler {
|
||||
}
|
||||
catch (NativeMethodException e2) {
|
||||
Messages.showMessageDialog(project, JavaDebuggerBundle.message("error.native.method.exception"),
|
||||
UIUtil.removeMnemonic(ActionsBundle.actionText(ACTION_NAME)), Messages.getErrorIcon());
|
||||
XDebuggerBundle.message("xdebugger.reset.frame.title"), Messages.getErrorIcon());
|
||||
}
|
||||
catch (InvalidStackFrameException | VMDisconnectedException ignored) {
|
||||
}
|
||||
@@ -187,7 +183,7 @@ public class JvmDropFrameActionHandler implements XDropFrameHandler {
|
||||
}
|
||||
else {
|
||||
Messages.showMessageDialog(project, XDebuggerBundle.message("xdebugger.evaluate.stack.frame.has.not.evaluator"),
|
||||
UIUtil.removeMnemonic(ActionsBundle.actionText(ACTION_NAME)),
|
||||
XDebuggerBundle.message("xdebugger.reset.frame.title"),
|
||||
Messages.getErrorIcon());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
/*
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.engine.JavaStackFrame;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.frame.XDropFrameHandler;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class PopFrameAction extends DebuggerAction implements DumbAware {
|
||||
@NonNls public static final String ACTION_NAME = "Debugger.PopFrame";
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final JavaStackFrame stackFrame = getStackFrame(e);
|
||||
if (stackFrame == null || stackFrame.getStackFrameProxy().isBottom()) {
|
||||
return;
|
||||
}
|
||||
final XDropFrameHandler handler = getDropFrameHandler(e);
|
||||
final JavaStackFrame frame = getSelectedStackFrame(e);
|
||||
if (frame != null && handler != null) {
|
||||
handler.drop(frame);
|
||||
}
|
||||
}
|
||||
|
||||
static JavaStackFrame getStackFrame(AnActionEvent e) {
|
||||
StackFrameDescriptorImpl descriptor = getSelectedStackFrameDescriptor(e);
|
||||
if (descriptor != null) {
|
||||
return new JavaStackFrame(descriptor, false);
|
||||
}
|
||||
return getSelectedStackFrame(e);
|
||||
}
|
||||
|
||||
static StackFrameProxyImpl getStackFrameProxy(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
|
||||
if (node != null) {
|
||||
NodeDescriptorImpl descriptor = node.getDescriptor();
|
||||
if (descriptor instanceof StackFrameDescriptorImpl) {
|
||||
return ((StackFrameDescriptorImpl)descriptor).getFrameProxy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
JavaStackFrame stackFrame = getSelectedStackFrame(e);
|
||||
if (stackFrame != null) {
|
||||
return stackFrame.getStackFrameProxy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static StackFrameDescriptorImpl getSelectedStackFrameDescriptor(AnActionEvent e) {
|
||||
DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
|
||||
if (selectedNode != null) {
|
||||
NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
|
||||
if (descriptor instanceof StackFrameDescriptorImpl) {
|
||||
return (StackFrameDescriptorImpl)descriptor;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JavaStackFrame getSelectedStackFrame(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project != null) {
|
||||
XDebugSession session = DebuggerUIUtil.getSession(e);
|
||||
if (session != null) {
|
||||
XStackFrame frame = session.getCurrentStackFrame();
|
||||
if (frame instanceof JavaStackFrame) {
|
||||
return ((JavaStackFrame)frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
boolean enable = false;
|
||||
|
||||
var xStackFrame = getSelectedStackFrame(e);
|
||||
var xDropFrameHandler = getDropFrameHandler(e);
|
||||
if (xStackFrame != null && xDropFrameHandler != null) {
|
||||
enable = xDropFrameHandler.canDrop(xStackFrame);
|
||||
}
|
||||
|
||||
if ((ActionPlaces.isMainMenuOrActionSearch(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace()))
|
||||
&& xDropFrameHandler != null) {
|
||||
e.getPresentation().setEnabled(enable);
|
||||
}
|
||||
else {
|
||||
e.getPresentation().setVisible(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ActionUpdateThread getActionUpdateThread() {
|
||||
return ActionUpdateThread.BGT;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static XDropFrameHandler getDropFrameHandler(@NotNull AnActionEvent e) {
|
||||
var xSession = DebuggerUIUtil.getSession(e);
|
||||
return Optional.ofNullable(xSession)
|
||||
.map(XDebugSession::getDebugProcess)
|
||||
.map(XDebugProcess::getDropFrameHandler)
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -26,6 +25,7 @@ import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
import com.intellij.xdebugger.frame.XValue;
|
||||
import com.intellij.xdebugger.impl.evaluate.XExpressionDialog;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,7 +37,7 @@ public class ThrowExceptionAction extends DebuggerAction {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = e.getProject();
|
||||
final JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
|
||||
final JavaStackFrame stackFrame = getStackFrame(e);
|
||||
if (stackFrame == null || project == null) {
|
||||
return;
|
||||
}
|
||||
@@ -123,15 +123,8 @@ public class ThrowExceptionAction extends DebuggerAction {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
|
||||
boolean enable = stackFrame != null && stackFrame.getDescriptor().getUiIndex() == 0;
|
||||
|
||||
if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
|
||||
e.getPresentation().setEnabled(enable);
|
||||
}
|
||||
else {
|
||||
e.getPresentation().setVisible(enable);
|
||||
}
|
||||
JavaStackFrame stackFrame = getStackFrame(e);
|
||||
DebuggerUIUtil.setActionEnabled(e, stackFrame != null && stackFrame.getDescriptor().getUiIndex() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.intellij.ProjectTopics;
|
||||
import com.intellij.ReviseWhenPortedToJDK;
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.actions.DebuggerAction;
|
||||
import com.intellij.debugger.actions.PopFrameAction;
|
||||
import com.intellij.debugger.engine.evaluation.*;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
@@ -64,6 +63,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.lang.JavaVersion;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.XDebuggerManagerImpl;
|
||||
@@ -2004,7 +2004,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
|
||||
if (myStackFrame.isBottom()) {
|
||||
DebuggerInvocationUtil.swingInvokeLater(myProject, () -> Messages.showMessageDialog(myProject, JavaDebuggerBundle
|
||||
.message("error.pop.bottom.stackframe"), ActionsBundle.actionText(PopFrameAction.ACTION_NAME), Messages.getErrorIcon()));
|
||||
.message("error.pop.bottom.stackframe"), XDebuggerBundle.message("xdebugger.reset.frame.title"), Messages.getErrorIcon()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2013,10 +2013,9 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|
||||
getSuspendManager().popFrame(suspendContext);
|
||||
}
|
||||
catch (final EvaluateException e) {
|
||||
DebuggerInvocationUtil.swingInvokeLater(myProject,
|
||||
() -> Messages.showMessageDialog(myProject, JavaDebuggerBundle
|
||||
.message("error.pop.stackframe", e.getLocalizedMessage()), ActionsBundle.actionText(
|
||||
PopFrameAction.ACTION_NAME), Messages.getErrorIcon()));
|
||||
DebuggerInvocationUtil.swingInvokeLater(myProject, () ->
|
||||
Messages.showMessageDialog(myProject, JavaDebuggerBundle.message("error.pop.stackframe", e.getLocalizedMessage()),
|
||||
XDebuggerBundle.message("xdebugger.reset.frame.title"), Messages.getErrorIcon()));
|
||||
LOG.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,8 +904,8 @@ action.RunToCursor.text=Run to _Cursor
|
||||
action.RunToCursor.description=Run to the line where the caret is
|
||||
action.ForceRunToCursor.text=Force Run to Cur_sor
|
||||
action.ForceRunToCursor.description=Run to the line where the caret is, ignoring any breakpoints
|
||||
action.Debugger.PopFrame.text=Reset _Frame
|
||||
action.Debugger.PopFrame.description=Moves execution point back to the method call dropping current method frames from the stack
|
||||
action.ResetFrame.text=Reset _Frame
|
||||
action.ResetFrame.description=Moves execution point back to the method call dropping current method frames from the stack
|
||||
action.Debugger.ForceEarlyReturn.text=Force Return
|
||||
action.Debugger.ForceEarlyReturn.description=Force a method to return before it reaches a return statement
|
||||
action.Debugger.ThrowException.text=Throw Exception
|
||||
|
||||
@@ -1087,6 +1087,7 @@
|
||||
<action id="StepOut" class="com.intellij.xdebugger.impl.actions.StepOutAction" icon="AllIcons.Actions.StepOut"/>
|
||||
<action id="RunToCursor" class="com.intellij.xdebugger.impl.actions.RunToCursorAction" icon="AllIcons.Actions.RunToCursor"/>
|
||||
<action id="ForceRunToCursor" class="com.intellij.xdebugger.impl.actions.ForceRunToCursorAction" icon="PlatformDebuggerImplIcons.Actions.Force_run_to_cursor"/>
|
||||
<action id="ResetFrame" class="com.intellij.xdebugger.impl.actions.ResetFrameAction" icon="AllIcons.Actions.InlineDropFrame"/>
|
||||
<action id="Pause" class="com.intellij.xdebugger.impl.actions.PauseAction" icon="AllIcons.Actions.Pause"/>
|
||||
<action id="Resume" class="com.intellij.xdebugger.impl.actions.ResumeAction" icon="AllIcons.Actions.Resume"/>
|
||||
<separator/>
|
||||
@@ -1200,6 +1201,7 @@
|
||||
<reference ref="ShowExecutionPoint"/>
|
||||
<separator/>
|
||||
<reference ref="EvaluateExpression" />
|
||||
<reference ref="ResetFrame" />
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.ToolWindow.LeftToolbar">
|
||||
@@ -1235,6 +1237,7 @@
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.Frames.Tree.Popup">
|
||||
<reference ref="ResetFrame" />
|
||||
<action id="Debugger.CopyStack" class="com.intellij.xdebugger.impl.frame.XDebuggerFramesList$CopyStackAction" icon="AllIcons.Actions.Copy"/>
|
||||
</group>
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ button.text.expression.mode=Expression &Mode
|
||||
xdebugger.label.text.code.fragment=Code fragment:
|
||||
xdebugger.evaluate.result=result
|
||||
xdebugger.evaluate.stack.frame.has.not.evaluator=Cannot evaluate, current stack frame doesn't support evaluation
|
||||
xdebugger.reset.frame.title=Reset Frame
|
||||
|
||||
xdebugger.popup.value.tree.set.root.action.tooltip=Set As Root
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xdebugger.impl.actions
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.xdebugger.frame.XDropFrameHandler
|
||||
import com.intellij.xdebugger.frame.XStackFrame
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil
|
||||
|
||||
class ResetFrameAction : DumbAwareAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
withHandler(e, true) { handler, stackFrame -> handler.drop(stackFrame) }
|
||||
}
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
DebuggerUIUtil.setActionEnabled(e, withHandler(e, false) { handler, stackFrame -> handler.canDrop(stackFrame) })
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
|
||||
private fun <T> withHandler(e: AnActionEvent, default: T, action: (XDropFrameHandler, XStackFrame) -> T): T {
|
||||
val session = DebuggerUIUtil.getSession(e)
|
||||
if (session != null) {
|
||||
val dropFrameHandler = session.debugProcess.dropFrameHandler
|
||||
if (dropFrameHandler != null) {
|
||||
val currentFrame = session.currentStackFrame
|
||||
if (currentFrame != null) {
|
||||
return action(dropFrameHandler, currentFrame)
|
||||
}
|
||||
}
|
||||
}
|
||||
return default
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xdebugger.impl.ui;
|
||||
|
||||
import com.intellij.codeInsight.hint.HintUtil;
|
||||
import com.intellij.ide.nls.NlsMessages;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -570,4 +571,14 @@ public final class DebuggerUIUtil {
|
||||
editor.getContentComponent().repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setActionEnabled(AnActionEvent e, boolean enable) {
|
||||
String place = e.getPlace();
|
||||
if (ActionPlaces.isMainMenuOrActionSearch(place) || ActionPlaces.DEBUGGER_TOOLBAR.equals(place)) {
|
||||
e.getPresentation().setEnabled(enable);
|
||||
}
|
||||
else {
|
||||
e.getPresentation().setVisible(enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -391,13 +391,6 @@
|
||||
<add-to-group group-id="RunToolbarAdditionalProcessActions"/>
|
||||
</action>
|
||||
|
||||
<action id="Debugger.PopFrame" class="com.intellij.debugger.actions.PopFrameAction" icon="AllIcons.Actions.PopFrame">
|
||||
<add-to-group group-id="DebuggingActionsGroup" anchor="after" relative-to-action="ForceRunToCursor"/>
|
||||
<add-to-group group-id="XDebugger.Frames.Tree.Popup" anchor="first"/>
|
||||
<!--<add-to-group group-id="XDebugger.ToolWindow.TopToolbar" anchor="before" relative-to-action="RunToCursor"/>-->
|
||||
<add-to-group group-id="XDebugger.ToolWindow.TopToolbar3.Extra"/>
|
||||
</action>
|
||||
|
||||
<group id="ToggleBreakpointAction">
|
||||
<action id="ToggleMethodBreakpoint" class="com.intellij.debugger.actions.ToggleMethodBreakpointAction">
|
||||
<override-text place="MainMenu"/>
|
||||
@@ -471,7 +464,6 @@
|
||||
<add-to-group group-id="XDebugger.Frames.Tree.Popup" anchor="last"/>
|
||||
</action>
|
||||
<action id="Debugger.EditFrameSource" class="com.intellij.debugger.actions.EditFrameSourceAction" use-shortcut-of="EditSource"/>
|
||||
<reference ref="Debugger.PopFrame"/>
|
||||
<group id="Debugger.ViewAsGroup" class="com.intellij.debugger.actions.ViewAsGroup">
|
||||
<add-to-group group-id="XDebugger.ValueGroup" anchor="last"/>
|
||||
</group>
|
||||
@@ -492,13 +484,13 @@
|
||||
<action id="Debugger.InterruptThread" class="com.intellij.debugger.actions.InterruptThreadAction"/>
|
||||
|
||||
<action id="Debugger.ForceEarlyReturn" class="com.intellij.debugger.actions.ForceEarlyReturnAction">
|
||||
<add-to-group group-id="XDebugger.Frames.Tree.Popup" anchor="after" relative-to-action="Debugger.PopFrame"/>
|
||||
<add-to-group group-id="DebuggingActionsGroup" anchor="after" relative-to-action="Debugger.PopFrame"/>
|
||||
<add-to-group group-id="XDebugger.Frames.Tree.Popup" anchor="after" relative-to-action="ResetFrame"/>
|
||||
<add-to-group group-id="DebuggingActionsGroup" anchor="after" relative-to-action="ResetFrame"/>
|
||||
<add-to-group group-id="XDebugger.ToolWindow.TopToolbar3.Extra"/>
|
||||
</action>
|
||||
|
||||
<action id="Debugger.ThrowException" class="com.intellij.debugger.actions.ThrowExceptionAction">
|
||||
<add-to-group group-id="XDebugger.Frames.Tree.Popup" anchor="after" relative-to-action="Debugger.PopFrame"/>
|
||||
<add-to-group group-id="XDebugger.Frames.Tree.Popup" anchor="after" relative-to-action="ResetFrame"/>
|
||||
<add-to-group group-id="DebuggingActionsGroup" anchor="after" relative-to-action="Debugger.ForceEarlyReturn"/>
|
||||
<add-to-group group-id="XDebugger.ToolWindow.TopToolbar3.Extra"/>
|
||||
</action>
|
||||
@@ -616,7 +608,7 @@
|
||||
<reference ref="Debugger.ResumeThread"/>
|
||||
<reference ref="Debugger.FreezeThread"/>
|
||||
<reference ref="Debugger.InterruptThread"/>
|
||||
<reference ref="Debugger.PopFrame"/>
|
||||
<reference ref="ResetFrame"/>
|
||||
<separator/>
|
||||
<reference ref="ExportThreads"/>
|
||||
<reference ref="Debugger.AddSteppingFilter"/>
|
||||
|
||||
Reference in New Issue
Block a user