mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Improves the navigation fallback, bug 102643.
This commit is contained in:
parent
83c44162bf
commit
d82d0c2245
3 changed files with 25 additions and 7 deletions
|
@ -279,7 +279,7 @@ public interface IIndex {
|
|||
*
|
||||
* This is fully equivalent to
|
||||
* <pre>
|
||||
* findBindings(new char[][]{name}, filter, monitor);
|
||||
* findBindings(name, true, filter, monitor);
|
||||
* </pre>
|
||||
* @param name a name, which has to be matched by the qualified name of the bindings.
|
||||
* @param filter a filter that allows for skipping parts of the index
|
||||
|
@ -289,6 +289,20 @@ public interface IIndex {
|
|||
*/
|
||||
public IIndexBinding[] findBindings(char[] name, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
* Searches the global scope and optionally all other scopes for bindings with a given name.
|
||||
* In case a binding exists in multiple projects, no duplicate bindings are returned.
|
||||
* This method makes use of the BTree and is faster than the methods using patterns.
|
||||
*
|
||||
* @param name a name, which has to be matched by the qualified name of the bindings.
|
||||
* @param fileScopeOnly if true, only bindings at file scope are returned
|
||||
* @param filter a filter that allows for skipping parts of the index
|
||||
* @param monitor a monitor to report progress, may be <code>null</code>.
|
||||
* @return an array of bindings matching the pattern
|
||||
* @throws CoreException
|
||||
*/
|
||||
public IIndexBinding[] findBindings(char[] name, boolean fileScopeOnly, IndexFilter filter, IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
* Searches for all bindings with names that start with the given prefix.
|
||||
* @param prefix the prefix with which all returned bindings must start
|
||||
|
|
|
@ -134,4 +134,8 @@ final public class EmptyCIndex implements IIndex {
|
|||
public IIndexFile[] getAllFiles() {
|
||||
return IIndexFile.EMPTY_FILE_ARRAY;
|
||||
}
|
||||
|
||||
public IIndexBinding[] findBindings(char[] name, boolean fileScopeOnly, IndexFilter filter, IProgressMonitor monitor) {
|
||||
return IIndexBinding.EMPTY_INDEX_BINDING_ARRAY;
|
||||
}
|
||||
}
|
|
@ -232,7 +232,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
|||
elems.add(elem);
|
||||
}
|
||||
}
|
||||
IIndexBinding[] bindings = fIndex.findBindings(name, filter, fMonitor);
|
||||
IIndexBinding[] bindings = fIndex.findBindings(name, false, filter, fMonitor);
|
||||
for (IBinding binding : bindings) {
|
||||
final IName[] names = findNames(fIndex, ast, KIND_OTHER, binding);
|
||||
convertToCElements(project, fIndex, names, elems);
|
||||
|
@ -257,7 +257,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
|||
try {
|
||||
open(path, 0, 0);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -280,7 +280,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
|||
try {
|
||||
open(path, offset, length);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -305,7 +305,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
|||
elements.add(elem);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
|||
ICElement[] elemArray= elements.toArray(new ICElement[elements.size()]);
|
||||
target = (ISourceReference) OpenActionUtil.selectCElement(elemArray, getSite().getShell(),
|
||||
CEditorMessages.getString("OpenDeclarationsAction.dialog.title"), CEditorMessages.getString("OpenDeclarationsAction.selectMessage"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
CElementBaseLabels.ALL_DEFAULT | CElementBaseLabels.MF_POST_FILE_QUALIFIED, 0);
|
||||
CElementBaseLabels.ALL_DEFAULT | CElementBaseLabels.ALL_FULLY_QUALIFIED | CElementBaseLabels.MF_POST_FILE_QUALIFIED, 0);
|
||||
}
|
||||
if (target != null) {
|
||||
ITranslationUnit tu= target.getTranslationUnit();
|
||||
|
@ -339,7 +339,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
|||
open(tu.getLocation(), sourceRange.getIdStartPos(), sourceRange.getIdLength());
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue