From 9f93422fb6f05d7be7ffc039d9e9545041558947 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Tue, 15 Mar 2005 19:21:10 +0300 Subject: [PATCH] (no message) --- icons/src/debugger/muteBreakpoints.png | Bin 0 -> 1322 bytes resources/src/idea/ActionManager.xml | 1 + .../debugger/actions/DebuggerActions.java | 1 + .../actions/MuteBreakpointsAction.java | 42 ++++++++++++++++++ .../debugger/engine/DebugProcessImpl.java | 35 +++++++++++++++ .../debugger/ui/DebuggerSessionTab.java | 2 + .../breakpoints/AnyExceptionBreakpoint.java | 6 +-- .../BreakpointWithHighlighter.java | 2 +- .../ui/breakpoints/ExceptionBreakpoint.java | 2 +- 9 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 icons/src/debugger/muteBreakpoints.png create mode 100644 source/com/intellij/debugger/actions/MuteBreakpointsAction.java diff --git a/icons/src/debugger/muteBreakpoints.png b/icons/src/debugger/muteBreakpoints.png new file mode 100644 index 0000000000000000000000000000000000000000..b14b43588185ec3af7a9c9dab67aea7e8b238790 GIT binary patch literal 1322 zcmV+_1=aeAP)OBDwexCO`PhMp>bMqks2OBGcwXQOl=HX;#U}I%rc=Yle!@T+P84j(U z%?J=cEa(QDx^`axNc978!t=Ku!G>HtvV-Bz?_UfndrpDXaPtc>2umq2{QLKp;qi?N zU@?FIVnH*c07%uZJ9u7TR%0H+%FVkN{{8*S@a@wFpz#0S?_NA%gQ?}_6Zp@@!F2%W zBLxs2Ab=P^Ud!!YF3>!G%lE`1+}9YAvUFc+^t1B?w2KyX2z#sDBb z55ypY65tw+GBo@@!w~TQ1cSlIrVCUotfT;rrAV&1S1{zZE>-*RK zuRA{)GO#i{U|?jJ&%nfI!0?CR0>eMf0EWN+0~vn*o6qp?Pa}il`w1|800G2^E!Oyi zL>*pjdAps1`~QoV^BDx5Tw)O5`~s3p4%y0}LNv@bLn@!6OmD$j)icaB&O7dx{1O4DTL& z`1S1hj^983z61y$a29#>>eXsNK|zpb!X*A)EVq-qBgyceo8kZGPYjIjo`EBa;mvbk zU;_>K{f~h`0q8Fmo|5yuSV6-@TgxzrTIk$d&%A zfeWf1Ab{X5Vq;@76cQ5R;^pOK;Njt6xS_o;^_R!4?N2{Q{doQ8;QVU0tg_ui-0i)DqE)f`SS;yn}Oa0d6z**!|~_ocj7mI z7Cr8I8tMWxx46(E3^kU4dAbyI=KVKFckp8;dz#mA2y9|2SR`8RLg6f-k3?`2|Q g!d@-|0YHEO0CYbjXZKMPpa1{>07*qoM6N<$f;&KN;{X5v literal 0 HcmV?d00001 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; }