*******************************************************************************/
package net.sourceforge.phpeclipse.xdebug.php.model;
-
+
import java.util.ArrayList;
//import java.util.Collection;
import java.util.HashMap;
* (value <code>"org.eclipse.jdt.debug.core.hitCount"</code>). This attribute is stored as an
* <code>int</code>.
*/
- protected static final String HIT_COUNT = "net.sourceforge.phpeclipse.xdebug.php.model.hitCount"; //$NON-NLS-1$
+// protected static final String HIT_COUNT = "net.sourceforge.phpeclipse.xdebug.php.model.hitCount"; //$NON-NLS-1$
+ 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
+ * <code>"net.sourceforge.phpeclipse.debug.condition"</code>). This
+ * attribute is stored as an <code>string</code>.
+ */
+ 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
+ * <code>"net.sourceforge.phpeclipse.debug.conditionEnabled"</code>).
+ * This attribute is stored as an <code>boolean</code>.
+ */
+ protected static final String CONDITION_ENABLED = "net.sourceforge.phpeclipse.debug.conditionEnabled"; //$NON-NLS-1$
+
/**
* Breakpoint attribute storing the number of debug targets a
* breakpoint is installed in (value <code>"org.eclipse.jdt.debug.core.installCount"</code>).
* This attribute is a <code>int</code>.
*/
- protected static final String INSTALL_COUNT = "org.eclipse.jdt.debug.core.installCount"; //$NON-NLS-1$
-
+ protected static final String INSTALL_COUNT = "org.eclipse.jdt.debug.core.installCount"; //$NON-NLS-1$
+
/**
* Breakpoint attribute storing the fully qualified name of the type
* this breakpoint is located in.
* (value <code>"org.eclipse.jdt.debug.core.typeName"</code>). This attribute is a <code>String</code>.
*/
- protected static final String TYPE_NAME = "org.eclipse.jdt.debug.core.typeName"; //$NON-NLS-1$
-
+ protected static final String TYPE_NAME = "org.eclipse.jdt.debug.core.typeName"; //$NON-NLS-1$
+
/**
* Stores the collection of requests that this breakpoint has installed in
* debug targets.
* value: the requests this breakpoint has installed in that target
*/
protected HashMap fRequestsByTarget;
-
+
/**
* The list of threads (ThreadReference objects) in which this breakpoint will suspend,
* associated with the target in which each thread exists (JDIDebugTarget).
* value: thread the filtered thread (IJavaThread) in the given target
*/
//protected Map fFilteredThreadsByTarget;
-
+
/**
* Stores the type name that this breakpoint was last installed
* in. When a breakpoint is created, the TYPE_NAME attribute assigned to it
* is that of its top level enclosing type. When installed, the type
- * may actually be an inner type. We need to keep track of the type
+ * may actually be an inner type. We need to keep track of the type
* type the breakpoint was installed in, in case we need to re-install
* the breakpoint for HCR (i.e. in case an inner type is HCR'd).
*/
protected String fInstalledTypeName = null;
-
+
/**
* List of targets in which this breakpoint is installed.
* Used to prevent firing of more than one install notification
* when a breakpoint's requests are re-created.
*/
protected Set fInstalledTargets = null;
-
+
/**
* List of active instance filters for this breakpoint
* (list of <code>IJavaObject</code>).
*/
protected List fInstanceFilters = null;
-
+
/**
* Empty instance filters array.
*/
protected static final /*IJava*/Object[] fgEmptyInstanceFilters = new /*IJava*/Object[0];
-
+
/**
* Property identifier for a breakpoint object on an event request
*/
public static final String JAVA_BREAKPOINT_PROPERTY = "org.eclipse.jdt.debug.breakpoint"; //$NON-NLS-1$
-
+
/**
* JavaBreakpoint attributes
- */
+ */
protected static final String[] fgExpiredEnabledAttributes= new String[]{EXPIRED, ENABLED};
-
+
public XDebugBreakpoint() {
fRequestsByTarget = new HashMap(1);
//fFilteredThreadsByTarget= new HashMap(1);
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
} else {
setRegistered(false);
}
- }
-
+ }
+
/**
- * Add the given event request to the given debug target. If
- * the request is the breakpoint request associated with this
+ * Add the given event request to the given debug target. If
+ * the request is the breakpoint request associated with this
* breakpoint, increment the install count.
*/
/*protected void registerRequest(EventRequest request, XDebugTarget target) throws CoreException {
// update the install attribute on the breakpoint
if (!(request instanceof ClassPrepareRequest)) {
incrementInstallCount();
- // notification
+ // notification
fireInstalled(target);
}
}*/
-
+
/**
* Returns a String corresponding to the reference type
* name to the top enclosing type in which this breakpoint
return name;
}
return name.substring(0, index);
- }*/
-
+ }*/
+
/**
* Returns the requests that this breakpoint has installed
* in the given target.
}
return list;
}
-
+
/**
* Remove the given request from the given target. If the request
* is the breakpoint request associated with this breakpoint,
return handleClassPrepareEvent((ClassPrepareEvent)event, target);
}
ThreadReference threadRef= ((LocatableEvent)event).thread();
- XDebugThread thread= target.findThread(threadRef);
+ XDebugThread thread= target.findThread(threadRef);
if (thread == null || thread.isIgnoringBreakpoints()) {
return true;
}
- return handleBreakpointEvent(event, target, thread);
+ return handleBreakpointEvent(event, target, thread);
}*/
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.debug.core.IJDIEventListener#wonSuspendVote(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget)
*/
if (threadRef == null) {
return;
}
- XDebugThread thread= target.findThread(threadRef);
+ XDebugThread thread= target.findThread(threadRef);
if (thread == null || thread.isIgnoringBreakpoints()) {
return;
}
/**
* Handle the given class prepare event, which was generated by the
* class prepare event installed in the given target by this breakpoint.
- *
+ *
* If the class which has been loaded is a class in which this breakpoint
* should install, create a breakpoint request for that class.
- */
+ */
/*public boolean handleClassPrepareEvent(ClassPrepareEvent event, XDebugTarget target) {
try {
if (!installableReferenceType(event.referenceType(), target)) {
// Don't install this breakpoint in an
// inappropriate type
return true;
- }
+ }
createRequest(target, event.referenceType());
} catch (CoreException e) {
XDebugCorePlugin.log(e);
}
return true;
}*/
-
+
/**
* @see IJDIEventListener#handleEvent(Event, JDIDebugTarget)
- *
+ *
* Handle the given event, which was generated by the breakpoint request
* installed in the given target by this breakpoint.
*/
expireHitCount(event);
return !suspend(thread); // Resume if suspend fails
}*/
-
+
/**
* Delegates to the given thread to suspend, and
* returns whether the thread suspended
* It is possible that the thread will not suspend
* as directed by a Java breakpoint listener.
- *
+ *
* @see IJavaBreakpointListener#breakpointHit(IJavaThread, IJavaBreakpoint)
*/
/*protected boolean suspend(XDebugThread thread) {
return thread.handleSuspendForBreakpoint(this, true);
}*/
-
+
/**
* Returns whether the given reference type is appropriate for this
* breakpoint to be installed in the given target. Query registered
}
return false;
}*/
-
+
/**
* Called when a breakpoint event is encountered. Expires the
* hit count in the event's request and updates the marker.
}
}
}*/
-
+
/**
* Returns whether this breakpoint should be "skipped". Breakpoints
* are skipped if the breakpoint manager is disabled and the breakpoint
* is registered with the manager
- *
+ *
* @return whether this breakpoint should be skipped
*/
public boolean shouldSkipBreakpoint() throws CoreException {
/**
* Attempts to create a breakpoint request for this breakpoint in the given
* reference type in the given target.
- *
+ *
* @return Whether a request was created
*/
/*protected boolean createRequest(XDebugTarget target, ReferenceType type) throws CoreException {
fInstalledTypeName = type.name();
for (int i = 0; i < requests.length; i++) {
EventRequest request = requests[i];
- registerRequest(request, target);
+ registerRequest(request, target);
}
return true;
}*/
-
+
/**
* Configure a breakpoint request with common properties:
* <ul>
* <li><code>HIT_COUNT</code></li>
* <li><code>EXPIRED</code></li>
* </ul>
- * and sets the suspend policy of the request to suspend
+ * and sets the suspend policy of the request to suspend
* the event thread.
*/
/*protected void configureRequest(EventRequest request, XDebugTarget target) throws CoreException {
// Important: only enable a request after it has been configured
updateEnabledState(request, target);
}*/
-
+
/**
* Adds an instance filter to the given request. Since the implementation is
* request specific, subclasses must override.
- *
+ *
* @param request
* @param object instance filter
*/
//protected abstract void addInstanceFilter(EventRequest request, ObjectReference object);
-
+
/**
* Configure the thread filter property of the given request.
*/
}
setRequestThreadFilter(request, ((JDIThread)thread).getUnderlyingThread());
}*/
-
+
/**
* Configure the given request's hit count
*/
request.putProperty(HIT_COUNT, new Integer(hitCount));
}
}*/
-
+
/*protected void configureInstanceFilters(EventRequest request, XDebugTarget target) {
if (fInstanceFilters != null && !fInstanceFilters.isEmpty()) {
Iterator iter = fInstanceFilters.iterator();
}
}
}
- }*/
-
+ }*/
+
/**
* Creates, installs, and returns all event requests for this breakpoint
* in the given reference type and and target.
- *
+ *
* @return the event requests created or <code>null</code> if creation failed
*/
//protected abstract EventRequest[] newRequests(XDebugTarget target, ReferenceType type) throws CoreException;
-
+
/**
* Add this breakpoint to the given target. After it has been
* added to the given target, this breakpoint will suspend
fireAdding(target);
createRequests(target);
}*/
-
+
/**
* Creates event requests for the given target
*/
if (!success) {
addToTargetForLocalType(target, enclosingTypeName);
- }
+ }
}*/
-
+
/**
* Local types (types defined in methods) are handled specially due to the
- * different types that the local type is associated with as well as the
- * performance problems of using ReferenceType#nestedTypes. From the Java
- * model perspective a local type is defined within a method of a type.
+ * different types that the local type is associated with as well as the
+ * performance problems of using ReferenceType#nestedTypes. From the Java
+ * model perspective a local type is defined within a method of a type.
* Therefore the type of a breakpoint placed in a local type is the type
* that encloses the method where the local type was defined.
* The local type is enclosed within the top level type according
ReferenceType nestedType= (ReferenceType) nestedTypes.next();
if (createRequest(target, nestedType)) {
break;
- }
+ }
}
}
}
}*/
-
+
/**
* Returns the JDI suspend policy that corresponds to this
* breakpoint's suspend policy
- *
+ *
* @return the JDI suspend policy that corresponds to this
* breakpoint's suspend policy
* @exception CoreException if unable to access this breakpoint's
}*/
/**
- * returns the default suspend policy based on the pref setting on the
+ * returns the default suspend policy based on the pref setting on the
* Java-Debug pref page
* @return the default suspend policy
* @since 3.2
Preferences store = JDIDebugModel.getPreferences();
return store.getInt(JDIDebugPlugin.PREF_DEFAULT_BREAKPOINT_SUSPEND_POLICY);
}*/
-
-
+
+
/**
* Returns whether the hitCount of this breakpoint is equal to the hitCount of
* the associated request.
int oldCount = -1;
if (requestCount != null) {
oldCount = requestCount.intValue();
- }
+ }
return hitCount != oldCount;
}*/
-
+
/**
* Removes this breakpoint from the given target.
*/
if (!markerExists || (markerExists && getInstallCount() == 0)) {
fInstalledTypeName = null;
}
-
- // remove instance filters
+
+ // remove instance filters
if (fInstanceFilters != null && !fInstanceFilters.isEmpty()) {
for (int i = 0; i < fInstanceFilters.size(); i++) {
IJavaObject object = (IJavaObject)fInstanceFilters.get(i);
}
}
}
-
+
// fire change notification if required
if (changed) {
fireChanged();
}
-
+
// notification
fireRemoved(target);
- } */
-
+ } */
+
/**
* Remove all requests that this breakpoint has installed in the given
* debug target.
if (target.isAvailable() && !isExpired(req)) { // cannot delete an expired request
EventRequestManager manager = target.getEventRequestManager();
if (manager != null) {
- manager.deleteEventRequest(req); // disable & remove
- }
+ manager.deleteEventRequest(req); // disable & remove
+ }
}
} catch (VMDisconnectedException e) {
if (target.isAvailable()) {
}
fRequestsByTarget.remove(target);
}*/
-
+
/**
* Update the enabled state of the given request in the given target, which is associated
* with this breakpoint. Set the enabled state of the request
/*protected void updateEnabledState(EventRequest request, XDebugTarget target) throws CoreException {
internalUpdateEnabledState(request, isEnabled(), target);
}*/
-
+
/**
* Set the enabled state of the given request to the given
* value, also taking into account instance filters.
}
}
}*/
-
+
/**
* Returns whether this breakpoint has expired.
*/
public boolean isExpired() throws CoreException {
return ensureMarker().getAttribute(EXPIRED, false);
- }
-
+ }
+
/**
* Returns whether the given request is expired
*/
*/
public boolean isInstalled() throws CoreException {
return ensureMarker().getAttribute(INSTALL_COUNT, 0) > 0;
- }
-
+ }
+
/**
* Increments the install count of this breakpoint
*/
- protected void incrementInstallCount() throws CoreException {
+ protected void incrementInstallCount() throws CoreException {
int count = getInstallCount();
setAttribute(INSTALL_COUNT, count + 1);
- }
-
+ }
+
/**
* Returns the <code>INSTALL_COUNT</code> attribute of this breakpoint
* or 0 if the attribute is not set.
*/
public int getInstallCount() throws CoreException {
return ensureMarker().getAttribute(INSTALL_COUNT, 0);
- }
+ }
/**
* Decrements the install count of this breakpoint.
protected void decrementInstallCount() throws CoreException {
int count= getInstallCount();
if (count > 0) {
- setAttribute(INSTALL_COUNT, count - 1);
+ setAttribute(INSTALL_COUNT, count - 1);
}
if (count == 1) {
if (isExpired()) {
}
}
}
-
+
/**
* Sets the type name in which to install this breakpoint.
*/
protected void setTypeName(String typeName) throws CoreException {
setAttribute(TYPE_NAME, typeName);
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#getTypeName()
}
return fInstalledTypeName;
}
-
+
/**
* Resets the install count attribute on this breakpoint's marker
* to "0". Resets the expired attribute on all breakpoint markers to <code>false</code>.
String[] strAttributes= new String[attributes.size()];
setAttributes((String[])attributes.toArray(strAttributes), values.toArray());
}
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#getHitCount()
public int getHitCount() throws CoreException {
return ensureMarker().getAttribute(HIT_COUNT, -1);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#setHitCount(int)
*/
- public void setHitCount(int count) throws CoreException {
+ public void setHitCount(int count) throws CoreException {
if (getHitCount() != count) {
if (!isEnabled() && count > -1) {
setAttributes(new String []{ENABLED, HIT_COUNT, EXPIRED},
///recreate();
}
}
-
+
protected String getMarkerMessage(int hitCount, int suspendPolicy) {
StringBuffer buff= new StringBuffer();
/*if (hitCount > 0){
- buff.append(MessageFormat.format(JDIDebugBreakpointMessages.JavaBreakpoint___Hit_Count___0___1, new Object[]{Integer.toString(hitCount)}));
+ buff.append(MessageFormat.format(JDIDebugBreakpointMessages.JavaBreakpoint___Hit_Count___0___1, new Object[]{Integer.toString(hitCount)}));
buff.append(' ');
}
String suspendPolicyString;
if (suspendPolicy == IJavaBreakpoint.SUSPEND_THREAD) {
- suspendPolicyString= JDIDebugBreakpointMessages.JavaBreakpoint__suspend_policy__thread__1;
+ suspendPolicyString= JDIDebugBreakpointMessages.JavaBreakpoint__suspend_policy__thread__1;
} else {
- suspendPolicyString= JDIDebugBreakpointMessages.JavaBreakpoint__suspend_policy__VM__2;
+ suspendPolicyString= JDIDebugBreakpointMessages.JavaBreakpoint__suspend_policy__VM__2;
}
-
+
buff.append(suspendPolicyString);*/
return buff.toString();
- }
-
+ }
+
/**
* Sets whether this breakpoint's hit count has expired.
*/
public void setExpired(boolean expired) throws CoreException {
- setAttribute(EXPIRED, expired);
- }
+ setAttribute(EXPIRED, expired);
+ }
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#getSuspendPolicy()
recreate();
}
}*/
-
+
/**
* Notifies listeners this breakpoint is to be added to the
* given target.
- *
+ *
* @param target debug target
*/
/*protected void fireAdding(XDebugTarget target) {
if (plugin != null)
plugin.fireBreakpointAdding(target, this);
}*/
-
+
/**
* Notifies listeners this breakpoint has been removed from the
* given target.
- *
+ *
* @param target debug target
*/
/*protected void fireRemoved(XDebugTarget target) {
plugin.fireBreakpointRemoved(target, this);
setInstalledIn(target, false);
}
- }*/
-
+ }*/
+
/**
* Notifies listeners this breakpoint has been installed in the
* given target.
- *
+ *
* @param target debug target
*/
/*protected void fireInstalled(XDebugTarget target) {
setInstalledIn(target, true);
}
} */
-
+
/**
* Returns whether this breakpoint is installed in the given target.
- *
+ *
* @param target
* @return whether this breakpoint is installed in the given target
*/
protected boolean isInstalledIn(XDebugTarget target) {
return fInstalledTargets != null && fInstalledTargets.contains(target);
}
-
+
/**
* Sets this breakpoint as installed in the given target
- *
+ *
* @param target
* @param installed whether installed
*/
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#setThreadFilter(org.eclipse.jdt.debug.core.IJavaThread)
*/
JDIDebugTarget target= (JDIDebugTarget)thread.getDebugTarget();
if (thread != fFilteredThreadsByTarget.put(target, thread) ) {
// recreate the breakpoint only if it is not the same thread
-
+
// Other breakpoints set attributes on the underlying
// marker and the marker changes are eventually
// propagated to the target. The target then asks the
fireChanged();
}
}*/
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
*/
cleanupForThreadTermination((JDIThread)source);
} catch (VMDisconnectedException exception) {
// Thread death often occurs at shutdown.
- // A VMDisconnectedException trying to
+ // A VMDisconnectedException trying to
// update the breakpoint request is
// acceptable.
}
}
}
}*/
-
+
/**
* Removes cached information relevant to this thread which has
* terminated.
- *
+ *
* Remove thread filters for terminated threads
- *
+ *
* Subclasses may override but need to call super.
*/
/*protected void cleanupForThreadTermination(JDIThread thread) {
JDIDebugPlugin.log(exception);
}
}*/
-
- /**
+
+ /**
* EventRequest does not support thread filters, so they
* can't be set generically here. However, each of the breakpoint
* subclasses of EventRequest do support thread filters. So
* request type.
*/
//protected abstract void setRequestThreadFilter(EventRequest request, ThreadReference thread);
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#getThreadFilter(org.eclipse.jdt.debug.core.IJavaDebugTarget)
*/
/*public IJavaThread getThreadFilter(IJavaDebugTarget target) {
return (IJavaThread)fFilteredThreadsByTarget.get(target);
}*/
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#getThreadFilters()
*/
fireChanged();
}
}*/
-
+
/**
* Returns whether this breakpoint should be installed in the given reference
* type in the given target according to registered breakpoint listeners.
- *
+ *
* @param target debug target
* @param type reference type or <code>null</code> if this breakpoint is
* not installed in a specific type
}
return false;
}*/
-
+
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.core.IJavaBreakpoint#addInstanceFilter(org.eclipse.jdt.debug.core.IJavaObject)
*/
fireChanged();
}
}
-
+
/**
* Change notification when there are no marker changes. If the marker
* does not exist, do not fire a change notification (the marker may not
*/
protected void fireChanged() {
DebugPlugin plugin = DebugPlugin.getDefault();
- if (plugin != null && markerExists()) {
+ if (plugin != null && markerExists()) {
plugin.getBreakpointManager().fireBreakpointChanged(this);
- }
+ }
}
/* (non-Javadoc)
fireChanged();
}
}
-
+
/**
* An attribute of this breakpoint has changed - recreate event requests in
* all targets.
}
}
}*/
-
+
/**
* Recreate this breakpoint in the given target, as long as the
* target already contains this breakpoint.
- *
- * @param target the target in which to re-create the breakpoint
+ *
+ * @param target the target in which to re-create the breakpoint
*/
/*protected void recreate(XDebugTarget target) throws CoreException {
if (target.isAvailable() && target.getBreakpoints().contains(this)) {
*/
package net.sourceforge.phpeclipse.xdebug.php.model;
-//import java.io.ByteArrayInputStream;
//import java.io.IOException;
import java.util.List;
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();
- }
- }
}
}
* @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) {