protected URL _getResource(String path) {
URL url = super._getResource(path);
if (url != null) {
return url;
}
IUser user = null;
IPath ipath = new Path(path);
if (ipath.segment(0).equals(contextPathSegment)) {
ipath = ipath.removeFirstSegments(1);
}
if (ipath.segment(0).equals("maqetta")) {
if (ipath.segment(1).equals("user")) {
ipath = ipath.removeFirstSegments(2);
String userName = ipath.segment(0);
try {
user = userManager.getUser(userName);
} catch (UserException e) {
// TODO surface error up the stack
e.printStackTrace();
return null;
} catch (IOException e) {
// TODO surface error up the stack
e.printStackTrace();
return null;
}
ipath = ipath.removeFirstSegments(1);
if (ipath.segment(0).equals("ws") && ipath.segment(1).equals("workspace")) {
ipath = ipath.removeFirstSegments(2);
}
} else {
user = userManager.getSingleUser();
}
int removecount = 0;
if (ipath.segment(0).equals(".review")) {
removecount = 4;
} else {
removecount = user.getResource(ipath.segment(0)+"/.project") == null ? 1 : 2;
}
ILibInfo[] projectLibs = user.getLibs(ipath.segment(0));
url = scanSrcLibs(ipath, removecount, projectLibs);
if (url != null) {
return url;
}
}
IVResource resource = user.getResource(ipath.toString());
if (resource != null) {
try {
if (logger.isLoggable(Level.FINEST)) {
logger.logp(Level.FINEST, getClass().getName(), "_getResource", "resource ["+path +"] loaded from project");
}