|
From: Zach D. <zd...@us...> - 2005-08-06 02:45:07
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6286/src/org/rubypeople/rdt/internal/core Modified Files: RubyScriptStructureBuilder.java Log Message: Updates source positioning for Outline view. Index: RubyScriptStructureBuilder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RubyScriptStructureBuilder.java 12 Jul 2005 00:03:06 -0000 1.8 --- RubyScriptStructureBuilder.java 6 Aug 2005 02:44:59 -0000 1.9 *************** *** 351,355 **** info.setTypeName(estimateValueType(iVisited.getValueNode())); ISourcePosition pos = iVisited.getPosition(); ! setTokenRange(pos, info, name); // TODO Add more information about the variable infoStack.push(info); --- 351,356 ---- info.setTypeName(estimateValueType(iVisited.getValueNode())); ISourcePosition pos = iVisited.getPosition(); ! //setTokenRange(pos, info, name); ! setClassVarRange( pos, info, name ); // TODO Add more information about the variable infoStack.push(info); *************** *** 370,381 **** public void visitClassVarDeclNode(ClassVarDeclNode iVisited) { handleNode(iVisited); RubyElement type = getCurrentType(); RubyClassVar var = new RubyClassVar(type, iVisited.getName()); ! RubyElementInfo parentInfo = infoStack.peek(); ! parentInfo.addChild(var); ! RubyFieldElementInfo info = new RubyFieldElementInfo(); info.setTypeName(estimateValueType(iVisited.getValueNode())); newElements.put(var, info); --- 371,387 ---- public void visitClassVarDeclNode(ClassVarDeclNode iVisited) { handleNode(iVisited); + String name = iVisited.getName(); RubyElement type = getCurrentType(); RubyClassVar var = new RubyClassVar(type, iVisited.getName()); ! RubyElementInfo parentInfo = infoStack.peek(); RubyFieldElementInfo info = new RubyFieldElementInfo(); info.setTypeName(estimateValueType(iVisited.getValueNode())); + info.setTypeName(estimateValueType(iVisited.getValueNode())); + ISourcePosition pos = iVisited.getPosition(); + //setTokenRange(pos, info, name); + setClassVarRange( pos, info, name ); + + parentInfo.addChild(var); newElements.put(var, info); *************** *** 453,456 **** --- 459,463 ---- ISourcePosition pos = iVisited.getPosition(); setKeywordRange("class", pos, info, name); + // TODO Set the superclass! info.setIncludedModuleNames(new String[] {"Kernel"}); *************** *** 467,470 **** --- 474,507 ---- } + private void setLocalVarRange( ISourcePosition pos, MemberElementInfo info, String name ){ + int start = pos.getStartOffset() - name.length(); + setMemberElementPosition( + info, + start, + pos.getStartOffset() - 1, + start, + pos.getEndOffset() ); + } + + private void setInstanceVarRange( ISourcePosition pos, MemberElementInfo info, String name ){ + int start = pos.getStartOffset() - name.length(); + setMemberElementPosition( + info, + start, + pos.getStartOffset()- 1, + start, + pos.getEndOffset() ); + } + + private void setClassVarRange( ISourcePosition pos, MemberElementInfo info, String name ){ + int start = pos.getStartOffset() - name.length(); + setMemberElementPosition( + info, + start, + pos.getStartOffset() - 1, + start, + pos.getEndOffset() - 1); + } + /** * @param keyword *************** *** 474,481 **** */ private void setKeywordRange(String keyword, ISourcePosition pos, MemberElementInfo info, String name) { ! info.setNameSourceStart(pos.getStartOffset() + 1); ! info.setNameSourceEnd(pos.getStartOffset() + name.length()); ! info.setSourceRangeStart(pos.getStartOffset() - keyword.length()); ! info.setSourceRangeEnd(pos.getEndOffset() - 1); } --- 511,534 ---- */ private void setKeywordRange(String keyword, ISourcePosition pos, MemberElementInfo info, String name) { ! info.setNameSourceStart( pos.getStartOffset() + 1); ! info.setNameSourceEnd(pos.getStartOffset() + name.length() ); ! info.setSourceRangeStart(pos.getStartOffset() + 1 ); ! info.setSourceRangeEnd( pos.getEndOffset() ); ! } ! ! /** ! * Sets the position on a given MemberElementInfo object. ! * @param info ! * @param nameSourceStart ! * @param nameSourceEnd ! * @param sourceStart ! * @param sourceEnd ! */ ! private void setMemberElementPosition( MemberElementInfo info, int nameSourceStart, ! int nameSourceEnd, int sourceStart, int sourceEnd ){ ! info.setNameSourceStart( nameSourceStart ); ! info.setNameSourceEnd( nameSourceEnd ); ! info.setSourceRangeStart( sourceStart ); ! info.setSourceRangeEnd( sourceEnd ); } *************** *** 910,914 **** info.setNameSourceEnd(pos.getStartOffset() - 1); info.setSourceRangeStart(realStart); ! info.setSourceRangeEnd(pos.getStartOffset() - 1); } --- 963,967 ---- info.setNameSourceEnd(pos.getStartOffset() - 1); info.setSourceRangeStart(realStart); ! info.setSourceRangeEnd(pos.getStartOffset() - 10); } *************** *** 950,954 **** // TODO Add more information to the info object! ISourcePosition pos = iVisited.getPosition(); ! setTokenRange(pos, info, name); info.setTypeName(estimateValueType(iVisited.getValueNode())); --- 1003,1008 ---- // TODO Add more information to the info object! ISourcePosition pos = iVisited.getPosition(); ! //setTokenRange(pos, info, name); ! setInstanceVarRange( pos, info, name ); info.setTypeName(estimateValueType(iVisited.getValueNode())); *************** *** 1037,1041 **** --- 1091,1098 ---- RubyFieldElementInfo info = new RubyFieldElementInfo(); info.setTypeName(estimateValueType(iVisited.getValueNode())); + // TODO Set the info! + ISourcePosition pos = iVisited.getPosition(); + setLocalVarRange( pos, info, iVisited.getName() ); infoStack.push(info); |