Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18445/src/org/python/pydev/debug/ui
Modified Files:
PythonConsoleLineTracker.java
Log Message:
The beginning of the new debugger technology
Index: PythonConsoleLineTracker.java
===================================================================
RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/PythonConsoleLineTracker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PythonConsoleLineTracker.java 15 Apr 2004 23:24:49 -0000 1.3
--- PythonConsoleLineTracker.java 22 Apr 2004 10:56:16 -0000 1.4
***************
*** 6,9 ****
--- 6,10 ----
package org.python.pydev.debug.ui;
+ import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
***************
*** 15,27 ****
import org.eclipse.debug.ui.console.FileLink;
import org.eclipse.debug.ui.console.IConsole;
import org.eclipse.debug.ui.console.IConsoleLineTracker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.python.pydev.debug.core.PydevDebugPlugin;
/**
* Line tracker that hyperlinks error lines: 'File "D:\mybad.py" line 3\n n Syntax error'
*
! * @see org.eclipse.ant.internal.ui.console.BuildFailedTracker
*/
public class PythonConsoleLineTracker implements IConsoleLineTracker {
--- 16,32 ----
import org.eclipse.debug.ui.console.FileLink;
import org.eclipse.debug.ui.console.IConsole;
+ import org.eclipse.debug.ui.console.IConsoleHyperlink;
import org.eclipse.debug.ui.console.IConsoleLineTracker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.python.pydev.debug.core.PydevDebugPlugin;
+ import org.python.pydev.editor.actions.PyOpenAction;
+ import org.python.pydev.editor.model.ItemPointer;
+ import org.python.pydev.editor.model.Location;
/**
* Line tracker that hyperlinks error lines: 'File "D:\mybad.py" line 3\n n Syntax error'
*
! * see org.eclipse.ant.internal.ui.console.BuildFailedTracker
*/
public class PythonConsoleLineTracker implements IConsoleLineTracker {
***************
*** 30,33 ****
--- 35,58 ----
/** pattern for detecting error lines */
static Pattern linePattern = Pattern.compile("\\s*File \\\"([^\\\"]*)\\\", line (\\d*).*");
+
+ /**
+ * Opens up a file with a given line
+ */
+ public class ConsoleLink implements IConsoleHyperlink {
+
+ ItemPointer pointer;
+
+ public ConsoleLink(ItemPointer pointer) {
+ this.pointer = pointer;
+ }
+
+ public void linkEntered() {}
+ public void linkExited() {}
+
+ public void linkActivated() {
+ PyOpenAction open = new PyOpenAction();
+ open.run(pointer);
+ }
+ }
public void init(IConsole console) {
***************
*** 59,74 ****
int num = -1;
try {
! num = lineNumber != null ? Integer.parseInt(lineNumber) : -1;
}
catch (NumberFormatException e) {
}
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName));
! IFile file= null;
! if (files.length > 0)
! file= files[0];
! if (file != null && file.exists()) {
! FileLink link = new FileLink(file, null, -1, -1, num);
! console.addLink(link, lineOffset + fileStart, lineLength - fileStart);
}
}
} catch (BadLocationException e) {
--- 84,105 ----
int num = -1;
try {
! num = lineNumber != null ? Integer.parseInt(lineNumber) - 1: 0;
}
catch (NumberFormatException e) {
+ num = 0;
}
+ IConsoleHyperlink link = null;
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName));
! if (files.length > 0 && files[0].exists())
! link = new FileLink(files[0], null, -1, -1, num);
! else { // files outside of the workspace
! File realFile = new File(fileName);
! if (realFile.exists()) {
! ItemPointer p = new ItemPointer(realFile, new Location(num, 0), null);
! link = new ConsoleLink(p);
! }
}
+ if (link != null)
+ console.addLink(link, lineOffset + fileStart, lineLength - fileStart);
}
} catch (BadLocationException e) {
|