*/
package net.sourceforge.phpeclipse.xdebug.php.model;
-//import java.io.ByteArrayInputStream;
//import java.io.IOException;
import java.util.List;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
try {
if (breakpoint.isEnabled()) {
if (marker != null) {
- int id = fDebugConnection.breakpointSet(newPath.toString(), ((ILineBreakpoint)breakpoint).getLineNumber(), marker.getAttribute(XDebugBreakpoint.HIT_COUNT,-1));
+ int id = fDebugConnection.breakpointSet (newPath.toString(),
+ ((ILineBreakpoint)breakpoint).getLineNumber(),
+ marker.getAttribute (XDebugBreakpoint.HIT_COUNT, -1),
+ marker.getAttribute (XDebugBreakpoint.CONDITION_ENABLED, false),
+ marker.getAttribute (XDebugBreakpoint.CONDITION, ""));
XDebugResponse dr = getResponse(id);
String bpid = dr.getAttributeValue("id");
}
}
}
- }
- } else {
- if (supportsBreakpoint(breakpoint)) {
- try {
- if (breakpoint.isEnabled()) {
- if (marker != null) {
- int id = fDebugConnection.breakpointSet (path.toString(),
- ((ILineBreakpoint) breakpoint).getLineNumber(),
- marker.getAttribute (XDebugBreakpoint.HIT_COUNT, -1));
- XDebugResponse dr = getResponse(id);
- String bpid = dr.getAttributeValue("id");
-
- if (!"".equals(bpid)) {
- marker.setAttribute(XDebugLineBreakpoint.BREAKPOINT_ID,Integer.parseInt(bpid));
- }
- }
- }
- } catch (DebugException e) {
- e.printStackTrace();
- } catch (CoreException e) {
- e.printStackTrace();
+ else {
+ XDebugCorePlugin.log (IStatus.WARNING, "path do not match: local path: " + local.toString () + " breakpoint file: " + path.toString ());
}
}
}
* @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
+ IMarker marker = breakpoint.getMarker(); // Get the breakpoints marker info (It's the local workspace path)
+
if (supportsBreakpoint(breakpoint)) {
- try {
- int id =((XDebugLineBreakpoint)breakpoint).getID();
- if (id >0)
- fDebugConnection.breakpointRemove(id);
- } catch (CoreException e) {
- }
+ int id = marker.getAttribute (XDebugLineBreakpoint.BREAKPOINT_ID, -1);
+
+ if (id > 0) {
+ fDebugConnection.breakpointRemove(id);
+ }
}
}
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
-// if (supportsBreakpoint(breakpoint)) {
-// try {
-// if (breakpoint.isEnabled()) {
-// breakpointAdded(breakpoint);
-// } else {
-// breakpointRemoved(breakpoint, null);
-// }
-// } catch (CoreException e) {
-// }
-// }
+ IMarker oldmarker = breakpoint.getMarker ();
+
+ if (supportsBreakpoint(breakpoint)) {
+ try {
+ if (breakpoint.isEnabled () && // Check if breakpoint state changed from disabled to enabled
+ !delta.getAttribute ("org.eclipse.debug.core.enabled", false)) {
+ breakpointAdded (breakpoint);
+ }
+ else if (!breakpoint.isEnabled () && // Check if breakpoint state changed from enabled to disabled
+ delta.getAttribute ("org.eclipse.debug.core.enabled", true)) {
+ breakpointRemoved (breakpoint, null);
+ }
+ else if (oldmarker.getAttribute (XDebugLineBreakpoint.CHANGE_ID, 1) !=
+ delta.getAttribute (XDebugLineBreakpoint.CHANGE_ID, 0)) {
+ if (breakpoint.isEnabled ()) { // If the breakpoint is already enabled
+ breakpointRemoved (breakpoint, null); // we remove this breakpoint first
+ breakpointAdded (breakpoint); // and then we add again (else XDebug would have two breakpoints!).
+ }
+ else {
+ breakpointRemoved (breakpoint, null);
+ }
+ }
+ } catch (CoreException e) {
+ // Do nothing
+ }
+ }
}
/* (non-Javadoc)
hitCount = Integer.parseInt(attribute.getNodeValue());
}
}
-
- Path path1 = new Path (PHPDebugUtils.unescapeString (filename));
+
+ Path path1 = new Path (PHPDebugUtils.unescapeString (filename));
Path path2 = new Path (endfilename);
-
+
if (path1.toString ().endsWith (path2.toString ())
-// if (strPath1.endsWith (strPath2)
+// if (strPath1.endsWith (strPath2)
//if(PHPDebugUtils.unescapeString(filename).endsWith(endfilename)
&& (lineBreakpoint.getLineNumber() == lineNumber) ) {
if (marker.getAttribute(XDebugLineBreakpoint.HIT_COUNT, 0) > 0) {