changes for new action for breakpoint
authorcperkonig <cperkonig>
Sun, 29 Feb 2004 18:38:35 +0000 (18:38 +0000)
committercperkonig <cperkonig>
Sun, 29 Feb 2004 18:38:35 +0000 (18:38 +0000)
net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java
net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPLineBreakpoint.java

index 1f84446..845a4be 100644 (file)
@@ -16,6 +16,7 @@ import java.util.Map;
 
 import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin;
 import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
+//import net.sourceforge.phpdt.internal.debug.core.breakpoints.IPHPLineBreakpoint;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.Preferences;
@@ -83,6 +84,14 @@ public class PHPDebugModel {
                }
                new PHPLineBreakpoint(resource, lineNumber, charStart, charEnd, hitCount, true, attributes);
        }
+       
+       public static void createLineBreakpoint(IResource resource, int lineNumber, int hitCount, boolean register, Map attributes) throws CoreException {
+               if (attributes == null) {
+                       attributes = new HashMap(10);
+               }
+               new PHPLineBreakpoint(resource, lineNumber, hitCount, true, attributes);
+       }
+       
 
        /**
         * Returns true if line breakpoint is already registered with the breakpoint
@@ -95,7 +104,7 @@ public class PHPDebugModel {
         * if no such breakpoint is registered
         * @exception CoreException If this method fails.
         */
-       public static boolean lineBreakpointExists(int lineNumber) throws CoreException {
+       public static PHPLineBreakpoint lineBreakpointExists(int lineNumber) throws CoreException {
                String modelId= getPluginIdentifier();
                String markerType= PHPLineBreakpoint.getMarkerType();
                IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
@@ -107,11 +116,11 @@ public class PHPDebugModel {
                        PHPLineBreakpoint breakpoint = (PHPLineBreakpoint) breakpoints[i];
                        if (breakpoint.getMarker().getType().equals(markerType)) {
                                        if (breakpoint.getLineNumber() == lineNumber) {
-                                               return true;
+                                               return breakpoint;
                                        }
                        }
                }
-               return false;
+               return null;
        }       
 
        /**
index 75a3c1f..804b2d8 100644 (file)
@@ -34,6 +34,11 @@ public class PHPLineBreakpoint extends PHPBreakpoint implements IBreakpoint, ILi
        public PHPLineBreakpoint(IResource resource, int lineNumber, int charStart, int charEnd, int hitCount, boolean add, Map attributes) throws DebugException {
                this(resource, lineNumber, charStart, charEnd, hitCount, add, attributes, PHP_LINE_BREAKPOINT);
        }
+       
+       public PHPLineBreakpoint(IResource resource, int lineNumber, int hitCount, boolean add, Map attributes) throws DebugException {
+               this(resource, lineNumber, -1, -1, hitCount, add, attributes, PHP_LINE_BREAKPOINT);
+       }
+       
 
        protected PHPLineBreakpoint(final IResource resource, final int lineNumber, final int charStart, final int charEnd, final int hitCount, final boolean add, final Map attributes, final String markerType) throws DebugException {
                IWorkspaceRunnable wr= new IWorkspaceRunnable() {
@@ -54,13 +59,17 @@ public class PHPLineBreakpoint extends PHPBreakpoint implements IBreakpoint, ILi
                };
                run(wr);
        }
+       
 
        public void addLineBreakpointAttributes(Map attributes, String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) {
                attributes.put(IBreakpoint.ID, modelIdentifier);
                attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
                attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
-               attributes.put(IMarker.CHAR_START, new Integer(charStart));
-               attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+               if (charStart!=-1)
+               {
+                       attributes.put(IMarker.CHAR_START, new Integer(charStart));
+                       attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+               }
                attributes.put(TYPE_NAME, "typeName"); 
        }