Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 43963 Details for
Bug 145544
Comment indentation wrong when using sun conventions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
org.eclipse.jdt.core.diff
org.eclipse.jdt.core.diff (text/plain), 4.38 KB, created by
Tom Hofmann
on 2006-06-09 04:41:56 EDT
(
hide
)
Description:
org.eclipse.jdt.core.diff
Filename:
MIME Type:
Creator:
Tom Hofmann
Created:
2006-06-09 04:41:56 EDT
Size:
4.38 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/comment/CommentRegion.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/CommentRegion.java,v >retrieving revision 1.4 >diff -u -r1.4 CommentRegion.java >--- formatter/org/eclipse/jdt/internal/formatter/comment/CommentRegion.java 29 Mar 2006 03:00:05 -0000 1.4 >+++ formatter/org/eclipse/jdt/internal/formatter/comment/CommentRegion.java 9 Jun 2006 08:43:28 -0000 >@@ -14,6 +14,8 @@ > import java.util.Iterator; > import java.util.LinkedList; > >+import org.eclipse.core.runtime.Assert; >+ > import org.eclipse.text.edits.MalformedTreeException; > import org.eclipse.text.edits.TextEdit; > >@@ -69,12 +71,6 @@ > /** Number of spaces representing tabulator */ > private int fTabSize; > >- /** >- * <code>true</code> if tabs, not spaces, should be used for indentation >- * @since 3.1 >- */ >- private boolean fUseTab; >- > /** the scribe used to create edits */ > protected Scribe scribe; > >@@ -94,8 +90,7 @@ > > fClear= this.preferences.comment_clear_blank_lines; > >- fTabSize= this.preferences.tab_size; >- fUseTab = this.preferences.tab_char == DefaultCodeFormatterOptions.TAB; >+ fTabSize= DefaultCodeFormatterOptions.SPACE == this.preferences.tab_char ? this.preferences.indentation_size : this.preferences.tab_size; > > this.scribe = formatter.scribe; > >@@ -426,7 +421,21 @@ > * @since 3.1 > */ > private String computeIndentation(int indentationLevel) { >- return replicate(fUseTab ? "\t" : replicate(" ", fTabSize), indentationLevel); //$NON-NLS-1$//$NON-NLS-2$ >+ if (DefaultCodeFormatterOptions.TAB == this.preferences.tab_char) >+ return replicate("\t", indentationLevel); //$NON-NLS-1$ >+ >+ if (DefaultCodeFormatterOptions.SPACE == this.preferences.tab_char) >+ return replicate(" ", indentationLevel * this.preferences.tab_size); //$NON-NLS-1$ >+ >+ if (DefaultCodeFormatterOptions.MIXED == this.preferences.tab_char) { >+ int tabSize= this.preferences.tab_size; >+ int indentSize= this.preferences.indentation_size; >+ int spaceEquivalents= indentationLevel * indentSize; >+ return replicate("\t", spaceEquivalents / tabSize) + replicate(" ", spaceEquivalents % tabSize); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ Assert.isTrue(false); >+ return null; > } > > /** >@@ -448,35 +457,10 @@ > * Computes the equivalent indentation for a string > * > * @param reference the string to compute the indentation for >- * @param tabs <code>true</code> iff the indentation should use tabs, >- * <code>false</code> otherwise. > * @return the indentation string > */ >- protected final String stringToIndent(final String reference, final boolean tabs) { >- >- int spaceWidth= 1; >- int referenceWidth= expandTabs(reference).length(); >- >- final StringBuffer buffer= new StringBuffer(); >- final int spaces= referenceWidth / spaceWidth; >- >- if (tabs) { >- >- final int count= spaces / fTabSize; >- final int modulo= spaces % fTabSize; >- >- for (int index= 0; index < count; index++) >- buffer.append('\t'); >- >- for (int index= 0; index < modulo; index++) >- buffer.append(' '); >- >- } else { >- >- for (int index= 0; index < spaces; index++) >- buffer.append(' '); >- } >- return buffer.toString(); >+ protected final String stringToIndent(final String reference) { >+ return replicate(" ", stringToLength(reference)); //$NON-NLS-1$ > } > > /** >Index: formatter/org/eclipse/jdt/internal/formatter/comment/MultiCommentRegion.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/MultiCommentRegion.java,v >retrieving revision 1.3 >diff -u -r1.3 MultiCommentRegion.java >--- formatter/org/eclipse/jdt/internal/formatter/comment/MultiCommentRegion.java 10 May 2006 18:03:41 -0000 1.3 >+++ formatter/org/eclipse/jdt/internal/formatter/comment/MultiCommentRegion.java 9 Jun 2006 08:43:28 -0000 >@@ -139,7 +139,7 @@ > return delimiter + delimiter; > > else if (fIndentRoots && !predecessor.hasAttribute(COMMENT_ROOT) && !predecessor.hasAttribute(COMMENT_PARAMETER) && !predecessor.hasAttribute(COMMENT_BLANKLINE)) >- return delimiter + stringToIndent(predecessor.getIndentationReference(), false); >+ return delimiter + stringToIndent(predecessor.getIndentationReference()); > } > return delimiter; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 145544
:
43592
| 43963