|
From: <caw...@us...> - 2007-07-18 16:09:46
|
Revision: 2780
http://svn.sourceforge.net/rubyeclipse/?rev=2780&view=rev
Author: cawilliams
Date: 2007-07-18 09:09:43 -0700 (Wed, 18 Jul 2007)
Log Message:
-----------
actually read the "no" attribute on frames and use that as the index (rather than assuming 1 and counting up each time we read a frame in).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/FramesReader.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/FramesReader.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/FramesReader.java 2007-07-18 15:55:28 UTC (rev 2779)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/FramesReader.java 2007-07-18 16:09:43 UTC (rev 2780)
@@ -1,9 +1,10 @@
package org.rubypeople.rdt.internal.debug.core.parsing;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
-import org.eclipse.debug.core.model.IStackFrame;
import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
import org.rubypeople.rdt.internal.debug.core.model.RubyStackFrame;
import org.rubypeople.rdt.internal.debug.core.model.RubyThread;
@@ -13,8 +14,7 @@
public class FramesReader extends XmlStreamReader {
private RubyThread thread;
- int index = 1;
- private List<IStackFrame> frames;
+ private List<RubyStackFrame> frames;
public FramesReader(XmlPullParser xpp) {
super(xpp);
@@ -27,13 +27,19 @@
public RubyStackFrame[] readFrames(RubyThread thread) {
this.thread = thread;
- this.frames = new ArrayList<IStackFrame>();
+ this.frames = new ArrayList<RubyStackFrame>();
try {
this.read();
} catch (Exception ex) {
RdtDebugCorePlugin.log(ex);
return new RubyStackFrame[0];
}
+ Collections.sort(frames, new Comparator<RubyStackFrame>() {
+ public int compare(RubyStackFrame one, RubyStackFrame two) {
+ return Integer.valueOf(one.getIndex()).compareTo(Integer.valueOf(two.getIndex()));
+ }
+
+ });
RubyStackFrame[] frameArray = new RubyStackFrame[frames.size()];
frames.toArray(frameArray);
thread.setStackFrames(frameArray);
@@ -48,9 +54,10 @@
return true;
}
if (name.equals("frame")) {
- int line = Integer.parseInt(xpp.getAttributeValue("", "line"));
+ int line = Integer.parseInt(xpp.getAttributeValue("", "line"));
+ int index = Integer.parseInt(xpp.getAttributeValue("", "no"));
String file = xpp.getAttributeValue("", "file");
- this.frames.add(new RubyStackFrame(thread, file, line, index++));
+ this.frames.add(new RubyStackFrame(thread, file, line, index));
return true;
}
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|