diff options
Diffstat (limited to 'java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java')
-rw-r--r-- | java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java | 107 |
1 files changed, 54 insertions, 53 deletions
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java index 60077d06c5bf..166ec95e7aeb 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java @@ -16,7 +16,6 @@ package com.intellij.debugger.engine; import com.intellij.debugger.DebuggerBundle; -import com.intellij.debugger.DebuggerInvocationUtil; import com.intellij.debugger.actions.DebuggerActions; import com.intellij.debugger.engine.evaluation.EvaluationContext; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; @@ -35,12 +34,11 @@ import com.intellij.debugger.ui.tree.NodeDescriptor; import com.intellij.debugger.ui.tree.render.DescriptorLabelListener; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.ui.ExecutionConsole; +import com.intellij.execution.ui.ExecutionConsoleEx; import com.intellij.execution.ui.RunnerLayoutUi; import com.intellij.execution.ui.layout.PlaceInGrid; import com.intellij.icons.AllIcons; -import com.intellij.idea.ActionsBundle; import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -98,28 +96,33 @@ public class JavaDebugProcess extends XDebugProcess { myJavaSession.getContextManager().addListener(new DebuggerContextListener() { @Override public void changeEvent(final DebuggerContextImpl newContext, int event) { - if (event == DebuggerSession.EVENT_PAUSE && myJavaSession.isPaused()) { - process.getManagerThread().schedule(new DebuggerContextCommandImpl(newContext) { - @Override - public void threadAction() { - SuspendContextImpl context = newContext.getSuspendContext(); - if (context != null) { - context.initExecutionStacks(newContext.getThreadProxy()); - - List<Pair<Breakpoint, Event>> descriptors = - DebuggerUtilsEx.getEventDescriptors(context); - if (!descriptors.isEmpty()) { - Breakpoint breakpoint = descriptors.get(0).getFirst(); - XBreakpoint xBreakpoint = breakpoint.getXBreakpoint(); - if (xBreakpoint != null) { - getSession().breakpointReached(xBreakpoint, null, context); - return; + if (event == DebuggerSession.EVENT_PAUSE + || event == DebuggerSession.EVENT_CONTEXT + || event == DebuggerSession.EVENT_REFRESH + && myJavaSession.isPaused()) { + if (getSession().getSuspendContext() != newContext.getSuspendContext()) { + process.getManagerThread().schedule(new DebuggerContextCommandImpl(newContext) { + @Override + public void threadAction() { + SuspendContextImpl context = newContext.getSuspendContext(); + if (context != null) { + context.initExecutionStacks(newContext.getThreadProxy()); + + List<Pair<Breakpoint, Event>> descriptors = + DebuggerUtilsEx.getEventDescriptors(context); + if (!descriptors.isEmpty()) { + Breakpoint breakpoint = descriptors.get(0).getFirst(); + XBreakpoint xBreakpoint = breakpoint.getXBreakpoint(); + if (xBreakpoint != null) { + getSession().breakpointReached(xBreakpoint, null, context); + return; + } } + getSession().positionReached(context); } - getSession().positionReached(context); } - } - }); + }); + } } } }); @@ -137,6 +140,11 @@ public class JavaDebugProcess extends XDebugProcess { public DebuggerTreeNodeImpl createMessageNode(MessageDescriptor descriptor) { return new DebuggerTreeNodeImpl(null, descriptor); } + + @Override + public DebuggerTreeNodeImpl createMessageNode(String message) { + return new DebuggerTreeNodeImpl(null, new MessageDescriptor(message)); + } }; session.addSessionListener(new XDebugSessionAdapter() { @Override @@ -160,18 +168,6 @@ public class JavaDebugProcess extends XDebugProcess { DebuggerContextUtil.setStackFrame(javaSession.getContextManager(), ((JavaStackFrame)frame).getStackFrameProxy()); } } - - @Override - public void sessionStopped() { - if (DebuggerSettings.getInstance().UNMUTE_ON_STOP) { - ApplicationManager.getApplication().runReadAction(new Runnable() { - @Override - public void run() { - session.setBreakpointMuted(false); - } - }); - } - } }); } @@ -286,6 +282,20 @@ public class JavaDebugProcess extends XDebugProcess { } }, threadsContent); } + + @NotNull + @Override + public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) { + Content content = null; + if (console instanceof ExecutionConsoleEx) { + ((ExecutionConsoleEx)console).buildUi(ui); + content = ui.findContent(DebuggerContentInfo.CONSOLE_CONTENT); + } + if (content == null) { + content = super.registerConsoleContent(ui, console); + } + return content; + } }; } @@ -297,25 +307,16 @@ public class JavaDebugProcess extends XDebugProcess { leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner); leftToolbar.add(Separator.getInstance(), beforeRunner); - final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", true) { - @Override - public void update(AnActionEvent e) { - e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text")); - e.getPresentation().setIcon(AllIcons.General.SecondaryGroup); + for (AnAction action : leftToolbar.getChildren(null)) { + //TODO: maybe introduce API for extra settings? + if (action instanceof DefaultActionGroup && "DebuggerSettings".equals(action.getTemplatePresentation().getText())) { + DefaultActionGroup settings = (DefaultActionGroup)action; + addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP); + settings.addAction(new AutoVarsSwitchAction(), Constraints.FIRST); + settings.addAction(new WatchLastMethodReturnValueAction(), Constraints.FIRST); + break; } - - @Override - public boolean isDumbAware() { - return true; - } - }; - settings.add(new WatchLastMethodReturnValueAction()); - settings.add(new AutoVarsSwitchAction()); - settings.add(new UnmuteOnStopAction()); - settings.addSeparator(); - addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP); - - leftToolbar.add(settings, new Constraints(Anchor.AFTER, "Runner.Layout")); + } } private static class AutoVarsSwitchAction extends ToggleAction { @@ -410,7 +411,7 @@ public class JavaDebugProcess extends XDebugProcess { private static void addActionToGroup(final DefaultActionGroup group, final String actionId) { AnAction action = ActionManager.getInstance().getAction(actionId); - if (action != null) group.add(action); + if (action != null) group.addAction(action, Constraints.FIRST); } public NodeManagerImpl getNodeManager() { |