|
From: <caw...@us...> - 2007-03-15 14:00:56
|
Revision: 2178
http://svn.sourceforge.net/rubyeclipse/?rev=2178&view=rev
Author: cawilliams
Date: 2007-03-15 07:00:55 -0700 (Thu, 15 Mar 2007)
Log Message:
-----------
apply Mirko's tweak to my solution with a little twist, use a StringBuffer rathe rthan create a new document, manipulate it and then grab it's contents.
Now method definitions should get closed when they're outside a class/module.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java 2007-03-15 12:46:53 UTC (rev 2177)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java 2007-03-15 14:00:55 UTC (rev 2178)
@@ -133,12 +133,21 @@
RubyPlugin.log(e1);
}
+ RubyParser parser = new RubyParser();
try {
- RubyParser parser = new RubyParser();
parser.parse(d.get());
} catch (SyntaxException e) {
String msg = e.getMessage();
- return msg.contains("expecting") && (msg.contains("kEND") || msg.contains("kTHEN"));
+ if (msg.contains("expecting") && (msg.contains("kEND") || msg.contains("kTHEN")))
+ return true;
+ try {
+ StringBuffer buffer = new StringBuffer(d.get());
+ buffer.insert(offset, "\n" + BLOCK_CLOSER);
+ parser.parse(buffer.toString());
+ } catch (SyntaxException syntaxException) {
+ return false;
+ }
+ return true;
}
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|