### Eclipse Workspace Patch 1.0
#P org.jboss.tools.common.model
Index: src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- src/org/jboss/tools/common/model/util/EclipseResourceUtil.java	(revision 27779)
+++ src/org/jboss/tools/common/model/util/EclipseResourceUtil.java	(working copy)
@@ -615,7 +615,7 @@
 	}
 	
 	/**
-	 * Returns list of canonical paths to resources included in class path.
+	 * Returns list of canonical paths to resources of libraries (jars and class folders) included in class path.
 	 * @throws IOException 
 	 */	
 	public static List<String> getClassPath(IProject project) throws CoreException, IOException {
@@ -623,32 +623,35 @@
 		ArrayList<String> l = new ArrayList<String>();
 		IJavaProject javaProject = JavaCore.create(project);		
 
-		IPath p = javaProject.getOutputLocation();
-		IResource r = p == null ? null : project.getWorkspace().getRoot().findMember(p);
-		if(r != null && r.getLocation() != null && r.exists()) {
-			String s = r.getLocation().toString();
-			l.add(new java.io.File(s).getCanonicalPath());
-		}
+// maybe we should restore outputs with special boolean parameter.
+//		IPath p = javaProject.getOutputLocation();
+//		IResource r = p == null ? null : project.getWorkspace().getRoot().findMember(p);
+//		if(r != null && r.getLocation() != null && r.exists()) {
+//			String s = r.getLocation().toString();
+//			l.add(new java.io.File(s).getCanonicalPath());
+//		}
 
 		IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
+// maybe we should restore outputs with special boolean parameter.
+//		for (int i = 0; i < es.length; i++) {
+//			try {
+//				if(es[i].getEntryKind() == IClasspathEntry.CPE_SOURCE && es[i].getOutputLocation() != null) {
+//					IResource findMember = project.getWorkspace().getRoot().findMember(es[i].getOutputLocation());
+//					if(findMember!=null) {
+//						String s = findMember.getLocation().toString();
+//						l.add(new java.io.File(s).getCanonicalPath());
+//					}
+//				}
+//			} catch (IOException e) {
+//				//ignore - we do not care about non-existent files here.
+//			}
+//		}
 		for (int i = 0; i < es.length; i++) {
-			try {
-				if(es[i].getEntryKind() == IClasspathEntry.CPE_SOURCE && es[i].getOutputLocation() != null) {
-					IResource findMember = project.getWorkspace().getRoot().findMember(es[i].getOutputLocation());
-					if(findMember!=null) {
-						String s = findMember.getLocation().toString();
-						l.add(new java.io.File(s).getCanonicalPath());
-					}
-				}
-			} catch (IOException e) {
-				//ignore - we do not care about non-existent files here.
-			}
-		}
-		for (int i = 0; i < es.length; i++) {
-			try {
-				String s = null;
-				String path = es[i].getPath().toString();
+			if(es[i].getEntryKind() != IClasspathEntry.CPE_LIBRARY) continue;
 
+			String s = null;
+			String path = es[i].getPath().toString();
+			try {
 				//First let's check if path is defined within Eclipse work space.
 				if(path.startsWith(XModelObjectConstants.SEPARATOR) && path.indexOf(XModelObjectConstants.SEPARATOR, 1) > 1) {
 					IResource findMember = ResourcesPlugin.getWorkspace().getRoot().findMember(es[i].getPath());
@@ -672,7 +675,7 @@
 				
 				//If we failed to find resource in Eclipse work space, 
 				//lets try the path as absolute on disk
-				if(s == null && new java.io.File(path).isFile()) {
+				if(s == null && new java.io.File(path).exists()) {
 					s = path;
 				}
 				if(s != null) {
@@ -894,7 +897,16 @@
 	 * @location Absolute path on disk
 	 */
 	public static IFile getFile(String location) {
-		return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(location).makeAbsolute());
+		IPath path = new Path(location).makeAbsolute();
+		IFile result = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+//TODO check if we need that addition 
+//		if(result == null || !result.exists()) {
+//			IFile[] fs = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
+//			if(fs != null && fs.length > 0) {
+//				result = fs[0];
+//			}
+//		}
+		return result;
 	}
 
 	public static IResource getFolder(String location) {
Index: src/org/jboss/tools/common/model/filesystems/impl/Libs.java
===================================================================
--- src/org/jboss/tools/common/model/filesystems/impl/Libs.java	(revision 27779)
+++ src/org/jboss/tools/common/model/filesystems/impl/Libs.java	(working copy)
@@ -102,26 +102,33 @@
 		createMap();
 		return true;
 	}
+	
+	static String LIB_PREFIX = "lib-"; //$NON-NLS-1$
 
 	void updateFileSystems(List<String> paths) {
 		if(fsVersion >= pathsVersion) {
 			return;
 		}
-		XModelObject[] fs = object.getChildren("FileSystemJar"); //$NON-NLS-1$
+		XModelObject[] fs = object.getChildren();
 		Set<XModelObject> fss = new HashSet<XModelObject>();
-		for (int i = 0; i < fs.length; i++) fss.add(fs[i]);
+		for (int i = 0; i < fs.length; i++) {
+			if(fs[i].getAttributeValue(XModelObjectConstants.ATTR_NAME).startsWith(LIB_PREFIX)) {
+				fss.add(fs[i]);
+			}
+		}
 		
 		if(paths != null) for (int i = 0; i < paths.size(); i++) {
 			String path = paths.get(i);
-			if(!EclipseResourceUtil.isJar(path)) continue;
+			boolean isJar = EclipseResourceUtil.isJar(path);
+			String libEntity = isJar ? "FileSystemJar" : "FileSystemFolder"; //$NON-NLS-1$ //$NON-NLS-2$
 			String fileName = new File(path).getName();
-			if(EclipseResourceUtil.SYSTEM_JAR_SET.contains(fileName)) continue;
-			String jsname = "lib-" + fileName; //$NON-NLS-1$
+			if(isJar && EclipseResourceUtil.SYSTEM_JAR_SET.contains(fileName)) continue;
+			String jsname = LIB_PREFIX + fileName;
 			XModelObject o = object.getChildByPath(jsname);
 			if(o != null) {
 				fss.remove(o);
 			} else {
-				o = object.getModel().createModelObject("FileSystemJar", null); //$NON-NLS-1$
+				o = object.getModel().createModelObject(libEntity, null);
 				o.setAttributeValue(XModelObjectConstants.ATTR_NAME, jsname); 
 				o.setAttributeValue(XModelObjectConstants.ATTR_NAME_LOCATION, path);
 				o.set(FileSystemsLoader.IS_ADDED_TO_CLASSPATH, XModelObjectConstants.TRUE);
#P org.jboss.tools.jsf
Index: src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java
===================================================================
--- src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java	(revision 29366)
+++ src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java	(working copy)
@@ -27,6 +27,7 @@
 import org.eclipse.jdt.core.IPackageFragmentRoot;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.ExternalPackageFragmentRoot;
 import org.eclipse.jdt.internal.core.JarEntryDirectory;
 import org.eclipse.jdt.internal.core.JarEntryFile;
 import org.eclipse.jdt.internal.core.JarEntryResource;
@@ -83,8 +84,17 @@
 				return file;
 			}
 		}
-		return searchInClassPath(project, "META-INF" + relativeLocation //$NON-NLS-1$
-				+ "/" + nodeName + ".xhtml", JAR_FILE_RESOURCE_TYPE); //$NON-NLS-1$ //$NON-NLS-2$
+		String classPathResource = "META-INF" + relativeLocation //$NON-NLS-1$
+					+ "/" + nodeName + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$
+		JarEntryResource jer = searchInClassPath(project, classPathResource, JAR_FILE_RESOURCE_TYPE);
+		if(jer != null) {
+			return jer;
+		}
+		IResource r = searchInClassPath2(project, classPathResource, JAR_FILE_RESOURCE_TYPE);
+		if(r != null) {
+			return r;
+		}
+		return null;
 	}
 
 	private static JarEntryResource searchInClassPath(IProject project,
@@ -111,7 +121,38 @@
 							return directoryInJar;
 						}
 					}
+				} else {
+				}
+			}
+		} catch (JavaModelException e) {
+			JSFModelPlugin.getPluginLog().logError(e);
+		} catch (CoreException e) {
+			JSFModelPlugin.getPluginLog().logError(e);
+		}
+		return null;
+	}
+
+	private static IResource searchInClassPath2(IProject project,
+			String classPathResource, int jarResourceType) {
+		IJavaProject javaProject = JavaCore.create(project);
+		try {
+			for (IPackageFragmentRoot fragmentRoot : javaProject
+					.getAllPackageFragmentRoots()) {
+				IResource r = fragmentRoot.getResource();
+				if(fragmentRoot instanceof ExternalPackageFragmentRoot) {
+					r = ((ExternalPackageFragmentRoot) fragmentRoot).resource();
 				}
+				if(r instanceof IFolder && r.exists()) {
+					IFolder f = (IFolder)r;
+					IFile f1 = f.getFile(classPathResource);
+					if(f1.exists()) {
+						return f1;
+					}
+					IFolder f2 = f.getFolder(classPathResource);
+					if(f2.exists()) {
+						return f2;
+					}
+				}				
 			}
 		} catch (JavaModelException e) {
 			JSFModelPlugin.getPluginLog().logError(e);
@@ -121,6 +162,7 @@
 		return null;
 	}
 
+
 	public static Object findResourcesFolderContainerByNameSpace(
 			IProject project, String nameSpaceURI) {
 		if (nameSpaceURI == null || nameSpaceURI.indexOf(JSF2_URI_PREFIX) == -1) {
@@ -140,8 +182,16 @@
 				return resFolder;
 			}
 		}
-		return searchInClassPath(project,
-				"META-INF" + relativeLocation, JAR_DIRECTORY_RESOURCE_TYPE); //$NON-NLS-1$
+		String classPathResource = "META-INF" + relativeLocation; //$NON-NLS-1$
+		JarEntryResource jer = searchInClassPath(project, classPathResource, JAR_DIRECTORY_RESOURCE_TYPE);
+		if(jer != null) {
+			return jer;
+		}
+		IResource r = searchInClassPath2(project, classPathResource, JAR_DIRECTORY_RESOURCE_TYPE);
+		if(r != null) {
+			return r;
+		}
+		return null;
 	}
 
 	public static boolean isResourcesFolderExists(IProject project,
#P org.jboss.tools.cdi.core
Index: src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
--- src/org/jboss/tools/cdi/core/CDICoreBuilder.java	(revision 29367)
+++ src/org/jboss/tools/cdi/core/CDICoreBuilder.java	(working copy)
@@ -215,6 +215,11 @@
 				IFile f = EclipseResourceUtil.getFile(jar);
 				if(f != null && f.exists()) {
 					root = jp.getPackageFragmentRoot(f);
+				} else {
+					f = EclipseResourceUtil.getFile(jar + "/META-INF/beans.xml");
+					if(f != null && f.exists()) {
+						root = jp.getPackageFragmentRoot(f.getParent().getParent());
+					}
 				}
 			}
 			if (root == null || !root.exists())
