|
From: <caw...@us...> - 2007-05-08 14:12:35
|
Revision: 2447
http://svn.sourceforge.net/rubyeclipse/?rev=2447&view=rev
Author: cawilliams
Date: 2007-05-08 07:12:34 -0700 (Tue, 08 May 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-05-08 14:12:07 UTC (rev 2446)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-05-08 14:12:34 UTC (rev 2447)
@@ -659,6 +659,7 @@
*/
public IType findPrimaryType() {
String typeName = Util.getNameWithoutRubyLikeExtension(getElementName());
+ typeName = Util.identifierToConstant(typeName);
IType primaryType= getType(typeName);
if (primaryType.exists()) {
return primaryType;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-05-08 14:12:07 UTC (rev 2446)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-05-08 14:12:34 UTC (rev 2447)
@@ -1018,4 +1018,20 @@
return copy;
}
+ public static String identifierToConstant(String typeName) {
+ StringBuffer buffer = new StringBuffer();
+ boolean doNextAsUpper = true;
+ for (int i = 0; i < typeName.length(); i++) {
+ char c = typeName.charAt(i);
+ if (doNextAsUpper) {
+ buffer.append(Character.toUpperCase(c));
+ doNextAsUpper = false;
+ } else if (c == '_') {
+ doNextAsUpper = true;
+ } else {
+ buffer.append(c);
+ }
+ }
+ return buffer.toString();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|