1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

fix for bug 64986 - handle containers in CSearchScope

This commit is contained in:
Andrew Niefer 2004-06-10 20:46:57 +00:00
parent 2a7ee92a8a
commit 7858f60f7e
2 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,6 @@
2004-06-10 Andrew Niefer
fix bug 64986 - handle Containers in CSearchScope
2004-05-26 Andrew Niefer 2004-05-26 Andrew Niefer
Modified search to use ASTUtil.getFunctionParameterTypes to get the strings to search for Modified search to use ASTUtil.getFunctionParameterTypes to get the strings to search for
functions with specific parameters. functions with specific parameters.

View file

@ -16,6 +16,7 @@ import java.util.HashSet;
import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICContainer;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IMember; import org.eclipse.cdt.core.model.IMember;
@ -191,15 +192,13 @@ public class CSearchScope implements ICSearchScope {
while (searchedElement != null) { while (searchedElement != null) {
if (searchedElement.equals(scopeElement)) { if (searchedElement.equals(scopeElement)) {
return true; return true;
} else {
searchedElement = searchedElement.getParent();
} }
searchedElement = searchedElement.getParent();
} }
} }
return false; return false;
} else {
return this.encloses(this.fullPath(element));
} }
return this.encloses(this.fullPath(element));
} }
public IPath[] enclosingProjects() { public IPath[] enclosingProjects() {
@ -215,6 +214,9 @@ public class CSearchScope implements ICSearchScope {
case ICElement.C_PROJECT: case ICElement.C_PROJECT:
// a workspace scope should be used // a workspace scope should be used
break; break;
case ICElement.C_CCONTAINER:
add( (ICContainer) element );
break;
default: default:
if (element instanceof IMember) { if (element instanceof IMember) {
if (this.elements == null) { if (this.elements == null) {
@ -235,6 +237,17 @@ public class CSearchScope implements ICSearchScope {
} }
} }
public void add( ICContainer container ){
ICElement [] children = null;
try {
children = container.getChildren();
} catch (CModelException e) {
return;
}
for( int i = 0; i < children.length; i++ ){
add( children[i] );
}
}
/** /**
* @param finalPath * @param finalPath
*/ */