cdt/cdt_6_0_x/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java
changeset 61 ff389f2cc4aa
parent 37 c2bce6dd59e7
equal deleted inserted replaced
60:3982fab6369e 61:ff389f2cc4aa
   344      * @param includePaths the include paths
   344      * @param includePaths the include paths
   345      * @return <code>true</code> if the given type is found
   345      * @return <code>true</code> if the given type is found
   346      */
   346      */
   347     public static boolean isTypeReachable(ITypeInfo type, ICProject project, String[] includePaths) {
   347     public static boolean isTypeReachable(ITypeInfo type, ICProject project, String[] includePaths) {
   348         ICProject baseProject = type.getEnclosingProject();
   348         ICProject baseProject = type.getEnclosingProject();
   349         if (baseProject == null)
       
   350         	return false;
       
   351         
   349         
   352         if (baseProject.equals(project)) {
   350         if (baseProject != null && baseProject.equals(project)) {
   353             return true;
   351             return true;
   354         }
   352         }
   355         
   353         
   356         // check the include paths
   354         // check the include paths
   357         ITypeReference ref = type.getResolvedReference();
   355         ITypeReference ref = type.getResolvedReference();
   358         IPath location = ref == null ? null : ref.getLocation();
   356         IPath location = ref == null ? null : ref.getLocation();
   359         boolean isTypeLocation= true;
   357         boolean isTypeLocation= true;
   360         if (location == null) {
   358         if (location == null) {
   361         	isTypeLocation= false;
   359         	isTypeLocation= false;
   362             location = baseProject.getProject().getLocation();
   360         	
   363             if (location == null)
   361         	if (baseProject != null) {
       
   362                 location = baseProject.getProject().getLocation();
       
   363         	}
       
   364 
       
   365         	if (location == null)
   364             	return false;
   366             	return false;
   365         }
   367         }
   366     
   368     
   367         for (int i = 0; i < includePaths.length; ++i) {
   369         for (int i = 0; i < includePaths.length; ++i) {
   368             IPath includePath = new Path(includePaths[i]);
   370             IPath includePath = new Path(includePaths[i]);