Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2007-11-28 11:35:46 +0000
committerMarkus Schorn2007-11-28 11:35:46 +0000
commite371aed0cadd94cf4aa74585786a42344876a1db (patch)
tree472cd376e9352799590672eec6f458d2318ee044 /core/org.eclipse.cdt.core/parser
parent8c2d3a947df36ca070c356a2895ae0f7237c6c1c (diff)
downloadorg.eclipse.cdt-e371aed0cadd94cf4aa74585786a42344876a1db.tar.gz
org.eclipse.cdt-e371aed0cadd94cf4aa74585786a42344876a1db.tar.xz
org.eclipse.cdt-e371aed0cadd94cf4aa74585786a42344876a1db.zip
Using include browser across projects.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java57
1 files changed, 16 insertions, 41 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
index f6f5c398adb..e82066e8d80 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
@@ -181,25 +181,12 @@ public class CIndex implements IIndex {
return null;
}
IIndexFragmentInclude fragmentInclude = (IIndexFragmentInclude) include;
- IIndexFragment frag= fragmentInclude.getFragment();
- if (isPrimaryFragment(frag)) {
- IIndexFile result= fragmentInclude.getIncludes();
- if (result != null) {
- return result;
- }
+ IIndexFragmentFile result= fragmentInclude.getIncludes();
+ if (result != null && result.hasNames()) {
+ return result;
}
- IIndexFileLocation location= include.getIncludesLocation();
- for (int i = 0; i < fPrimaryFragmentCount; i++) {
- IIndexFragment otherFrag = fFragments[i];
- if (otherFrag != frag) {
- IIndexFile result= otherFrag.getFile(location);
- if (result != null) {
- return result;
- }
- }
- }
- return null;
+ return getFile(include.getIncludesLocation());
}
public IIndexInclude[] findIncludedBy(IIndexFile file) throws CoreException {
@@ -253,20 +240,17 @@ public class CIndex implements IIndex {
List nextLevel= depth != 0 ? new LinkedList() : null;
for (Iterator it= in.iterator(); it.hasNext(); ) {
IIndexFragmentFile file = (IIndexFragmentFile) it.next();
- IIndexFragment frag= file.getIndexFragment();
- if (isPrimaryFragment(frag)) {
- IIndexInclude[] includes= file.getIncludes();
- for (int k= 0; k < includes.length; k++) {
- IIndexInclude include = includes[k];
- IIndexFileLocation target= include.getIncludesLocation();
- Object key= target != null ? (Object) target : include.getName();
- if (handled.add(key)) {
- out.add(include);
- if (depth != 0) {
- IIndexFile includedByFile= resolveInclude(include);
- if (includedByFile != null) {
- nextLevel.add(includedByFile);
- }
+ IIndexInclude[] includes= file.getIncludes();
+ for (int k= 0; k < includes.length; k++) {
+ IIndexInclude include = includes[k];
+ IIndexFileLocation target= include.getIncludesLocation();
+ Object key= target != null ? (Object) target : include.getName();
+ if (handled.add(key)) {
+ out.add(include);
+ if (depth != 0) {
+ IIndexFile includedByFile= resolveInclude(include);
+ if (includedByFile != null) {
+ nextLevel.add(includedByFile);
}
}
}
@@ -405,16 +389,7 @@ public class CIndex implements IIndex {
System.arraycopy(fFragments, 0, result, 0, fPrimaryFragmentCount);
return result;
}
-
- private boolean isPrimaryFragment(IIndexFragment frag) {
- for (int i = 0; i < fPrimaryFragmentCount; i++) {
- if (frag == fFragments[i]) {
- return true;
- }
- }
- return false;
- }
-
+
public IIndexFragmentBinding[] findEquivalentBindings(IBinding binding) throws CoreException {
List result = new ArrayList();
for (int i = 0; i < fFragments.length; i++) {

Back to the top