diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java index 9ec6ba390c2..75c482b6d6a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java @@ -279,7 +279,7 @@ public interface IIndex { * * This is fully equivalent to *
- * findBindings(new char[][]{name}, filter, monitor); + * findBindings(name, true, filter, monitor); ** @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
null
.
+ * @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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java
index d42b9b36330..71e2039001b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java
@@ -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;
+ }
}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsAction.java
index 593899483b1..b2fab12f5fc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsAction.java
@@ -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);
}
}
}