1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

the method getCDescriptor(IProject, boolean)

should check if the file exists.
This commit is contained in:
Alain Magloire 2004-06-18 03:27:15 +00:00
parent 7c4799554a
commit ff1459685f

View file

@ -38,6 +38,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -236,9 +237,23 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
synchronized public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException { synchronized public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException {
CDescriptor descriptor = (CDescriptor)fDescriptorMap.get(project); CDescriptor descriptor = (CDescriptor)fDescriptorMap.get(project);
if (descriptor == null && create) { if (descriptor == null) {
descriptor = new CDescriptor(this, project); if (create) {
fDescriptorMap.put(project, descriptor); descriptor = new CDescriptor(this, project);
fDescriptorMap.put(project, descriptor);
} else {
IPath projectLocation = project.getDescription().getLocation();
if (projectLocation == null) {
projectLocation = Platform.getLocation().append(project.getFullPath());
}
IPath descriptionPath = projectLocation.append(CDescriptor.DESCRIPTION_FILE_NAME);
if (descriptionPath.toFile().exists()) {
descriptor = new CDescriptor(this, project);
fDescriptorMap.put(project, descriptor);
}
}
} }
return descriptor; return descriptor;
} }