Problem with folder link

2004-10-08
2013-03-15
  • Sergej Zagursky

    Sergej Zagursky - 2004-10-08

    Hi.
    Pydev debugger cannot start if file is in the folder link. Eclipse doc says that getFilesForLocation() returns null if file is in linked folder.

     
    • Sergej Zagursky

      Sergej Zagursky - 2004-10-08

      The patch for this problem:
      Index: src/org/python/pydev/debug/model/PyDebugTarget.java
      ===================================================================
      RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugTarget.java,v
      retrieving revision 1.9
      diff -u -r1.9 PyDebugTarget.java
      --- src/org/python/pydev/debug/model/PyDebugTarget.java    24 Sep 2004 00:39:05 -0000    1.9
      +++ src/org/python/pydev/debug/model/PyDebugTarget.java    7 Oct 2004 17:52:59 -0000
      @@ -78,20 +78,33 @@
               debugger.postCommand(new VersionCommand(debugger));
              
               // now, register all the breakpoints in our project
      -        IFile launched = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file);
      -        IProject project = launched.getProject();
      -        try {
      -            IMarker[] markers = project.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE);
      -            IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
      -            for (int i= 0; i < markers.length; i++) {
      -                PyBreakpoint brk = (PyBreakpoint)breakpointManager.getBreakpoint(markers[i]);
      -                if (brk.isEnabled()) {
      -                    SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine());
      -                    debugger.postCommand(cmd);
      -                }
      -            }                   
      -        } catch (Throwable t) {
      -            PydevDebugPlugin.errorDialog("Error setting breakpoints", t);
      +        IFile launched[];
      +        IFile temp = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(file);
      +        if(temp != null)
      +        {
      +            launched = new IFile[1];
      +            launched[0] = temp;
      +        }
      +        else
      +        {
      +            launched = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(file);
      +        }
      +       
      +        for(int ii = 0; ii != launched.length; ++ii) {
      +            IProject project = launched[ii].getProject();
      +            try {
      +                IMarker[] markers = project.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE);
      +                IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
      +                for (int i= 0; i < markers.length; i++) {
      +                    PyBreakpoint brk = (PyBreakpoint)breakpointManager.getBreakpoint(markers[i]);
      +                    if (brk.isEnabled()) {
      +                        SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine());
      +                        debugger.postCommand(cmd);
      +                    }
      +                }                   
      +            } catch (Throwable t) {
      +                PydevDebugPlugin.errorDialog("Error setting breakpoints", t);
      +            }
               }
               // Send the run command, and we are off
               RunCommand run = new RunCommand(debugger);

       
      • Anonymous - 2004-10-11

        Thanks for the patch. I've applied it to the trunk.

        Aleks

         

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks