diff options
Diffstat (limited to 'core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java')
-rw-r--r-- | core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java index fa884ec603f..f9981aee3c7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/ExpressionFinder.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2010 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Institute for Software - initial API and implementation + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Institute for Software - initial API and implementation ******************************************************************************/ package org.eclipse.cdt.internal.ui.refactoring.utils; @@ -27,8 +27,8 @@ import org.eclipse.cdt.internal.ui.refactoring.Container; /** * @author Guido Zgraggen IFS */ -public class ExpressionFinder { - +public class ExpressionFinder { + public static IASTName findExpressionInTranslationUnit(IASTTranslationUnit transUnit, final IIndexName indexName) { final Container<IASTName> expName = new Container<IASTName>(); transUnit.accept(new ASTVisitor() { @@ -40,9 +40,10 @@ public class ExpressionFinder { public int visit(IASTName name) { if (name.isReference() && name.getNodeLocations().length > 0) { IASTNodeLocation nodeLocation = name.getNodeLocations()[0]; - if (indexName.getNodeOffset() == nodeLocation.getNodeOffset() + if (indexName.getNodeOffset() == nodeLocation.getNodeOffset() && indexName.getNodeLength() == nodeLocation.getNodeLength() - && new Path(indexName.getFileLocation().getFileName()).equals(new Path(nodeLocation.asFileLocation().getFileName()))) { + && new Path(indexName.getFileLocation().getFileName()) + .equals(new Path(nodeLocation.asFileLocation().getFileName()))) { expName.setObject(name); return ASTVisitor.PROCESS_ABORT; } |