mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fixed bug where types found in project include paths were not considered reachable.
This commit is contained in:
parent
8da6bfb0f0
commit
87b4f009d3
1 changed files with 16 additions and 15 deletions
|
@ -347,23 +347,24 @@ public class NewClassWizardUtil {
|
|||
*/
|
||||
public static boolean isTypeReachable(ITypeInfo type, ICProject project, String[] includePaths) {
|
||||
ICProject baseProject = type.getEnclosingProject();
|
||||
if (baseProject != null) {
|
||||
if (baseProject.equals(project)) {
|
||||
return true;
|
||||
}
|
||||
ITypeReference ref = type.getResolvedReference();
|
||||
for (int i = 0; i < includePaths.length; ++i) {
|
||||
IPath includePath = new Path(includePaths[i]);
|
||||
if (ref != null) {
|
||||
if (includePath.isPrefixOf(ref.getLocation()))
|
||||
return true;
|
||||
} else {
|
||||
// we don't have the real location, so just check the project path
|
||||
if (baseProject.getProject().getLocation().isPrefixOf(includePath))
|
||||
return true;
|
||||
}
|
||||
if (baseProject != null && baseProject.equals(project)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check the include paths
|
||||
ITypeReference ref = type.getResolvedReference();
|
||||
for (int i = 0; i < includePaths.length; ++i) {
|
||||
IPath includePath = new Path(includePaths[i]);
|
||||
if (ref != null) {
|
||||
if (includePath.isPrefixOf(ref.getLocation()))
|
||||
return true;
|
||||
} else {
|
||||
// we don't have the real location, so just check the project path
|
||||
if (baseProject != null && baseProject.getProject().getLocation().isPrefixOf(includePath))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue