[341303] Add limited support for Project classpath entries in classpath containers
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/AbstractFlattenParticipant.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/AbstractFlattenParticipant.java
index 024f710..a844e07 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/AbstractFlattenParticipant.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/AbstractFlattenParticipant.java
@@ -60,4 +60,8 @@
 		return false;
 	}
 
+	public List<IVirtualReference> getChildModules(IVirtualComponent rootComponent, FlatComponentTaskModel dataModel) {
+		return null;
+	}
+
 }
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java
index 299c5b9..7a019fe 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/FlatVirtualComponent.java
@@ -247,11 +247,49 @@
 					children.removeAll(duplicates);
 					children.add(cm);
 				}
-			}
+			}	
     	}
+    	addUsedReferencesFromParticipants(util, vc, root);    	
 	}
 	
 	/**
+	 * Add references provided by participants (e.g., components provided by a child to the receiving parent by 
+	 * mapping it to ../
+	 * @param util
+	 * @param vc
+	 * @param root
+	 * @throws CoreException
+	 */
+	
+	protected void addUsedReferencesFromParticipants(VirtualComponentFlattenUtility util, IVirtualComponent vc, IPath root) throws CoreException{		
+		List<IVirtualReference> references = null;
+		for( int i = 0; i < participants.length; i++ ) {
+			references = participants[i].getChildModules(vc, dataModel);
+			if (references == null || references.isEmpty()){
+				continue;
+			}
+			
+			for (IVirtualReference reference:references) {
+				IVirtualComponent virtualComp = reference.getReferencedComponent();
+				if (reference.getDependencyType() == DependencyType.USES ) {		
+					if( !isChildModule(reference)) {
+						addNonChildUsedReference(util, vc, reference, root.append(reference.getRuntimePath()));
+					} else {
+						ChildModuleReference cm = new ChildModuleReference(reference, root);
+						List<IChildModuleReference> duplicates = new ArrayList();
+						for( IChildModuleReference tmp : children ) {
+							if(tmp.getRelativeURI().equals(cm.getRelativeURI()))
+								duplicates.add(tmp);
+						}
+						children.removeAll(duplicates);
+						children.add(cm);
+					}
+				}	
+			}
+		}	
+	}
+
+	/**
 	 * Should we expose this used reference as a member file?
 	 * 
 	 * @param currentComponent the current component we're traversing
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipant.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipant.java
index 54fd742..7beb7b3 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipant.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/IFlattenParticipant.java
@@ -162,5 +162,14 @@
 	 */
 	public void finalize(IVirtualComponent component, 
 			FlatComponentTaskModel dataModel, List<IFlatResource> resources);
+	
+	
+	/**
+	 * Return a list of references that this participant believes should be treated as child modules.
+	 * @param rootComponent
+	 * @param dataModel
+	 * @return
+	 */
+	public List<IVirtualReference> getChildModules(IVirtualComponent rootComponent, FlatComponentTaskModel dataModel);
 
 }