From ff1459685f98c2b4ae467f0943dbdc723a433376 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Fri, 18 Jun 2004 03:27:15 +0000 Subject: [PATCH] the method getCDescriptor(IProject, boolean) should check if the file exists. --- .../cdt/internal/core/CDescriptorManager.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java index 9eff7f22ba3..d2b5861de90 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java @@ -38,6 +38,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ISafeRunnable; 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 { CDescriptor descriptor = (CDescriptor)fDescriptorMap.get(project); - if (descriptor == null && create) { - descriptor = new CDescriptor(this, project); - fDescriptorMap.put(project, descriptor); + if (descriptor == null) { + if (create) { + 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; }