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);
}
dts.activate(ureq, dt, RepositoryDetailsController.ACTIVATE_RUN);
/**
* close detail page after resource is closed
* DONE_EVENT will be catched by RepositoryMainController
*/
fireEvent(ureq, Event.DONE_EVENT);