testcase for the last ModelManager.determineIfOnBuildpath(IResource resource,IScriptProject project) change
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java
index 547d28e..7b63937 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java
@@ -61,6 +61,8 @@
 
 	private static final String BUILDPATH_PRJ_2 = "Buildpath2";
 
+	private static final String BUILDPATH_PRJ_4 = "Buildpath4";
+
 	public class TestContainer implements IBuildpathContainer {
 		IPath path;
 
@@ -322,7 +324,7 @@
 			CorePrinter printer = new CorePrinter(System.out, true);
 			((ScriptProject) proj).printNode(printer);
 			printer.flush();
-			
+
 		} finally {
 			this.deleteProject("P");
 		}
@@ -551,22 +553,31 @@
 		IScriptProject[] p = null;
 		try {
 
-			p = new IScriptProject[] { this.createScriptProject("P0var", TEST_NATURE, new String[] { "src0" }), this.createScriptProject("P1var", TEST_NATURE, new String[] { "src1" }), };
+			p = new IScriptProject[] {
+					this.createScriptProject("P0var", TEST_NATURE,
+							new String[] { "src0" }),
+					this.createScriptProject("P1var", TEST_NATURE,
+							new String[] { "src1" }), };
 
 			DLTKCore.setBuildpathVariable("var", new Path("/P1var"), null);
 
-			IBuildpathEntry[] newBuildpath = new IBuildpathEntry[] { DLTKCore.newSourceEntry(new Path("/P0var/src0")), DLTKCore.newVariableEntry(new Path("var/src1")), };
+			IBuildpathEntry[] newBuildpath = new IBuildpathEntry[] {
+					DLTKCore.newSourceEntry(new Path("/P0var/src0")),
+					DLTKCore.newVariableEntry(new Path("var/src1")), };
 
 			// validate Buildpath
-			IModelStatus status = BuildpathEntry.validateBuildpath(p[0], newBuildpath);
-			assertStatus("should not detect external source folder through a variable on the buildpath", "OK", status);
+			IModelStatus status = BuildpathEntry.validateBuildpath(p[0],
+					newBuildpath);
+			assertStatus(
+					"should not detect external source folder through a variable on the buildpath",
+					"OK", status);
 
 		} finally {
 			this.deleteProject("P0var");
 			this.deleteProject("P1var");
 		}
 	}
-	
+
 	public void testBuildpathValidation05() throws CoreException {
 
 		IScriptProject[] p = null;
@@ -1108,4 +1119,20 @@
 			this.deleteProjects(new String[] { "P1c", "P2c" });
 		}
 	}
+
+	public void testGetProjectFragmentByResource() throws CoreException,
+			IOException {
+		try {
+			setUpScriptProject(BUILDPATH_PRJ_4);
+			String folderName = "library";
+			IModelElement element = DLTKCore.create(getWorkspaceRoot()
+					.getFolder(new Path(BUILDPATH_PRJ_4 + "/" + folderName)));
+			assertNotNull(element);
+			assertEquals(IModelElement.PROJECT_FRAGMENT, element
+					.getElementType());
+			assertEquals(folderName, element.getElementName());
+		} finally {
+			deleteProject(BUILDPATH_PRJ_4);
+		}
+	}
 }
diff --git a/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/.buildpath b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/.buildpath
new file mode 100644
index 0000000..b056b25
--- /dev/null
+++ b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/.buildpath
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+	<buildpathentry excluding="library/" kind="src" path=""/>
+	<buildpathentry kind="src" path="library"/>
+</buildpath>
diff --git a/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/.project b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/.project
new file mode 100644
index 0000000..158aa76
--- /dev/null
+++ b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/.project
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ModelMembers</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<natures>
+		<nature>org.eclipse.dltk.core.tests.testnature</nature>
+	</natures>
+</projectDescription>
diff --git a/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/X.txt b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/X.txt
new file mode 100644
index 0000000..33448e1
--- /dev/null
+++ b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/X.txt
@@ -0,0 +1,3 @@
+public class X {
+  //this content is never used
+}
\ No newline at end of file
diff --git a/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/library/Y.txt b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/library/Y.txt
new file mode 100644
index 0000000..2924b36
--- /dev/null
+++ b/core/tests/org.eclipse.dltk.core.tests/workspace/Buildpath4/library/Y.txt
@@ -0,0 +1,3 @@
+public class Y {
+  //this content is never used
+}
\ No newline at end of file