mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 180168, use ASTCache for navigation features.
This commit is contained in:
parent
ac998c44d7
commit
7dc3b05c8f
3 changed files with 9 additions and 6 deletions
|
@ -10,7 +10,6 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2007 IBM 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
|
||||
|
@ -35,11 +35,11 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.index.IIndexManager;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
|
||||
|
||||
|
@ -81,7 +81,9 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
}
|
||||
|
||||
try {
|
||||
IASTTranslationUnit ast = workingCopy.getAST(index, ITranslationUnit.AST_SKIP_ALL_HEADERS);
|
||||
IASTTranslationUnit ast=
|
||||
ASTProvider.getASTProvider().getAST(
|
||||
workingCopy, index, ASTProvider.WAIT_YES, monitor);
|
||||
IASTName[] selectedNames = workingCopy.getLanguage().getSelectedNames(ast, selectionStart, selectionLength);
|
||||
|
||||
if (selectedNames.length > 0 && selectedNames[0] != null) { // just right, only one name selected
|
||||
|
|
|
@ -57,6 +57,8 @@ import org.eclipse.cdt.internal.core.model.ext.CElementHandleFactory;
|
|||
import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
|
||||
import org.eclipse.cdt.internal.corext.util.CModelUtil;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
|
||||
|
||||
public class IndexUI {
|
||||
private static final ICElementHandle[] EMPTY_ELEMENTS = new ICElementHandle[0];
|
||||
|
||||
|
@ -229,8 +231,8 @@ public class IndexUI {
|
|||
if (workingCopy == null)
|
||||
return null;
|
||||
|
||||
int options= ITranslationUnit.AST_SKIP_INDEXED_HEADERS;
|
||||
IASTTranslationUnit ast = workingCopy.getAST(index, options);
|
||||
IASTTranslationUnit ast= ASTProvider.getASTProvider().getAST(
|
||||
workingCopy, index, ASTProvider.WAIT_YES, new NullProgressMonitor());
|
||||
FindNameForSelectionVisitor finder= new FindNameForSelectionVisitor(ast.getFilePath(), selectionStart, selectionLength);
|
||||
ast.accept(finder);
|
||||
return finder.getSelectedName();
|
||||
|
|
Loading…
Add table
Reference in a new issue