ViewPath vPath = new ViewPath(route.getViewPath());
if (!vPath.isValid())
return null;
IType type = null;
IType[] controllers = findBundleControllers(vPath.getBundle(), project);
if (controllers == null) {
String msg = "Unable to find bundle controllers ";
if (vPath != null)
msg += vPath.getBundle();
if (project != null) {
msg += " project: " + project.getElementName();
}
Logger.debugMSG(msg);
return null;
}
String ctrl = vPath.getController() + "Controller";
for (IType t : controllers) {
if (t.getElementName().equals(ctrl)) {
type = t;
break;
}
}
if (type == null) {
return null;
}
IMethod method = type.getMethod(vPath.getTemplate() + "Action");
if (method != null)
return method;
return type.getMethod(vPath.getTemplate());
}