* Also used by RepositoryMainController
*
* @param ureq
*/
void doLaunch(UserRequest ureq) {
RepositoryHandler typeToLaunch = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
if (typeToLaunch == null){
StringBuilder sb = new StringBuilder(translate("error.launch"));
sb.append(": No launcher for repository entry: ");
sb.append(repositoryEntry.getKey());
throw new OLATRuntimeException(RepositoryDetailsController.class,sb.toString(), null);
}
if (RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) == null) {
showInfo("info.entry.deleted");
return;
}
RepositoryManager.getInstance().incrementLaunchCounter(repositoryEntry);
OLATResourceable ores = repositoryEntry.getOlatResource();
String displayName = getDisplayName(ureq.getLocale());
//was brasato:: DTabs dts = getWindowControl().getDTabs();
DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
DTab dt = dts.getDTab(ores);
if (dt == null) {
// does not yet exist -> create and add
dt = dts.createDTab(ores, displayName);
if (dt == null) return;
// build up the context path
OLATResourceable businessOres = repositoryEntry;
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(businessOres);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, dt.getWindowControl());
Controller ctrl = typeToLaunch.getLaunchController(ores, null, ureq, bwControl);
// if resource is an image, PDF or eq. (e.g. served by resulting media request), no controller is returned.
// FIXME:fj:test this
if (ctrl == null) return;
dt.setController(ctrl);
dts.addDTab(dt);