package uk.co.uwcs.choob.modules;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;

class ChoobURLStreamHandler extends URLStreamHandler {
	@Override
	protected URLConnection openConnection(URL u) throws IOException {
		final String path = u.getPath();

		{
			final URL resource = ChoobURLStreamHandler.class.getResource(path);
			if (null != resource)
				return resource.openConnection();
		}

		for (File sourcePath : new File[] {
				new File("src/main/plugins-alpha"),
				new File("src/main/plugins"),
		}) {
			final File f = new File(sourcePath, u.getPath());
			if (f.isFile())
				return new URL("file:///" + f.getAbsolutePath()).openConnection();
		}

		throw new FileNotFoundException("Couldn't resolve '" + path + "' from the classpath or source directories");
	}
}

@@ -559,36 +559,32 @@
 %7B%0A%09%09%09%09new File(%22
-src/
 main/plugins-alp
@@ -607,12 +607,8 @@
 le(%22
-src/
 main

Fix Eclipse resolution of plugins; this may be different in other IDEs