mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
46b2750a00
commit
f83cf7403d
1 changed files with 6 additions and 7 deletions
|
@ -9,7 +9,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.utils;
|
package org.eclipse.cdt.internal.ui.refactoring.utils;
|
||||||
|
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
@ -39,11 +38,11 @@ import org.eclipse.cdt.internal.ui.refactoring.Container;
|
||||||
* Helper class to find definitions.
|
* Helper class to find definitions.
|
||||||
*
|
*
|
||||||
* @author Lukas Felber
|
* @author Lukas Felber
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefinitionFinder {
|
public class DefinitionFinder {
|
||||||
|
|
||||||
public static IASTName getDefinition(IASTSimpleDeclaration simpleDeclaration, IFile file) throws CoreException{
|
public static IASTName getDefinition(IASTSimpleDeclaration simpleDeclaration, IFile file)
|
||||||
|
throws CoreException{
|
||||||
IASTDeclarator declarator = simpleDeclaration.getDeclarators()[0];
|
IASTDeclarator declarator = simpleDeclaration.getDeclarators()[0];
|
||||||
IBinding resolveBinding = declarator.getName().resolveBinding();
|
IBinding resolveBinding = declarator.getName().resolveBinding();
|
||||||
return DefinitionFinder.getDefinition(declarator.getName(), resolveBinding, file);
|
return DefinitionFinder.getDefinition(declarator.getName(), resolveBinding, file);
|
||||||
|
@ -65,12 +64,11 @@ public class DefinitionFinder {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
pdomref= index.findDefinitions(bind);
|
pdomref= index.findDefinitions(bind);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdomref==null || pdomref.length < 1) {
|
if (pdomref == null || pdomref.length < 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +82,8 @@ public class DefinitionFinder {
|
||||||
return findDefinitionInTranslationUnit(transUnit, pdomref[0]);
|
return findDefinitionInTranslationUnit(transUnit, pdomref[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IASTName findDefinitionInTranslationUnit(IASTTranslationUnit transUnit, final IIndexName indexName) {
|
private static IASTName findDefinitionInTranslationUnit(IASTTranslationUnit transUnit,
|
||||||
|
final IIndexName indexName) {
|
||||||
final Container<IASTName> defName = new Container<IASTName>();
|
final Container<IASTName> defName = new Container<IASTName>();
|
||||||
transUnit.accept(new ASTVisitor() {
|
transUnit.accept(new ASTVisitor() {
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue