|
From: <caw...@us...> - 2007-07-10 19:44:59
|
Revision: 2742
http://svn.sourceforge.net/rubyeclipse/?rev=2742&view=rev
Author: cawilliams
Date: 2007-07-10 11:38:06 -0700 (Tue, 10 Jul 2007)
Log Message:
-----------
fix #5141 - Generated class stub from Ruby ClassWizard has odd spacing
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-07-10 18:32:09 UTC (rev 2741)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/NewTypeWizardPage.java 2007-07-10 18:38:06 UTC (rev 2742)
@@ -662,14 +662,15 @@
RubyModelUtil.reconcile(cu);
- ISourceRange range= createdType.getSourceRange();
-
+ ISourceRange range= createdType.getSourceRange(); // FIXME The source range seems to be off by one... We have a workaround here, but need to fix it in IType
+ int length = range.getLength();
+ if (lineDelimiter.length() > 1) length++;
IBuffer buf= cu.getBuffer();
- String originalContent= buf.getText(range.getOffset(), range.getLength());
+ String originalContent= buf.getText(range.getOffset(), length);
String formattedContent= CodeFormatterUtil.format(CodeFormatter.K_CLASS_BODY_DECLARATIONS, originalContent, indent, null, lineDelimiter, pack.getRubyProject());
// formattedContent= Strings.trimLeadingTabsAndSpaces(formattedContent);
- buf.replace(range.getOffset(), range.getLength(), formattedContent);
+ buf.replace(range.getOffset(), length, formattedContent);
fCreatedType= createdType;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|