Fixed #1721079 - Can not set breakpoint in different files on the same line
authortoshihiro <toshihiro>
Fri, 8 Jun 2007 10:02:33 +0000 (10:02 +0000)
committertoshihiro <toshihiro>
Fri, 8 Jun 2007 10:02:33 +0000 (10:02 +0000)
net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java
net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java

index 7da4a4d..d45001e 100644 (file)
@@ -17,6 +17,7 @@ import java.util.Map;
 import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin;
 import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
 
+import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.Preferences;
@@ -124,7 +125,7 @@ public class PHPDebugModel {
         * @exception CoreException
         *                If this method fails.
         */
-       public static PHPLineBreakpoint lineBreakpointExists(int lineNumber)
+       public static PHPLineBreakpoint lineBreakpointExists(IResource resource, int lineNumber)
                        throws CoreException {
                String modelId = PHPDebugCorePlugin.PLUGIN_ID; // getPluginIdentifier();
                String markerType = PHPLineBreakpoint.getMarkerType();
@@ -136,8 +137,8 @@ public class PHPDebugModel {
                                continue;
                        }
                        PHPLineBreakpoint breakpoint = (PHPLineBreakpoint) breakpoints[i];
-                       if (breakpoint.getMarker().getType().equals(markerType)) {
-                               if (breakpoint.getLineNumber() == lineNumber) {
+                       if (breakpoint.getLineNumber() == lineNumber) {
+                               if (breakpoint.getMarker().getResource().equals(resource)) {
                                        return breakpoint;
                                }
                        }
index 585a9c3..7f5935f 100644 (file)
@@ -17,6 +17,7 @@ import java.util.List;
 
 import net.sourceforge.phpdt.debug.core.PHPDebugModel;
 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
+import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
@@ -232,11 +233,12 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
                                .getLineOfLastMouseButtonActivity();
                // create the marker
                try {
-                       // Falta verificar si la ubicaci�n del Breakpoint es v�lida
+                       // Falta verificar si la ubicaci?½n del Breakpoint es v?½lida
                        int lineNumber = rulerLine + 1;
 
                        if (lineNumber > 0) {
-                               if (PHPDebugModel.lineBreakpointExists(lineNumber) == null) {
+                               IResource resource = ((IFileEditorInput) editorInput).getFile();
+                               if (PHPDebugModel.lineBreakpointExists(resource, lineNumber) == null) {
                                        // Map attributes = new HashMap(10);
                                        IRegion line = document.getLineInformation(lineNumber - 1);
                                        int start = line.getOffset();
@@ -247,8 +249,7 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
                                        // PHPDebugModel.createLineBreakpoint(getResource(),
                                        // lineNumber, start, end, 0, true, attributes);
                                        PHPDebugModel.createLineBreakpoint(
-                                                       ((IFileEditorInput) editorInput).getFile(),
-                                                       lineNumber, start, end, 0, true, null);
+                                                       resource, lineNumber, start, end, 0, true, null);
                                        // PHPDebugModel.createLineBreakpoint(((IFileEditorInput)
                                        // editorInput).getFile(), lineNumber, 0, true, attributes);
 
index 7725750..6c88414 100644 (file)
@@ -152,7 +152,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
                                // breakpoint, true );
                                //
                                PHPLineBreakpoint existingBreakpoint = PHPDebugModel
-                                               .lineBreakpointExists(lineNumber); // typeName,
+                                               .lineBreakpointExists(resource, lineNumber); // typeName,
                                                                                                                        // lineNumber);
                                if (existingBreakpoint != null) {
                                        DebugPlugin.getDefault().getBreakpointManager()
@@ -436,7 +436,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
        public static String resolveMethodSignature(IType type,
                        String methodSignature) throws JavaModelException {
                String[] parameterTypes = Signature.getParameterTypes(methodSignature);
-               int length = length = parameterTypes.length;
+               int length = parameterTypes.length;
                String[] resolvedParameterTypes = new String[length];
 
                for (int i = 0; i < length; i++) {