From df89c8daab12c02a6db2c3de0b81812331e33c83 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 27 Mar 2011 04:43:53 +0000 Subject: [PATCH] Cosmetics. --- .../eclipse/cdt/core/model/ITranslationUnit.java | 10 ++++------ .../org/eclipse/cdt/internal/formatter/Scribe.java | 2 +- .../ui/preferences/formatter/CPreview.java | 7 ++++--- .../cdt/internal/ui/text/CFormattingStrategy.java | 14 +++++--------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java index f074fa8dded..e6ed15e9394 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITranslationUnit.java @@ -38,7 +38,6 @@ import org.eclipse.core.runtime.IProgressMonitor; * @noextend This interface is not intended to be extended by clients. */ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISourceReference, ISourceManipulation { - /** * Style constant for {@link #getAST(IIndex, int)}. * Meaning: Skip function and method bodies. @@ -140,8 +139,7 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource IInclude createInclude(String name, boolean isStd, ICElement sibling, IProgressMonitor monitor) throws CModelException; /** - * Creates and returns a using declaration/directive in this translation unit - * + * Creates and returns a using declaration/directive in this translation unit. * * @param name the name of the using * @param monitor the progress monitor to notify @@ -154,7 +152,7 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource *
  • The name is not a valid package name (INVALID_NAME) * */ - IUsing createUsing (String name, boolean isDirective, ICElement sibling, IProgressMonitor monitor) throws CModelException; + IUsing createUsing(String name, boolean isDirective, ICElement sibling, IProgressMonitor monitor) throws CModelException; /** * Creates and returns a namespace in this translation unit @@ -171,7 +169,7 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource *
  • The name is not a valid package name (INVALID_NAME) * */ - INamespace createNamespace (String namespace, ICElement sibling, IProgressMonitor monitor) throws CModelException; + INamespace createNamespace(String namespace, ICElement sibling, IProgressMonitor monitor) throws CModelException; /** * Returns the shared working copy for this element, using the default IBuffer @@ -484,7 +482,7 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource /** * @deprecated don't use this method. */ - @Deprecated Map parse(); + @Deprecated Map parse(); /** * @deprecated, use {@link FileContent#create(ITranslationUnit)}, instead. */ diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java index e94b787cf9e..feaea1ef0f5 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java @@ -495,7 +495,7 @@ public class Scribe { public String getNewLine() { if (lastNumberOfNewLines >= 1) { - column= 1; // ensure that the scribe is at the beginning of a new line + column= 1; // Ensure that the scribe is at the beginning of a new line return EMPTY_STRING; } line++; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CPreview.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CPreview.java index 3f81a07039d..3dc01a0ba45 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CPreview.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CPreview.java @@ -146,10 +146,11 @@ public abstract class CPreview { // update the tab size final int tabSize= getPositiveIntValue(fWorkingValues.get(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE), 0); - if (tabSize != fTabSize) fSourceViewer.getTextWidget().setTabs(tabSize); + if (tabSize != fTabSize) + fSourceViewer.getTextWidget().setTabs(tabSize); fTabSize= tabSize; - final StyledText widget= (StyledText)fSourceViewer.getControl(); + final StyledText widget= (StyledText) fSourceViewer.getControl(); final int height= widget.getClientArea().height; final int top0= widget.getTopPixel(); @@ -163,7 +164,7 @@ public abstract class CPreview { final int totalPixels1= getHeightOfAllLines(widget); final int topPixelRange1= totalPixels1 > height ? totalPixels1 - height : 0; - final int top1= topPixelRange0 > 0 ? (int)(topPixelRange1 * top0 / (double)topPixelRange0) : 0; + final int top1= topPixelRange0 > 0 ? (int) (topPixelRange1 * top0 / (double) topPixelRange0) : 0; widget.setTopPixel(top1); widget.setRedraw(true); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java index 72824590e48..120634e4de2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java @@ -33,8 +33,6 @@ import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; * @author AChapiro */ public class CFormattingStrategy extends ContextBasedFormattingStrategy { - - /** Documents to be formatted by this strategy */ private final LinkedList fDocuments= new LinkedList(); /** Partitions to be formatted by this strategy */ @@ -60,7 +58,7 @@ public class CFormattingStrategy extends ContextBasedFormattingStrategy { if (document != null && partition != null) { try { @SuppressWarnings("unchecked") - final Map preferences = getPreferences(); + final Map preferences = getPreferences(); final TextEdit edit = CodeFormatterUtil.format( CodeFormatter.K_TRANSLATION_UNIT, document.get(), partition.getOffset(), partition.getLength(), 0, @@ -69,13 +67,12 @@ public class CFormattingStrategy extends ContextBasedFormattingStrategy { if (edit != null) edit.apply(document); - - } catch (MalformedTreeException exception) { - CUIPlugin.log(exception); - } catch (BadLocationException exception) { + } catch (MalformedTreeException e) { + CUIPlugin.log(e); + } catch (BadLocationException e) { // Can only happen on concurrent document modification - log and // bail out - CUIPlugin.log(exception); + CUIPlugin.log(e); } } } @@ -107,5 +104,4 @@ public class CFormattingStrategy extends ContextBasedFormattingStrategy { fPartitions.clear(); fDocuments.clear(); } - }