From 14bea542567b9e2d8064a7652c2d7a7458b6805c Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 28 Mar 2014 09:11:46 -0700 Subject: [PATCH] Cosmetics. --- .../model/cfg/ControlFlowGraphBuilder.java | 130 +++++------------- .../cdt/codan/internal/core/cfg/ExitNode.java | 1 - .../cdt/core/dom/ast/IASTUnaryExpression.java | 77 ++++++----- .../ASTAmbiguousBinaryVsCastExpression.java | 5 +- ...AmbiguousCastVsFunctionCallExpression.java | 8 +- .../core/pdom/AbstractIndexerTask.java | 4 +- .../ui/search/CSearchLabelProvider.java | 7 +- .../ui/search/CSearchListContentProvider.java | 2 +- .../cdt/internal/ui/search/CSearchMatch.java | 8 +- .../cdt/internal/ui/search/CSearchPage.java | 4 +- .../cdt/internal/ui/search/CSearchResult.java | 4 +- 11 files changed, 93 insertions(+), 157 deletions(-) diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java index 058ad120e75..8b73c42119a 100644 --- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java +++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/cfg/ControlFlowGraphBuilder.java @@ -6,15 +6,14 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Alena Laskavaia - initial API and implementation - * Tomasz Wesolowski - Bug 348387 + * Alena Laskavaia - initial API and implementation + * Tomasz Wesolowski - Bug 348387 *******************************************************************************/ package org.eclipse.cdt.codan.core.cxx.internal.model.cfg; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.Iterator; import org.eclipse.cdt.codan.core.model.cfg.IBasicBlock; import org.eclipse.cdt.codan.core.model.cfg.IBranchNode; @@ -67,30 +66,26 @@ public class ControlFlowGraphBuilder { CxxNodeFactory factory = new CxxNodeFactory(); IConnectorNode outerBreak; IConnectorNode outerContinue; - HashMap labels = new HashMap(0); + HashMap labels = new HashMap<>(); /** - * @param def - * @return + * Builds the graph. */ public CxxControlFlowGraph build(IASTFunctionDefinition def) { IASTStatement body = def.getBody(); start = new CxxStartNode(); - exits = new ArrayList(); - dead = new ArrayList(); + exits = new ArrayList<>(); + dead = new ArrayList<>(); IBasicBlock last = createSubGraph(start, body); if (!(last instanceof IExitNode) && !deadConnector(last)) { returnExit = factory.createExitNode(null); returnExit.setStartNode(start); addOutgoing(last, returnExit); exits.add(returnExit); - if (dead.size() > 0) { - for (Iterator iterator = dead.iterator(); iterator.hasNext();) { - IBasicBlock ds = iterator.next(); - IBasicBlock dl = findLast(ds); - if (dl != null && dl.getOutgoingSize() == 0 && dl != returnExit) { - ((AbstractBasicBlock) dl).addOutgoing(returnExit); - } + for (IBasicBlock ds : dead) { + IBasicBlock dl = findLast(ds); + if (dl != null && dl.getOutgoingSize() == 0 && dl != returnExit) { + ((AbstractBasicBlock) dl).addOutgoing(returnExit); } } } @@ -99,10 +94,6 @@ public class ControlFlowGraphBuilder { return graph; } - /** - * @param last - * @return - */ private boolean deadConnector(IBasicBlock conn) { if (conn instanceof IJumpNode || conn instanceof IConnectorNode) { if (conn.getIncomingSize() == 0) { @@ -124,7 +115,7 @@ public class ControlFlowGraphBuilder { return false; } - public IBasicBlock findLast(IBasicBlock node) { + private IBasicBlock findLast(IBasicBlock node) { if (node instanceof IJumpNode) return null; if (node.getOutgoingSize() == 0) @@ -137,10 +128,6 @@ public class ControlFlowGraphBuilder { return node; } - /** - * @param start2 - * @param body - */ private IBasicBlock createSubGraph(IBasicBlock prev, IASTNode body) { if (body instanceof IASTCompoundStatement) { IASTCompoundStatement comp = (IASTCompoundStatement) body; @@ -223,11 +210,6 @@ public class ControlFlowGraphBuilder { return prev; } - /** - * @param prev - * @param body - * @return - */ private IBasicBlock createTry(IBasicBlock prev, ICPPASTTryBlockStatement body) { DecisionNode ifNode = factory.createDecisionNode(body); addOutgoing(prev, ifNode); @@ -254,10 +236,6 @@ public class ControlFlowGraphBuilder { return mergeNode; } - /** - * @param body - * @return - */ private boolean isThrowStatement(IASTNode body) { if (!(body instanceof IASTExpressionStatement)) return false; @@ -277,11 +255,6 @@ public class ControlFlowGraphBuilder { return functionNameExpression.getRawSignature().equals("exit"); //$NON-NLS-1$ } - /** - * @param prev - * @param body - * @return - */ protected CxxExitNode createExitNode(IBasicBlock prev, IASTNode body) { CxxExitNode node = factory.createExitNode(body); node.setStartNode(start); @@ -290,11 +263,6 @@ public class ControlFlowGraphBuilder { return node; } - /** - * @param prev - * @param labelName - * @return - */ protected IConnectorNode createLabelNodes(IBasicBlock prev, String labelName) { IBranchNode branch = factory.createBranchNode(labelName); if (prev != null) @@ -305,11 +273,6 @@ public class ControlFlowGraphBuilder { return conn; } - /** - * @param prev - * @param body - * @return - */ protected IBasicBlock createIf(IBasicBlock prev, IASTIfStatement body) { DecisionNode ifNode = factory.createDecisionNode(body.getConditionExpression()); addOutgoing(prev, ifNode); @@ -326,11 +289,6 @@ public class ControlFlowGraphBuilder { return mergeNode; } - /** - * @param prev - * @param body - * @return - */ private IBasicBlock createSwitch(IBasicBlock prev, IASTSwitchStatement body) { DecisionNode node = factory.createDecisionNode(body.getControllerExpression()); addOutgoing(prev, node); @@ -340,12 +298,6 @@ public class ControlFlowGraphBuilder { return conn; } - /** - * @param switchNode - * @param mergeNode - * @param def - * @param body - */ private void createSwitchBody(DecisionNode switchNode, IConnectorNode mergeNode, IASTStatement body) { if (!(body instanceof IASTCompoundStatement)) return; // bad @@ -383,29 +335,24 @@ public class ControlFlowGraphBuilder { addJump(prev, mergeNode); } - /** - * @param prev - * @param forNode - * @return - */ private IBasicBlock createFor(IBasicBlock prev, IASTForStatement forNode) { - // add initializer + // Add initializer IPlainNode init = factory.createPlainNode(forNode.getInitializerStatement()); addOutgoing(prev, init); prev = init; - // add continue connector + // Add continue connector IConnectorNode beforeCheck = factory.createConnectorNode(); addOutgoing(prev, beforeCheck); - // decision node + // Decision node CxxDecisionNode decision = factory.createDecisionNode(forNode.getConditionExpression()); addOutgoing(beforeCheck, decision); - // add break connector + // Add break connector IConnectorNode nBreak = factory.createConnectorNode(); decision.setMergeNode(nBreak); - // create body and jump to continue node + // Create body and jump to continue node IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN); addOutgoing(decision, loopStart); - // set break/continue + // Set break/continue IConnectorNode nContinue = factory.createConnectorNode(); IConnectorNode savedContinue = outerContinue; IConnectorNode savedBreak = outerBreak; @@ -418,45 +365,40 @@ public class ControlFlowGraphBuilder { IPlainNode inc = factory.createPlainNode(forNode.getIterationExpression()); addOutgoing(endBody, nContinue); addOutgoing(nContinue, inc); - // connect with backward link + // Connect with backward link addJump(inc, beforeCheck, true); - // add "else" branch + // Add "else" branch IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE); addOutgoing(decision, loopEnd); addJump(loopEnd, nBreak); return nBreak; } - /** - * @param prev - * @param body - * @return - */ protected IBasicBlock createWhile(IBasicBlock prev, IASTWhileStatement body) { - // add continue connector + // Add continue connector IConnectorNode nContinue = factory.createConnectorNode(); addOutgoing(prev, nContinue); - // decision node + // Decision node CxxDecisionNode decision = factory.createDecisionNode(body.getCondition()); addOutgoing(nContinue, decision); - // add break connector + // Add break connector IConnectorNode nBreak = factory.createConnectorNode(); decision.setMergeNode(nBreak); - // create body and jump to continue node + // Create body and jump to continue node IBranchNode loopStart = factory.createBranchNode(IBranchNode.THEN); addOutgoing(decision, loopStart); - // set break/continue + // Set break/continue IConnectorNode savedContinue = outerContinue; IConnectorNode savedBreak = outerBreak; outerContinue = nContinue; outerBreak = nBreak; IBasicBlock endBody = createSubGraph(loopStart, body.getBody()); - // restore + // Restore outerContinue = savedContinue; outerBreak = savedBreak; - // backward jump + // Backward jump addJump(endBody, nContinue, true); - // connect with else branch + // Connect with else branch IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE); addOutgoing(decision, loopEnd); addJump(loopEnd, nBreak); @@ -464,7 +406,7 @@ public class ControlFlowGraphBuilder { } protected IBasicBlock createDoWhile(IBasicBlock prev, IASTDoStatement body) { - // create body and jump to continue node + // Create body and jump to continue node IConnectorNode loopStart = factory.createConnectorNode(); addOutgoing(prev, loopStart); // continue/break @@ -475,12 +417,12 @@ public class ControlFlowGraphBuilder { outerContinue = nContinue; outerBreak = nBreak; IBasicBlock endBody = createSubGraph(loopStart, body.getBody()); - // restore + // Restore outerContinue = savedContinue; outerBreak = savedBreak; - // add continue connector + // Add continue connector addOutgoing(endBody, nContinue); - // decision node + // Decision node CxxDecisionNode decision = factory.createDecisionNode(body.getCondition()); addOutgoing(nContinue, decision); // then branch @@ -489,12 +431,12 @@ public class ControlFlowGraphBuilder { IJumpNode jumpToStart = factory.createJumpNode(); addOutgoing(thenNode, jumpToStart); ((JumpNode) jumpToStart).setBackward(true); - // connect with backward link + // Connect with backward link addOutgoing(jumpToStart, loopStart); - // connect with else branch + // Connect with else branch IBranchNode loopEnd = factory.createBranchNode(IBranchNode.ELSE); addOutgoing(decision, loopEnd); - // add break connector + // Add break connector decision.setMergeNode(nBreak); addJump(loopEnd, nBreak); return nBreak; @@ -516,10 +458,6 @@ public class ControlFlowGraphBuilder { return jump; } - /** - * @param prev - * @param node - */ private void addOutgoing(IBasicBlock prev, IBasicBlock node) { if (prev instanceof IExitNode || prev == null) { dead.add(node); diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/ExitNode.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/ExitNode.java index e318576cd90..48033136584 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/ExitNode.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/cfg/ExitNode.java @@ -16,7 +16,6 @@ import org.eclipse.cdt.codan.core.model.cfg.IStartNode; /** * Plain node has one prev one jump - * */ public class ExitNode extends AbstractSingleIncomingNode implements IExitNode { private IStartNode start; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java index 919ac7a9814..de04aa6ec1d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java @@ -19,83 +19,83 @@ package org.eclipse.cdt.core.dom.ast; public interface IASTUnaryExpression extends IASTExpression { /** * Prefix increment. - * op_prefixIncr ++exp + * {@code op_prefixIncr}: ++exp */ public static final int op_prefixIncr = 0; /** * Prefix decrement. - * op_prefixDecr --exp + * {@code op_prefixDecr}: --exp */ public static final int op_prefixDecr = 1; /** * Operator plus. - * op_plus ==> +exp + * {@code op_plus}: +exp */ public static final int op_plus = 2; /** * Operator minus. - * op_minux ==> -exp + * {@code op_minux}: -exp */ public static final int op_minus = 3; /** * Operator star. - * op_star ==> *exp + * {@code op_star}: *exp */ public static final int op_star = 4; /** * Operator ampersand. - * op_amper ==> &exp + * {@code op_amper}: &exp */ public static final int op_amper = 5; /** * Operator tilde. - * op_tilde ==> ~exp + * {@code op_tilde}: ~exp */ public static final int op_tilde = 6; /** * not. - * op_not ==> ! exp + * {@code op_not}: !exp */ public static final int op_not = 7; /** * sizeof. - * op_sizeof ==> sizeof exp + * {@code op_sizeof}: sizeof exp */ public static final int op_sizeof = 8; /** * Postfix increment. - * op_postFixIncr ==> exp++ + * {@code op_postFixIncr}: exp++ */ public static final int op_postFixIncr = 9; /** * Postfix decrement. - * op_bracketedPrimary ==> exp-- + * {@code op_postFixDecr}: exp-- */ public static final int op_postFixDecr = 10; /** * A bracketed expression. - * op_bracketedPrimary ==> ( exp ) + * {@code op_bracketedPrimary}: ( exp ) */ public static final int op_bracketedPrimary = 11; /** - * for c++, only. op_throw throw exp + * For C++, only. {@code op_throw}: throw exp */ public static final int op_throw = 12; /** - * for c++, only. op_typeid = typeid( exp ) + * For C++, only. {@code op_typeid}: typeid( exp ) */ public static final int op_typeid = 13; @@ -106,62 +106,63 @@ public interface IASTUnaryExpression extends IASTExpression { public static final int op_typeof = 14; /** - * For gnu parsers, only. op_alignOf is used for __alignOf( unaryExpression ) type + * For GCC parsers, only. {@code op_alignOf} is used for __alignOf( unaryExpression ) type * expressions. */ public static final int op_alignOf = 15; /** - * For c++, only: 'sizeof... ( parameterPack )' + * For C++, only: 'sizeof... ( parameterPack )' * @since 5.2 */ public static final int op_sizeofParameterPack = 16; /** - * For c++, only: noexcept ( expression ) + * For C++, only: noexcept ( expression ) * @since 5.5 */ public static final int op_noexcept = 17; /** - * op_last is made available for subclasses. + * {@code op_last} is made available for subclasses. * @deprecated all constants must be defined in this interface */ @Deprecated public static final int op_last = op_alignOf; /** - * Get the operator/kind. - * - * @return (int) - */ - public int getOperator(); - - /** - * Set the operator/kind. - * - * @param value (int) value - */ - public void setOperator(int value); - - /** - * OPERAND represents the relationship between an IASTUnaryExpression and - * it's nested IASTExpression. + * {@code OPERAND} represents the relationship between an {@code IASTUnaryExpression} and + * it's nested {@code IASTExpression}. */ public static final ASTNodeProperty OPERAND = new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$ + /** - * Get the operand. + * Returns the operator/kind. * - * @return IASTExpression + * @return the operator, one of {@code op_*} constants defined in this interface. + */ + public int getOperator(); + + /** + * Sets the operator/kind. + * + * @param operator the operator, one of {@code op_*} constants defined in this interface. + */ + public void setOperator(int operator); + + /** + * Returns the operand. + * + * @return {@code IASTExpression} */ public IASTExpression getOperand(); /** - * Set the operand. + * Sets the operand. * - * @param expression IASTExpression + * @param expression {@code IASTExpression} */ public void setOperand(IASTExpression expression); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousBinaryVsCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousBinaryVsCastExpression.java index 91b92405adf..e001e8dd48d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousBinaryVsCastExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousBinaryVsCastExpression.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - Initial API and implementation + * Markus Schorn - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser; @@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding; * It also handles the impact on the grouping of the sub-expressions. */ public abstract class ASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression { - private final IASTBinaryExpression fBinaryExpression; private final IASTCastExpression fCastExpression; @@ -113,7 +112,7 @@ public abstract class ASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousNod if (primaryInParenthesis != null && leadingCastExpression != null && castedUnary instanceof IASTUnaryExpression) { IASTExpression lp= (IASTExpression) primaryInParenthesis.getParent(); IASTBinaryExpression rp= (IASTBinaryExpression) leadingCastExpression.getParent(); - ((IASTUnaryExpression)castedUnary).setOperand(leadingCastExpression); + ((IASTUnaryExpression) castedUnary).setOperand(leadingCastExpression); setEnd(castedUnary, leadingCastExpression); setRange(fCastExpression, primaryInParenthesis, leadingCastExpression); IASTExpression root= joinExpressions(lp, fCastExpression, rp); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousCastVsFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousCastVsFunctionCallExpression.java index 873e540bd39..842a2c6a03d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousCastVsFunctionCallExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAmbiguousCastVsFunctionCallExpression.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - Initial API and implementation + * Markus Schorn - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser; @@ -29,7 +29,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding; * It also handles the impact on the grouping of the sub-expressions. */ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression { - private final IASTCastExpression fCastExpression; private final IASTFunctionCallExpression fFunctionCallExpression; @@ -158,7 +157,7 @@ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbigu } owner.replace(nodeToReplace, result); - // resolve ambiguities in the function-call expression + // Resolve ambiguities in the function-call expression fFunctionCallExpression.getFunctionNameExpression().accept(visitor); return result; } @@ -177,8 +176,7 @@ public abstract class ASTAmbiguousCastVsFunctionCallExpression extends ASTAmbigu default: return null; } - } - else if (operand instanceof IASTArraySubscriptExpression) { + } else if (operand instanceof IASTArraySubscriptExpression) { operand= ((IASTArraySubscriptExpression) operand).getArrayExpression(); } else if (operand instanceof IASTFunctionCallExpression) { operand= ((IASTFunctionCallExpression) operand).getFunctionNameExpression(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index 039e6b3cc66..f1a186946ab 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -1114,13 +1114,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter { * swallow this one. */ if (e instanceof CoreException) { - s=((CoreException) e).getStatus(); + s= ((CoreException) e).getStatus(); if (s.getCode() == CCorePlugin.STATUS_PDOM_TOO_LARGE) { if (CCorePlugin.PLUGIN_ID.equals(s.getPlugin())) throw (CoreException) e; } - // mask errors in order to avoid dialog from platform + // Mask errors in order to avoid dialog from platform Throwable exception = s.getException(); if (exception != null) { Throwable masked= getMaskedException(exception); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchLabelProvider.java index 99dd322c622..144ae46e5f0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchLabelProvider.java @@ -116,9 +116,8 @@ public class CSearchLabelProvider extends LabelProvider implements IStyledLabelP } if (element instanceof TypeInfoSearchElement) { - return fTypeInfoLabelProvider.getText(((TypeInfoSearchElement)element).getTypeInfo()); - } - else if (element instanceof ProblemSearchElement) { + return fTypeInfoLabelProvider.getText(((TypeInfoSearchElement) element).getTypeInfo()); + } else if (element instanceof ProblemSearchElement) { ProblemSearchElement pse= (ProblemSearchElement) element; return ASTProblem.getMessage(pse.getProblemID(), pse.getDetail()); } @@ -128,7 +127,7 @@ public class CSearchLabelProvider extends LabelProvider implements IStyledLabelP } if (element instanceof IIndexFileLocation) { - IPath path= IndexLocationFactory.getPath((IIndexFileLocation)element); + IPath path= IndexLocationFactory.getPath((IIndexFileLocation) element); if (path != null) { // these are categorized into directories already return path.lastSegment(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java index 606354f1c5a..226d3aced7d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchListContentProvider.java @@ -70,7 +70,7 @@ public class CSearchListContentProvider implements IStructuredContentProvider, I } // add message for all the projects which have no results - ICProject[] projects = ((CSearchQuery)result.getQuery()).getProjects(); + ICProject[] projects = ((CSearchQuery) result.getQuery()).getProjects(); for (int i = 0; i < projects.length; ++i) { ICProject project = projects[i]; boolean foundProject = uncoveredProjects.contains(project.getProject().getName()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMatch.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMatch.java index c5d25c66b02..ba3ad1cd3b3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMatch.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMatch.java @@ -26,7 +26,7 @@ public class CSearchMatch extends Match { } IIndexFileLocation getLocation() { - return ((CSearchElement)getElement()).getLocation(); + return ((CSearchElement) getElement()).getLocation(); } @Override @@ -35,10 +35,10 @@ public class CSearchMatch extends Match { return true; if (!(obj instanceof CSearchMatch)) return false; - CSearchMatch other = (CSearchMatch)obj; + CSearchMatch other = (CSearchMatch) obj; return getElement().equals(other.getElement()) - && getOffset() == other.getOffset() - && getLength() == other.getLength(); + && getOffset() == other.getOffset() + && getLength() == other.getLength(); } public void setIsPolymorphicCall() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java index d74be81575f..3191200469c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java @@ -159,7 +159,7 @@ public class CSearchPage extends DialogPage implements ISearchPage { private ICElement getElement(Object obj) { if (obj instanceof IResource) { - return CoreModel.getDefault().create((IResource)obj); + return CoreModel.getDefault().create((IResource) obj); } if (obj instanceof ICElement) { ICElement elem= (ICElement) obj; @@ -190,7 +190,7 @@ public class CSearchPage extends DialogPage implements ISearchPage { } else { for (int i = 0; i < searchForButtons.length; ++i) { if (searchForButtons[i].getSelection()) - searchFlags |= ((Integer)searchForButtons[i].getData()).intValue(); + searchFlags |= ((Integer) searchForButtons[i].getData()).intValue(); } } for (int i = 0; i < limitToButtons.length; ++i) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java index 907427f7fef..c1e17273238 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java @@ -158,7 +158,9 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa if (location.getFullPath() != null) { return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath())); } - } catch(CoreException ce) { /* fall-through to return null */ } + } catch (CoreException e) { + // Fall-through to return null. + } } else if (element instanceof CSearchElement) { CSearchElement searchElement = (CSearchElement) element; IIndexFileLocation location = searchElement.getLocation();