|
From: <tc...@us...> - 2007-03-23 11:24:38
|
Revision: 2213
http://svn.sourceforge.net/rubyeclipse/?rev=2213&view=rev
Author: tcorbat
Date: 2007-03-23 04:24:36 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
Fix: Removed the dependency on a not yet implemented functionality in JRuby.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NodeUtil.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NodeUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NodeUtil.java 2007-03-23 11:05:08 UTC (rev 2212)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NodeUtil.java 2007-03-23 11:24:36 UTC (rev 2213)
@@ -111,10 +111,41 @@
List<Node> childList = node.childNodes();
for(Node currentChild : childList){
- enclosingPosition = SourcePosition.combinePosition(enclosingPosition, subPositionUnion(currentChild));
+// combinePosition() is not yet available in JRuby (SourcePosition), hope it will we soon.
+// While waiting for this use the posUnion method.
+// enclosingPosition = SourcePosition.combinePosition(enclosingPosition, subPositionUnion(currentChild));
+ enclosingPosition = posUnion(enclosingPosition, subPositionUnion(currentChild));
+
+
}
return enclosingPosition;
}
+
+
+ private static ISourcePosition posUnion(ISourcePosition firstPos, ISourcePosition secondPos) {
+ String fileName = firstPos.getFile();
+ int startOffset = firstPos.getStartOffset();
+ int endOffset = firstPos.getEndOffset();
+ int startLine = firstPos.getStartLine();
+ int endLine = firstPos.getEndLine();
+
+ if(startOffset > secondPos.getStartOffset()){
+ startOffset = secondPos.getStartOffset();
+ startLine = secondPos.getStartLine();
+ }
+
+ if(endOffset < secondPos.getEndOffset()){
+ endOffset = secondPos.getEndOffset();
+ endLine = secondPos.getEndLine();
+ }
+
+ SourcePosition combinedPosition = new SourcePosition(fileName, startLine, endLine, startOffset, endOffset);
+
+ return combinedPosition;
+
+
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|