mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
0f416da87c
commit
6c11ab94ca
1 changed files with 17 additions and 14 deletions
|
@ -46,19 +46,22 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.NodeHelper;
|
||||||
* @author Mirko Stocker, Lukas Felber
|
* @author Mirko Stocker, Lukas Felber
|
||||||
*/
|
*/
|
||||||
public class MethodDefinitionInsertLocationFinder2 {
|
public class MethodDefinitionInsertLocationFinder2 {
|
||||||
|
// We cache DefinitionFinder2.getDefinition results because refactorings like Implement Method
|
||||||
// We cache DefinitionFinder2.getDefinition results because refactorings like Implement Method might want to find multiple
|
// might want to find multiple insert locations in the same translation unit. This prevents
|
||||||
// insert locations in the same translation unit. This prevents many redundant calls to DefinitionFinder2.getDefinition
|
// many redundant calls to DefinitionFinder2.getDefinition and speeds up the process quite
|
||||||
// and speeds up the process quite a bit. Unfortunately, this has the minor side-effect or having to instantiate this class.
|
//a bit. Unfortunately, this has the minor side-effect or having to instantiate this class.
|
||||||
Map<IASTSimpleDeclaration, IASTName> cachedDeclarationToDefinition = new HashMap<IASTSimpleDeclaration, IASTName>();
|
Map<IASTSimpleDeclaration, IASTName> cachedDeclarationToDefinition =
|
||||||
|
new HashMap<IASTSimpleDeclaration, IASTName>();
|
||||||
|
|
||||||
public InsertLocation2 find(ITranslationUnit declarationTu, IASTFileLocation methodDeclarationLocation,
|
public InsertLocation2 find(ITranslationUnit declarationTu, IASTFileLocation methodDeclarationLocation,
|
||||||
IASTNode parent, RefactoringASTCache astCache, IProgressMonitor pm) throws CoreException {
|
IASTNode parent, RefactoringASTCache astCache, IProgressMonitor pm) throws CoreException {
|
||||||
IASTDeclaration[] declarations = NodeHelper.getDeclarations(parent);
|
IASTDeclaration[] declarations = NodeHelper.getDeclarations(parent);
|
||||||
InsertLocation2 insertLocation = new InsertLocation2();
|
InsertLocation2 insertLocation = new InsertLocation2();
|
||||||
|
|
||||||
Collection<IASTSimpleDeclaration> allPreviousSimpleDeclarationsFromClassInReverseOrder = getAllPreviousSimpleDeclarationsFromClassInReverseOrder(declarations, methodDeclarationLocation, pm);
|
Collection<IASTSimpleDeclaration> allPreviousSimpleDeclarationsFromClassInReverseOrder =
|
||||||
Collection<IASTSimpleDeclaration> allFollowingSimpleDeclarationsFromClass = getAllFollowingSimpleDeclarationsFromClass(declarations, methodDeclarationLocation, pm);
|
getAllPreviousSimpleDeclarationsFromClassInReverseOrder(declarations, methodDeclarationLocation, pm);
|
||||||
|
Collection<IASTSimpleDeclaration> allFollowingSimpleDeclarationsFromClass =
|
||||||
|
getAllFollowingSimpleDeclarationsFromClass(declarations, methodDeclarationLocation, pm);
|
||||||
|
|
||||||
for (IASTSimpleDeclaration simpleDeclaration : allPreviousSimpleDeclarationsFromClassInReverseOrder) {
|
for (IASTSimpleDeclaration simpleDeclaration : allPreviousSimpleDeclarationsFromClassInReverseOrder) {
|
||||||
if (pm != null && pm.isCanceled()) {
|
if (pm != null && pm.isCanceled()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue