From df29f919007c7dc62cd1d377fe18d85f0f019f9a Mon Sep 17 00:00:00 2001 From: stefanbjarni Date: Wed, 3 Aug 2005 22:22:52 +0000 Subject: [PATCH] =?utf8?q?Patch=20from=20Anders=20Betn=EF=BF=BD-=20enable=20changing=20breakpoints=20while=20debugging.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../internal/debug/core/model/PHPDebugTarget.java | 32 ++++++++++++++++--- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java index c86bbbe..887cee3 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugTarget.java @@ -16,6 +16,7 @@ import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IMarkerDelta; +import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -223,11 +224,32 @@ public class PHPDebugTarget implements IPHPDebugTarget, ILaunchListener, } public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta arg1) { - // is called e.g. after a line has been inserted before a breakpoint - // but then the debugger is out of sync with the file anyway, so - // debugging - // should be stopped here. - } + // This method is called whenever a source file has changed in which + // case + // we terminate since the source will be out of sync with the debugger + // The method will also be called when the user enables/disables + // breakpoints + // in this case we add or remove the breakpoint + try { + // Check if breakpoint state changed from disabled to enabled + if (breakpoint.isEnabled() + && !arg1.getAttribute("org.eclipse.debug.core.enabled", + false)) { + this.getPHPDBGProxy().addBreakpoint(breakpoint); + // Check if breakpoint state changed from enabled to disabled + } else if (!breakpoint.isEnabled() + && arg1 + .getAttribute("org.eclipse.debug.core.enabled", + true)) { + this.getPHPDBGProxy().removeBreakpoint(breakpoint); + } else { + // All other cases will terminate the debugger + terminate(); + } + } catch (CoreException e) { + // Do nothing + } + } public boolean canDisconnect() { return false; -- 1.7.1