|
From: <mir...@us...> - 2007-02-28 13:35:10
|
Revision: 2055
http://svn.sourceforge.net/rubyeclipse/?rev=2055&view=rev
Author: mirkostocker
Date: 2007-02-28 05:35:02 -0800 (Wed, 28 Feb 2007)
Log Message:
-----------
Replace the code that checks for a valid class name with a regex. The previous implementation didn't work correctly and was more complicated.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-02-28 13:16:56 UTC (rev 2054)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-02-28 13:35:02 UTC (rev 2055)
@@ -864,17 +864,11 @@
private boolean isConstant(String className) {
if (className == null || className.length() == 0) return false;
- if (!Character.isLowerCase(className.charAt(0)) && !Character.isLetter(className.charAt(0)))
- return false;
int namespaceDelimeterIndex = className.indexOf("::");
if (namespaceDelimeterIndex != -1) {
return isConstant(className.substring(0, namespaceDelimeterIndex)) && isConstant(className.substring(namespaceDelimeterIndex+2));
}
- for (int i = 0; i < className.length(); i++) {
- char c = className.charAt(i);
- if (!Character.isLetterOrDigit(c) && c != '_') return false;
- }
- return true;
+ return className.matches("^[A-Z]\\w*");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|