diff --git a/icons/src/debugger/muteBreakpoints.png b/icons/src/debugger/muteBreakpoints.png new file mode 100644 index 000000000000..b14b43588185 Binary files /dev/null and b/icons/src/debugger/muteBreakpoints.png differ diff --git a/resources/src/idea/ActionManager.xml b/resources/src/idea/ActionManager.xml index ce3a4a63ab10..c9d83945f2f3 100644 --- a/resources/src/idea/ActionManager.xml +++ b/resources/src/idea/ActionManager.xml @@ -688,6 +688,7 @@ + diff --git a/source/com/intellij/debugger/actions/DebuggerActions.java b/source/com/intellij/debugger/actions/DebuggerActions.java index 2d1daeccfea3..755c6622b347 100644 --- a/source/com/intellij/debugger/actions/DebuggerActions.java +++ b/source/com/intellij/debugger/actions/DebuggerActions.java @@ -28,6 +28,7 @@ public interface DebuggerActions { String EDIT_WATCH = "Debugger.EditWatch"; String EDIT_FRAME_SOURCE = "Debugger.EditFrameSource"; String EDIT_NODE_SOURCE = "Debugger.EditNodeSource"; + String MUTE_BREAKPOINTS = "Debugger.MuteBreakpoints"; String TOGGLE_STEP_SUSPEND_POLICY = "Debugger.ToggleStepThreadSuspendPolicy"; String REPRESENTATION_LIST = "Debugger.Representation"; } \ No newline at end of file diff --git a/source/com/intellij/debugger/actions/MuteBreakpointsAction.java b/source/com/intellij/debugger/actions/MuteBreakpointsAction.java new file mode 100644 index 000000000000..8c8c2953bec6 --- /dev/null +++ b/source/com/intellij/debugger/actions/MuteBreakpointsAction.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2000-2004 by JetBrains s.r.o. All Rights Reserved. + * Use is subject to license terms. + */ +package com.intellij.debugger.actions; + +import com.intellij.debugger.engine.DebugProcessImpl; +import com.intellij.debugger.impl.DebuggerContextImpl; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.ToggleAction; + +/** + * @author Eugene Zhuravlev + * Date: Mar 15, 2005 + */ +public class MuteBreakpointsAction extends ToggleAction{ + + public boolean isSelected(AnActionEvent e) { + DebuggerContextImpl context = DebuggerAction.getDebuggerContext(e.getDataContext()); + DebugProcessImpl debugProcess = context.getDebugProcess(); + if(debugProcess != null) { + return debugProcess.areBreakpointsMuted(); + } + return false; + } + + public void setSelected(AnActionEvent e, boolean state) { + DebuggerContextImpl context = DebuggerAction.getDebuggerContext(e.getDataContext()); + final DebugProcessImpl debugProcess = context.getDebugProcess(); + if(debugProcess != null) { + debugProcess.setBreakpointsMuted(state); + } + } + + public void update(final AnActionEvent e) { + super.update(e); + DebuggerContextImpl context = DebuggerAction.getDebuggerContext(e.getDataContext()); + final DebugProcessImpl debugProcess = context.getDebugProcess(); + e.getPresentation().setEnabled(debugProcess != null); + } + +} diff --git a/source/com/intellij/debugger/engine/DebugProcessImpl.java b/source/com/intellij/debugger/engine/DebugProcessImpl.java index 3bc46457c825..accf28864e2c 100644 --- a/source/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/source/com/intellij/debugger/engine/DebugProcessImpl.java @@ -22,6 +22,7 @@ import com.intellij.debugger.settings.ViewsGeneralSettings; import com.intellij.debugger.ui.DebuggerSmoothManager; import com.intellij.debugger.ui.DescriptorHistoryManagerImpl; import com.intellij.debugger.ui.breakpoints.LineBreakpoint; +import com.intellij.debugger.ui.breakpoints.BreakpointManager; import com.intellij.debugger.ui.impl.watch.DescriptorHistoryManager; import com.intellij.debugger.ui.tree.render.ArrayRenderer; import com.intellij.debugger.ui.tree.render.ClassRenderer; @@ -131,6 +132,7 @@ public abstract class DebugProcessImpl implements DebugProcess { private static int LOCAL_START_TIMEOUT = 15000; private final Semaphore myWaitFor = new Semaphore(); + private boolean myBreakpointsMuted = false; protected DebugProcessImpl(Project project) { myProject = project; @@ -1598,5 +1600,38 @@ public abstract class DebugProcessImpl implements DebugProcess { public SuspendContextCommandImpl createPopFrameCommand(DebuggerContextImpl context, StackFrameProxyImpl stackFrame) { return new PopFrameCommand(context, stackFrame); } + + public void setBreakpointsMuted(final boolean muted) { + if (isAttached()) { + getManagerThread().invokeLater(new DebuggerCommandImpl() { + protected void action() throws Exception { + // set the flag before enabling/disabling cause it affects if breakpoints will create requests + synchronized (DebugProcessImpl.this) { + if (myBreakpointsMuted == muted) { + return; + } + myBreakpointsMuted = muted; + } + final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager(); + if (muted) { + breakpointManager.disableBreakpoints(DebugProcessImpl.this); + } + else { + breakpointManager.enableBreakpoints(DebugProcessImpl.this); + } + } + }); + } + else { + synchronized (this) { + myBreakpointsMuted = muted; + } + } + } + + + public synchronized boolean areBreakpointsMuted() { + return myBreakpointsMuted; + } } diff --git a/source/com/intellij/debugger/ui/DebuggerSessionTab.java b/source/com/intellij/debugger/ui/DebuggerSessionTab.java index 260c51dbe169..eab2af0c76b1 100644 --- a/source/com/intellij/debugger/ui/DebuggerSessionTab.java +++ b/source/com/intellij/debugger/ui/DebuggerSessionTab.java @@ -284,6 +284,8 @@ public class DebuggerSessionTab { if (action != null) group.add(action); action = actionManager.getAction(DebuggerActions.VIEW_BREAKPOINTS); if (action != null) group.add(action); + action = actionManager.getAction(DebuggerActions.MUTE_BREAKPOINTS); + if (action != null) group.add(action); action = actionManager.getAction(DebuggerActions.TOGGLE_STEP_SUSPEND_POLICY); if (action != null) group.add(action); diff --git a/source/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java b/source/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java index 9c0cee1f19f8..016273aa3c30 100644 --- a/source/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java +++ b/source/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java @@ -22,12 +22,12 @@ public class AnyExceptionBreakpoint extends ExceptionBreakpoint { return "Any exception"; } - public void createRequest(DebugProcessImpl debuggerProcess) { + public void createRequest(DebugProcessImpl debugProcess) { DebuggerManagerThreadImpl.assertIsManagerThread(); - if (!ENABLED || !debuggerProcess.isAttached() || !debuggerProcess.getRequestsManager().findRequests(this).isEmpty()) { + if (!ENABLED || !debugProcess.isAttached() || debugProcess.areBreakpointsMuted() || !debugProcess.getRequestsManager().findRequests(this).isEmpty()) { return; } - super.processClassPrepare(debuggerProcess, null); + super.processClassPrepare(debugProcess, null); } public void processClassPrepare(DebugProcess debugProcess, ReferenceType refType) { diff --git a/source/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java b/source/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java index c1d6c087429c..116f7786bb1f 100644 --- a/source/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java +++ b/source/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java @@ -222,7 +222,7 @@ public abstract class BreakpointWithHighlighter extends Breakpoint { public void createRequest(DebugProcessImpl debugProcess) { DebuggerManagerThreadImpl.assertIsManagerThread(); // check is this breakpoint is enabled, vm reference is valid and there're no requests created yet - if (!ENABLED || !debugProcess.isAttached() || !debugProcess.getRequestsManager().findRequests(this).isEmpty()) { + if (!ENABLED || !debugProcess.isAttached() || debugProcess.areBreakpointsMuted() || !debugProcess.getRequestsManager().findRequests(this).isEmpty()) { return; } diff --git a/source/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java b/source/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java index b0757dbf62fc..66bf56bae848 100644 --- a/source/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java +++ b/source/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java @@ -78,7 +78,7 @@ public class ExceptionBreakpoint extends Breakpoint { public void createRequest(DebugProcessImpl debugProcess) { DebuggerManagerThreadImpl.assertIsManagerThread(); - if (!ENABLED || !debugProcess.isAttached() || !debugProcess.getRequestsManager().findRequests(this).isEmpty()) { + if (!ENABLED || !debugProcess.isAttached() || debugProcess.areBreakpointsMuted() || !debugProcess.getRequestsManager().findRequests(this).isEmpty()) { return; }