[104394] Redundant resource entries
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 4182581..a292fa8 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
@@ -49,6 +49,7 @@
 
 	private final Set moduleResources = Collections.synchronizedSet(new HashSet());	
 	private final Map children = Collections.synchronizedMap(new HashMap());
+	private final Map transientChildResources = Collections.synchronizedMap(new HashMap());
 	private static final ComponentResource[] NO_MODULE_RESOURCES = new ComponentResource[]{};
 	private IPathProvider pathProvider;
 //	private ResourceTreeNode parent;
@@ -206,11 +207,16 @@
 						if(newResource == null) {
 							// flesh out the tree
 							IResource eclipseRes = eclipseContainer.findMember(aPath);
-							if ((toCreateResourceAlways) || (eclipseRes != null) && (eclipseRes.getType() == IResource.FOLDER)) {
+							if ((toCreateResourceAlways) || (eclipseRes != null)) {
+								newResource = (ComponentResource)transientChildResources.get(aPath);
+								if (newResource == null) {
 								newResource = ComponentcorePackage.eINSTANCE.getComponentcoreFactory().createComponentResource();
-								newResource.setComponent(moduleResource.getComponent());		
+								// Not setting the parent on this transient child resource
+								// newResource.setComponent(moduleResource.getComponent());
 								newResource.setRuntimePath(runtimeURI);
 								newResource.setSourcePath(srcPath);
+								transientChildResources.put(aPath,newResource);
+								}
 								resultSet.add(newResource);
 							}
 						}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
index 258bbca..a2eaa5f 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
@@ -14,8 +14,10 @@
 import java.io.File;
 import java.util.Properties;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
@@ -108,13 +110,17 @@
 	}
 
 	public IPath getWorkspaceRelativePath() {
-		if (getProject() != null)
-			return getProject().getFile(archivePath).getFullPath();
+		IFile aFile = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
+		if (aFile.exists())
+			aFile.getFullPath();
 		return archivePath;
 	}
 
 	public IPath getProjectRelativePath() {
-		return archivePath;
+		IFile aFile = ResourcesPlugin.getWorkspace().getRoot().getFile(getWorkspaceRelativePath());
+		if (aFile.exists())
+			return aFile.getProjectRelativePath();
+		return null;
 	}
 
 	public IProject getProject() {
@@ -193,6 +199,9 @@
 	public void setMetaProperties(Properties properties) {
 
 	}
+	public IFile getUnderlyingWorkbenchFile() {
+		return ResourcesPlugin.getWorkspace().getRoot().getFile(getWorkspaceRelativePath());
+	}
 
 	public File getUnderlyingDiskFile() {
 		String osPath = "";
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 09b6f66..3769706 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
@@ -21,6 +21,7 @@
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -83,18 +84,20 @@
 			for (int i=0; i<resources.length; i++) {
 				// return the resources corresponding to the root, not any of the children if its a folder
 				if (resources[i].getRuntimePath().equals(getRuntimePath().append(aPath))) {
-					IResource platformResource = StructureEdit.getEclipseResource(resources[i]);
-				if (platformResource != null) {
-					switch (platformResource.getType()) {
-						case IResource.FOLDER :
-						case IResource.PROJECT :
+					IResource platformResource = getProject().findMember(resources[i].getSourcePath()); 
+					if(platformResource == null)
+						platformResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resources[i].getSourcePath()); 
+					if (platformResource != null) {
+						switch (platformResource.getType()) {
+						case IResource.FOLDER:
+						case IResource.PROJECT:
 							return new VirtualFolder(getProject(), getRuntimePath().append(aPath));
-						case IResource.FILE :
+						case IResource.FILE:
 							return new VirtualFile(getProject(), getRuntimePath().append(aPath));
+						}
 					}
 				}
 			}
-			}
 		} finally {
 			if (structureEdit != null)
 				structureEdit.dispose();