X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java index 55be0de..8d4b084 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java @@ -12,14 +12,15 @@ Contributors: package net.sourceforge.phpdt.internal.debug.core.breakpoints; import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; -import org.eclipse.core.resources.IWorkspaceRunnable; + import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.Breakpoint; +import org.eclipse.debug.core.model.IBreakpoint; /** * A breakpoint is capable of suspending the execution of a @@ -78,10 +79,38 @@ public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint { * Breakpoint attribute storing a breakpoint's hit count value * (value "net.sourceforge.phpeclipse.debug.hitCount"). This attribute is stored as an * int. + * + * For DBG the hit count is really a skip count. + * Explanation: A hit count of e.g. 4 would break on the fourth occurence of the breakpoint. + * A skip count means skip the first four occurences of the breakpoint, and break on the fifth occurence. */ protected static final String HIT_COUNT = "net.sourceforge.phpeclipse.debug.hitCount"; //$NON-NLS-1$ /** + * Breakpoint attribute storing a breakpoint's changeID. + * This is used for checking whether the breakpoint properties menu was finished with + * a OK-button. Which means a possible change of breakpoint condition or skip count. + * This is necessary because in method breakpointChanged in class PHPDebugTarget we need to know, + * whether the breakpoint has changed or not (breakpointChanged is called also when + * a PHP source file is modified and saved). + */ + protected static final String CHANGE_ID = "net.sourceforge.phpeclipse.debug.changeID"; //$NON-NLS-1$ + + /** + * Breakpoint attribute storing a breakpoint's condition + * (value "net.sourceforge.phpeclipse.debug.condition"). This attribute is stored as an + * string. + */ + protected static final String CONDITION = "net.sourceforge.phpeclipse.debug.condition"; //$NON-NLS-1$ + + /** + * Breakpoint attribute storing whether a breakpoint's condition is enabled or not + * (value "net.sourceforge.phpeclipse.debug.conditionEnabled"). This attribute is stored as an + * boolean. + */ + protected static final String CONDITION_ENABLED = "net.sourceforge.phpeclipse.debug.conditionEnabled"; //$NON-NLS-1$ + + /** * Breakpoint attribute storing the fully qualified name of the type * this breakpoint is located in. * (value "net.sourceforge.phpeclipse.debug.typeName"). This attribute is a String. @@ -174,20 +203,28 @@ public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint { * @see IBreakpoint#getModelIdentifier() */ public String getModelIdentifier() { - if (PHPDebugCorePlugin.getDefault() == null) { - // If the default instance is not yet initialized, - // return a static identifier. This identifier must - // match the plugin id defined in plugin.xml - return "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$ - } - return PHPDebugCorePlugin.getDefault().getDescriptor().getUniqueIdentifier(); + return PHPDebugCorePlugin.getUniqueIdentifier(); } public void setDBGBpNo(int bpNo) { - this.DBGBpNo= bpNo; + this.DBGBpNo = bpNo; } public int getDBGBpNo() { return this.DBGBpNo; } + + public int getHitCount () throws CoreException { + return getMarker ().getAttribute (HIT_COUNT, -1); + } + + public void setHitCount (int hitCount) throws CoreException { + if (hitCount > 0) { + if (!isEnabled ()) { + getMarker ().setAttribute (ENABLED, true); + } + } + + getMarker ().setAttribute (HIT_COUNT, hitCount); + } }