[95651] Checking for npe's
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java
index 09ee4e6..96c5877 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java
@@ -20,6 +20,7 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.wst.common.componentcore.internal.ComponentResource;
 import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeNode;
 import org.eclipse.wst.common.componentcore.internal.resources.FlexibleProject;
 import org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent;
 import org.eclipse.wst.common.componentcore.internal.resources.VirtualFile;
@@ -141,7 +142,7 @@
 			se = StructureEdit.getStructureEditForRead(proj);
 			ComponentResource[] resources = se
 					.findResourcesBySourcePath(aResource
-							.getProjectRelativePath());
+							.getProjectRelativePath(),aResource.exists() ? ResourceTreeNode.CREATE_NONE:ResourceTreeNode.CREATE_RESOURCE_ALWAYS);
 			for (int i = 0; i < resources.length; i++) {
 				if (aResource.getType() == IResource.FILE)
 					foundResources.add(new VirtualFile(proj, resources[i]
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ArtifactEditModel.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ArtifactEditModel.java
index bb2632e..2ca463b 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ArtifactEditModel.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ArtifactEditModel.java
@@ -17,7 +17,9 @@
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jem.util.logger.proxy.Logger;
 import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.UnresolveableURIException;
 import org.eclipse.wst.common.componentcore.internal.impl.PlatformURLModuleConnection;
 import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -241,21 +243,24 @@
 		Resource resourceToProcess;
 		boolean processed = false; 
  
+		URI aResourceURI = null;
 		IResource resourceResource;
-		IVirtualResource[] virtualResources;
+		IVirtualResource[] resources;
 		for (int i = 0; i < size; i++) { 
 			resourceToProcess = (Resource) theResources.get(i);
-			resourceToProcess.getURI();
+			aResourceURI = resourceToProcess.getURI();
 			resourceResource = WorkbenchResourceHelper.getFile(resourceToProcess);
 			if (resourceResource == null)
-				return processed;
-			virtualResources = ComponentCore.createResources(resourceResource); 
-			for (int resourcesIndex = 0; resourcesIndex < virtualResources.length; resourcesIndex++) {
-				if (virtualComponent.equals(virtualResources[resourcesIndex].getComponent())) {
-					processResource(resourceToProcess);
-					processed = true;
+				Logger.getLogger().logError("Error processing resource URI: " + resourceToProcess.getURI());
+			else {
+				resources = ComponentCore.createResources(resourceResource); 
+				for (int resourcesIndex = 0; resourcesIndex < resources.length; resourcesIndex++) {
+					if (virtualComponent.equals(resources[resourcesIndex].getComponent())) {
+						processResource(resourceToProcess);
+						processed = true;
+					}
 				}
-			} 
+			}
 		}  
 		return processed;
 	}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java
index 1d87176..c9af867 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java
@@ -32,6 +32,7 @@
 import org.eclipse.wst.common.componentcore.UnresolveableURIException;
 import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
 import org.eclipse.wst.common.componentcore.internal.impl.PlatformURLModuleConnection;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeNode;
 import org.eclipse.wst.common.componentcore.internal.util.EclipseResourceAdapter;
 import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
 import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
@@ -602,7 +603,9 @@
 		WorkbenchComponent module = findComponentByName(aModuleName);
 		return module.findResourcesByRuntimePath(aModuleResourcePath);
 	}
-
+	public ComponentResource[] findResourcesBySourcePath(URI aWorkspaceRelativePath) throws UnresolveableURIException {
+		return findResourcesBySourcePath(aWorkspaceRelativePath,ResourceTreeNode.CREATE_NONE);
+	}
 	/**
 	 * <p>
 	 * Locates the {@see ComponentResource}s that contain the supplied resource in their source
@@ -624,10 +627,12 @@
 	 * @throws UnresolveableURIException
 	 *             If the supplied module URI is invalid or unresolveable.
 	 */
-	public ComponentResource[] findResourcesBySourcePath(URI aWorkspaceRelativePath) throws UnresolveableURIException {
-		return findResourcesBySourcePath(new Path(aWorkspaceRelativePath.path()));
+	public ComponentResource[] findResourcesBySourcePath(URI aWorkspaceRelativePath, int resourceFlag) throws UnresolveableURIException {
+		return findResourcesBySourcePath(new Path(aWorkspaceRelativePath.path()),resourceFlag);
 	}	
-	
+	public ComponentResource[] findResourcesBySourcePath(IPath aProjectRelativePath) throws UnresolveableURIException {
+		return findResourcesBySourcePath(aProjectRelativePath,ResourceTreeNode.CREATE_NONE);
+	}
 	/**
 	 * <p>
 	 * Locates the {@see ComponentResource}s that contain the supplied resource in their source
@@ -648,7 +653,7 @@
 	 * @throws UnresolveableURIException
 	 *             If the supplied module URI is invalid or unresolveable.
 	 */
-	public ComponentResource[] findResourcesBySourcePath(IPath aProjectRelativePath) throws UnresolveableURIException {
+	public ComponentResource[] findResourcesBySourcePath(IPath aProjectRelativePath, int resourceFlag) throws UnresolveableURIException {
 		ProjectComponents projectModules = getComponentModelRoot();
 		EList modules = projectModules.getComponents();
 
@@ -657,11 +662,11 @@
 		List foundResources = new ArrayList();
 		for (int i = 0; i < modules.size(); i++) {
 			module = (WorkbenchComponent) modules.get(i);
-			resources = module.findResourcesBySourcePath(aProjectRelativePath);
+			resources = module.findResourcesBySourcePath(aProjectRelativePath,resourceFlag);
 			if (resources != null && resources.length != 0)
 				foundResources.addAll(Arrays.asList(resources));
 			else if (aProjectRelativePath.segments().length > 1) { 
-				resources = module.findResourcesBySourcePath(aProjectRelativePath.removeFirstSegments(1));
+				resources = module.findResourcesBySourcePath(aProjectRelativePath.removeFirstSegments(1),resourceFlag);
 				if (resources != null && resources.length != 0)
 					foundResources.addAll(Arrays.asList(resources));
 			}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java
index 1fc3e25..3690268 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java
@@ -127,6 +127,6 @@
 
 	ComponentResource[] findResourcesByRuntimePath(IPath aDeployPath);
 	
-	ComponentResource[] findResourcesBySourcePath(IPath aSourcePath);
+	ComponentResource[] findResourcesBySourcePath(IPath aSourcePath, int resourceFlag);
 
 } // WorkbenchComponent
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java
index 8469afa..997582b 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java
@@ -17,6 +17,8 @@
 import java.util.Set;
 
 import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.wst.common.componentcore.internal.ComponentResource;
@@ -31,6 +33,19 @@
  * </p>
  */
 public class ResourceTreeNode {
+	
+	public static final int CREATE_NONE = 0x0;
+	/** 
+	 * Type constant (bit mask value 1) which identifies creating child nodes.
+	 *
+	 */
+	public static final int CREATE_TREENODE_IFNEC = 0x1;
+
+	/**
+	 * Type constant (bit mask value 2) which identifies always creating a virtual resource.
+	 *
+	 */
+	public static final int CREATE_RESOURCE_ALWAYS = 0x2;
 
 	private final Set moduleResources = Collections.synchronizedSet(new HashSet());	
 	private final Map children = Collections.synchronizedMap(new HashMap());
@@ -50,7 +65,7 @@
 	}
 
 	public ResourceTreeNode addChild(ComponentResource aModuleResource) {
-		ResourceTreeNode newChild = findChild(getPathProvider().getPath(aModuleResource), true);
+		ResourceTreeNode newChild = findChild(getPathProvider().getPath(aModuleResource), CREATE_TREENODE_IFNEC);
 		if(newChild != null) {
 			newChild.addModuleResource(aModuleResource);
 			return newChild;
@@ -63,7 +78,7 @@
 	}
 
 	public ResourceTreeNode removeChild(ComponentResource aModuleResource) { 
-		ResourceTreeNode containingChild = findChild(getPathProvider().getPath(aModuleResource), false);
+		ResourceTreeNode containingChild = findChild(getPathProvider().getPath(aModuleResource), CREATE_NONE);
 		if(containingChild != null) {
 			containingChild.removeResource(aModuleResource);
 			if(containingChild.hasModuleResources())
@@ -74,7 +89,7 @@
 	}
 
 	public ResourceTreeNode removeChild(IPath targetPath, ComponentResource aModuleResource) { 
-		ResourceTreeNode containingChild = findChild(targetPath, false);
+		ResourceTreeNode containingChild = findChild(targetPath, CREATE_NONE);
 		if(containingChild != null) {
 			containingChild.removeResource(aModuleResource);
 			if(containingChild.hasModuleResources())
@@ -89,20 +104,20 @@
 	}
 
 	public ResourceTreeNode findChild(IPath aPath) {
-		return findChild(aPath, true);
+		return findChild(aPath, CREATE_TREENODE_IFNEC);
 	}
 
-	public ResourceTreeNode findChild(IPath aPath, boolean toCreateChildIfNecessary) {
+	public ResourceTreeNode findChild(IPath aPath, int creationFlags) {
 		if(aPath == null)
 			return null;
 		ResourceTreeNode child = this;
 		if (aPath.segmentCount() > 0) {
-			child = findChild(aPath.segment(0), toCreateChildIfNecessary);
+			child = findChild(aPath.segment(0), creationFlags);
 			if (child == null)
 				return null;
 			if (aPath.segmentCount() == 1)
 				return child;
-			child = child.findChild(aPath.removeFirstSegments(1), toCreateChildIfNecessary);
+			child = child.findChild(aPath.removeFirstSegments(1), creationFlags);
 
 		}
 		return child;
@@ -111,19 +126,20 @@
 	public ResourceTreeNode findChild(String aPathSegment) {
 		if (aPathSegment == null || aPathSegment.length() == 0)
 			return this;
-		return findChild(aPathSegment, false);
+		return findChild(aPathSegment, CREATE_NONE);
 	}
 
-	public ResourceTreeNode findChild(String aPathSegment, boolean toCreateChildIfNecessary) {
+	public ResourceTreeNode findChild(String aPathSegment, int creationFlags) {
+		boolean toCreateChildIfNecessary = (creationFlags & CREATE_TREENODE_IFNEC) == CREATE_TREENODE_IFNEC;
 		ResourceTreeNode childNode = (ResourceTreeNode) children.get(aPathSegment);
 		if (childNode == null && toCreateChildIfNecessary)
 			childNode = addChild(aPathSegment);
 		return childNode;
 	}
 
-	public ComponentResource[] findModuleResources(IPath aPath, boolean toCreateChildIfNecessary) {
+	public ComponentResource[] findModuleResources(IPath aPath, int creationFlags) {
 
-		Set foundModuleResources = findModuleResourcesSet(aPath, aPath, toCreateChildIfNecessary);
+		Set foundModuleResources = findModuleResourcesSet(aPath, aPath, creationFlags);
 		if (foundModuleResources.size() == 0)
 			return NO_MODULE_RESOURCES;
 		return (ComponentResource[]) foundModuleResources.toArray(new ComponentResource[foundModuleResources.size()]);
@@ -137,22 +153,23 @@
 		return (ComponentResource[]) moduleResources.toArray(new ComponentResource[moduleResources.size()]);
 	}
 
-	private Set findModuleResourcesSet(IPath aFullPath, IPath aPath, boolean toCreateChildIfNecessary) {
+	private Set findModuleResourcesSet(IPath aFullPath, IPath aPath, int creationFlags) {
 
 		if (aPath.segmentCount() == 0) {
 			Set resources = aggregateResources(new HashSet());
 			return resources;
 		}
-		ResourceTreeNode child = findChild(aPath.segment(0), toCreateChildIfNecessary);
+		ResourceTreeNode child = findChild(aPath.segment(0), creationFlags);
 		if (child == null)
-			return findMatchingVirtualPathsSet(aFullPath, aPath);
+			return findMatchingVirtualPathsSet(aFullPath, aPath, creationFlags);
 		Set foundResources = new HashSet();
-		foundResources.addAll(child.findModuleResourcesSet(aFullPath, aPath.removeFirstSegments(1), toCreateChildIfNecessary));
-		foundResources.addAll(findMatchingVirtualPathsSet(aFullPath, aPath));
+		foundResources.addAll(child.findModuleResourcesSet(aFullPath, aPath.removeFirstSegments(1), creationFlags));
+		foundResources.addAll(findMatchingVirtualPathsSet(aFullPath, aPath, creationFlags));
 		return foundResources;
 	}
 
-	private Set findMatchingVirtualPathsSet(IPath aFullPath, IPath aPath) {
+	private Set findMatchingVirtualPathsSet(IPath aFullPath, IPath aPath, int creationFlags) {
+		boolean toCreateResourceAlways = (creationFlags & CREATE_RESOURCE_ALWAYS) == CREATE_RESOURCE_ALWAYS;
 		if (hasModuleResources()) {
 			ComponentResource moduleResource = null;
 			IResource eclipseResource = null;
@@ -176,13 +193,13 @@
 						if(newResource == null) {
 							// flesh out the tree
 							newResource = ComponentcorePackage.eINSTANCE.getComponentcoreFactory().createComponentResource();
-							//if ((foundResource = eclipseContainer.findMember(aPath)) != null) {
+							if ((toCreateResourceAlways) || (foundResource = eclipseContainer.findMember(aPath)) != null) {
 								newResource.setComponent(moduleResource.getComponent());		
 								
 								newResource.setRuntimePath(runtimeURI);
 								newResource.setSourcePath(eclipseContainer.getProjectRelativePath().append(aPath));
 								resultSet.add(newResource);
-							//}
+							}
 						}
 					}
 		
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRoot.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRoot.java
index 7b1feed..cc7a704 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRoot.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRoot.java
@@ -166,7 +166,7 @@
 		} catch (UnresolveableURIException uurie) {
 
 		}
-		return findModuleResources(path, false);
+		return findModuleResources(path, ResourceTreeNode.CREATE_NONE);
 	}
 
 }
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
index 5ebf44e..f5a54fc 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
@@ -2,7 +2,7 @@
  * <copyright>
  * </copyright>
  *
- * $Id: WorkbenchComponentImpl.java,v 1.2 2005/04/14 04:44:09 cbridgha Exp $
+ * $Id: WorkbenchComponentImpl.java,v 1.3 2005/05/18 03:02:06 cbridgha Exp $
  */
 package org.eclipse.wst.common.componentcore.internal.impl;
 
@@ -369,12 +369,12 @@
 
 	public ComponentResource[] findResourcesByRuntimePath(IPath aDeployPath) { 
 		ResourceTreeRoot resourceTreeRoot = ResourceTreeRoot.getDeployResourceTreeRoot(this);
-		return resourceTreeRoot.findModuleResources(aDeployPath, false); 
+		return resourceTreeRoot.findModuleResources(aDeployPath, ResourceTreeNode.CREATE_NONE); 
 	}
 
-	public ComponentResource[] findResourcesBySourcePath(IPath aSourcePath) { 
+	public ComponentResource[] findResourcesBySourcePath(IPath aSourcePath, int resourceFlag) { 
 		ResourceTreeRoot resourceTreeRoot = ResourceTreeRoot.getSourceResourceTreeRoot(this);
-		return resourceTreeRoot.findModuleResources(aSourcePath, false); 
+		return resourceTreeRoot.findModuleResources(aSourcePath, resourceFlag); 
 	}
   
 
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java
index 667293a..27b49f9 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java
@@ -22,6 +22,7 @@
 import org.eclipse.wst.common.componentcore.internal.ComponentResource;
 import org.eclipse.wst.common.componentcore.internal.StructureEdit;
 import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeNode;
 import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeRoot;
 import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
 import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
@@ -143,7 +144,7 @@
 			moduleCore = StructureEdit.getStructureEditForRead(getComponentHandle().getProject());
 			WorkbenchComponent component = moduleCore.findComponentByName(getComponentHandle().getName());
 			ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component);
-			ComponentResource[] componentResources = root.findModuleResources(getRuntimePath(), false);
+			ComponentResource[] componentResources = root.findModuleResources(getRuntimePath(), ResourceTreeNode.CREATE_NONE);
 
 			
 			IResource realResource = null;
@@ -226,7 +227,7 @@
 			WorkbenchComponent component = moduleCore.findComponentByName(getComponent().getName());
 			
 			ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component);
-			ComponentResource[] resources = root.findModuleResources(getRuntimePath(), false);
+			ComponentResource[] resources = root.findModuleResources(getRuntimePath(), ResourceTreeNode.CREATE_NONE);
 
 			if(resources.length == 0) {
 				ComponentResource componentResource = moduleCore.createWorkbenchModuleResource(resource);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFile.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFile.java
index d48c74d..caeda31 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFile.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFile.java
@@ -18,6 +18,7 @@
 import org.eclipse.wst.common.componentcore.internal.ComponentResource;
 import org.eclipse.wst.common.componentcore.internal.StructureEdit;
 import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeNode;
 import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeRoot;
 import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
 import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
@@ -47,7 +48,7 @@
 			WorkbenchComponent component = moduleCore.findComponentByName(getComponent().getName());
 			
 			ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component);
-			ComponentResource[] resources = root.findModuleResources(getRuntimePath(), false);
+			ComponentResource[] resources = root.findModuleResources(getRuntimePath(), ResourceTreeNode.CREATE_NONE);
 
 			if(resources.length == 0) {
 				ComponentResource componentResource = moduleCore.createWorkbenchModuleResource(resource);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java
index f0bc219..940a2f0 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java
@@ -24,6 +24,7 @@
 import org.eclipse.wst.common.componentcore.internal.ComponentResource;
 import org.eclipse.wst.common.componentcore.internal.StructureEdit;
 import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeNode;
 import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeRoot;
 import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -117,7 +118,7 @@
 				IPath searchPath = null;
 				do{ 
 					searchPath = (searchPath == null) ? getRuntimePath(): searchPath.removeLastSegments(1);
-					componentResources = root.findModuleResources(searchPath, false);
+					componentResources = root.findModuleResources(searchPath, ResourceTreeNode.CREATE_NONE);
 					estimatedPath = findBestMatch(componentResources);					
 				} while(estimatedPath == null && canSearchContinue(componentResources, searchPath));
 				return estimatedPath;