X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java index 64ac2fe..60aaeb0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/spelling/WordCorrectionProposal.java @@ -30,27 +30,29 @@ import org.eclipse.swt.graphics.Point; * * @since 3.0 */ -public class WordCorrectionProposal implements IPHPCompletionProposal, IHtmlTagConstants { +public class WordCorrectionProposal implements IPHPCompletionProposal, + IHtmlTagConstants { /** * Returns the html representation of the specified string. * * @param string - * The string to return the html representation for + * The string to return the html representation for * @return The html representation for the string */ public static String getHtmlRepresentation(final String string) { - final int length= string.length(); - final StringBuffer buffer= new StringBuffer(string); + final int length = string.length(); + final StringBuffer buffer = new StringBuffer(string); - for (int offset= length - 1; offset >= 0; offset--) { + for (int offset = length - 1; offset >= 0; offset--) { - for (int index= 0; index < HTML_ENTITY_CHARACTERS.length; index++) { + for (int index = 0; index < HTML_ENTITY_CHARACTERS.length; index++) { if (string.charAt(offset) == HTML_ENTITY_CHARACTERS[index]) { - buffer.replace(offset, offset + 1, String.valueOf(HTML_ENTITY_CODES[index])); + buffer.replace(offset, offset + 1, String + .valueOf(HTML_ENTITY_CODES[index])); break; } } @@ -80,28 +82,32 @@ public class WordCorrectionProposal implements IPHPCompletionProposal, IHtmlTagC * Creates a new word correction proposal. * * @param word - * The corrected word + * The corrected word * @param arguments - * The problem arguments associated with the spelling problem + * The problem arguments associated with the spelling problem * @param offset - * The offset in the document where to apply the proposal + * The offset in the document where to apply the proposal * @param length - * The lenght in the document to apply the proposal + * The lenght in the document to apply the proposal * @param context - * The invocation context for this proposal + * The invocation context for this proposal * @param relevance - * The relevance of this proposal + * The relevance of this proposal */ - public WordCorrectionProposal(final String word, final String[] arguments, final int offset, final int length, final IInvocationContext context, final int relevance) { + public WordCorrectionProposal(final String word, final String[] arguments, + final int offset, final int length, + final IInvocationContext context, final int relevance) { - fWord= Character.isUpperCase(arguments[0].charAt(0)) ? Character.toUpperCase(word.charAt(0)) + word.substring(1) : word; + fWord = Character.isUpperCase(arguments[0].charAt(0)) ? Character + .toUpperCase(word.charAt(0)) + + word.substring(1) : word; - fOffset= offset; - fLength= length; - fContext= context; - fRelevance= relevance; + fOffset = offset; + fLength = length; + fContext = context; + fRelevance = relevance; - final StringBuffer buffer= new StringBuffer(80); + final StringBuffer buffer = new StringBuffer(80); buffer.append("...
"); //$NON-NLS-1$ buffer.append(getHtmlRepresentation(arguments[1])); @@ -111,7 +117,7 @@ public class WordCorrectionProposal implements IPHPCompletionProposal, IHtmlTagC buffer.append(getHtmlRepresentation(arguments[2])); buffer.append("
..."); //$NON-NLS-1$ - fLine= buffer.toString(); + fLine = buffer.toString(); } /* @@ -143,7 +149,8 @@ public class WordCorrectionProposal implements IPHPCompletionProposal, IHtmlTagC * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getDisplayString() */ public String getDisplayString() { - return MessageFormat.format(PHPUIMessages.getString("Spelling.correct.label"), new String[] { fWord }); //$NON-NLS-1$ + return MessageFormat.format(PHPUIMessages + .getString("Spelling.correct.label"), new String[] { fWord }); //$NON-NLS-1$ } /* @@ -165,10 +172,10 @@ public class WordCorrectionProposal implements IPHPCompletionProposal, IHtmlTagC */ public final Point getSelection(final IDocument document) { - int offset= fContext.getSelectionOffset(); - int length= fContext.getSelectionLength(); + int offset = fContext.getSelectionOffset(); + int length = fContext.getSelectionLength(); - final int delta= fWord.length() - fLength; + final int delta = fWord.length() - fLength; if (offset <= fOffset && offset + length >= fOffset) length += delta; else if (offset > fOffset && offset + length > fOffset + fLength) {