From 80c167206d684bd8005031249e525d7ebee4ddec Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 16 Jan 2009 08:36:46 +0000 Subject: [PATCH] Fix warnings --- .../core/settings/model/util/CDataUtil.java | 11 +++++----- .../formatter/CodeFormatterVisitor.java | 20 +++++++------------ .../cdt/internal/ui/text/CIndenter.java | 18 ++++++++--------- .../proposals/TUCorrectionProposal.java | 6 +++--- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java index 1410acb0e1c..9dd3078f546 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2008 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -330,7 +330,7 @@ public class CDataUtil { } else { exts = data.getSourceExtensions(); if(exts != null && exts.length != 0) - exts = (String[])exts.clone(); + exts = exts.clone(); else exts = CDefaultLanguageData.EMPTY_STRING_ARRAY; } @@ -516,7 +516,7 @@ public class CDataUtil { } CLanguageData lDatas[] = data.getLanguageDatas(); for(int i = 0; i < lDatas.length; i++){ - CLanguageData lData = (CLanguageData)lDatas[i]; + CLanguageData lData = lDatas[i]; String langId = lData.getLanguageId(); if(langId != null){ ILanguageDescriptor des = (ILanguageDescriptor)langMap.remove(langId); @@ -732,9 +732,10 @@ public class CDataUtil { for(int i = 0; i < entries.size(); i++){ ICSourceEntry entry = (ICSourceEntry)entries.get(i); entry = include(path, entry); - if(entry != null) + if(entry != null) { entries.set(i, entry); - return i; + return i; + } } return -1; } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index fdfc1355446..e5640793654 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -1590,11 +1590,8 @@ public class CodeFormatterVisitor extends CPPASTVisitor { formatOpeningBrace(preferences.brace_position_for_type_declaration, preferences.insert_space_before_opening_brace_in_type_declaration); final int braceIndent= scribe.numberOfIndentations; - if (true /* preferences.insert_new_line_after_opening_brace_in_enumerator_list */) { - scribe.startNewLine(); - } else if (true /* preferences.insert_space_after_opening_brace_in_enumerator_list */) { - scribe.space(); - } + scribe.startNewLine(); + if (braceIndent == headerIndent) { scribe.indent(); } @@ -1618,11 +1615,8 @@ public class CodeFormatterVisitor extends CPPASTVisitor { if (enumIndent > braceIndent) { scribe.unIndent(); } - if (true /* preferences.insert_new_line_before_closing_brace_in_enumerator_list */) { - scribe.startNewLine(); - } else if (true /* preferences.insert_space_before_closing_brace_in_enumerator_list */) { - scribe.space(); - } + scribe.startNewLine(); + formatClosingBrace(preferences.brace_position_for_type_declaration); return PROCESS_SKIP; } @@ -1758,9 +1752,9 @@ public class CodeFormatterVisitor extends CPPASTVisitor { } } else if (node.isCatchAll()) { scribe.printNextToken(Token.tELIPSE, false /* preferences.insert_space_before_ellipsis */); - if (false /* preferences.insert_space_after_ellipsis */) { - scribe.space(); - } +// if (false /* preferences.insert_space_after_ellipsis */) { +// scribe.space(); +// } } scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_catch); final IASTStatement catchBody= node.getCatchBody(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java index 2c96ab1ddc2..b25ba20ba8a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java @@ -260,17 +260,15 @@ public final class CIndenter { } private boolean prefParenthesisDeepIndent() { - if (true) // don't do parenthesis deep indentation - return false; + // don't do parenthesis deep indentation +// String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION); +// try { +// return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN; +// } catch (IllegalArgumentException e) { +// // ignore and return default +// } - String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION); - try { - return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN; - } catch (IllegalArgumentException e) { - // ignore and return default - } - - return false; // sensible default + return false; } private int prefParenthesisIndent() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java index 1bfcabeb2df..3ec831a2234 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java @@ -119,9 +119,9 @@ public class TUCorrectionProposal extends ChangeCorrectionProposal { * @throws CoreException can be thrown if adding the edits is failing. */ protected void addEdits(IDocument document, TextEdit editRoot) throws CoreException { - if (false) { - throw new CoreException(CUIStatus.createError(IStatus.ERROR, "Implementors can throw an exception", null)); //$NON-NLS-1$ - } +// if (false) { +// throw new CoreException(CUIStatus.createError(IStatus.ERROR, "Implementors can throw an exception", null)); //$NON-NLS-1$ +// } } protected LinkedProposalModel getLinkedProposalModel() {