|
From: <caw...@us...> - 2007-08-21 18:22:00
|
Revision: 3029
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3029&view=rev
Author: cawilliams
Date: 2007-08-21 11:21:55 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
fix #5626 - Add quick fix for method/local naming convention (and move common code to convert camelCase to under_scores into Util class).
Modified Paths:
--------------
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java
Modified: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java 2007-08-21 18:21:51 UTC (rev 3028)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java 2007-08-21 18:21:55 UTC (rev 3029)
@@ -15,6 +15,7 @@
import org.jruby.ast.visitor.rewriter.ReWriteVisitor;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.formatter.Indents;
+import org.rubypeople.rdt.core.util.Util;
import org.rubypeople.rdt.internal.ti.util.ClosestSpanningNodeLocator;
import org.rubypeople.rdt.internal.ti.util.INodeAcceptor;
import org.rubypeople.rdt.internal.ui.rubyeditor.ASTProvider;
@@ -58,13 +59,14 @@
IRubyScript script = context.getRubyScript();
String src = script.getSource();
String constName = src.substring(problem.getOffset(), problem.getOffset() + problem.getLength());
- LocalCorrectionsSubProcessor.addReplacementProposal(constName.toUpperCase(), "Convert to all uppercase", problem, proposals);
+ String fixed = Util.camelCaseToUnderscores(constName).toUpperCase();
+ LocalCorrectionsSubProcessor.addReplacementProposal(fixed, "Convert to UPPERCASE_WITH_UNDERSCORES convention", problem, proposals);
break;
case IProblem.LocalAndMethodNamingConvention:
script = context.getRubyScript();
src = script.getSource();
constName = src.substring(problem.getOffset(), problem.getOffset() + problem.getLength());
- String fixed = constName.toLowerCase(); // FIXME We need to convert in a smarter way!
+ fixed = Util.camelCaseToUnderscores(constName).toLowerCase();
LocalCorrectionsSubProcessor.addReplacementProposal(fixed, "Convert to lowercase_with_undercores convention", problem, proposals);
break;
case IProblem.MethodMissingWithoutRespondTo:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|