*/
@Override
@SuppressWarnings("unused")
protected void event(UserRequest ureq, Component source, Event event) {
if (source == restartLink) {
DTabs dts = (DTabs) getWindowControl().getWindowBackOffice().getWindow().getAttribute("DTabs");
OLATResourceable ores = OLATResourceManager.getInstance().findResourceable(
courseRepositoryEntry.getOlatResource().getResourceableId(), courseRepositoryEntry.getOlatResource().getResourceableTypeName());
if(ores==null) {
//course was deleted!
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, this.getWindowControl(), translate("course.deleted.title"), translate("course.deleted.text"));
panel.setContent(msgController.getInitialComponent());
return;
}
DTab dt = dts.getDTab(ores);
// remove and dispose "old course run"
dts.removeDTab(dt);//disposes also dt and controllers
/*
* create new tab with "refreshed course run" and activate the course
*/
dt = dts.createDTab(ores, courseRepositoryEntry.getDisplayname());
if (dt == null) return; // full tabs -> warning already set by
// dts.create...
Controller launchController = ControllerFactory.createLaunchController(ores, null, ureq, dt.getWindowControl(), true);
dt.setController(launchController);
dts.addDTab(dt);
dts.activate(ureq, dt, null);
/*
* last but not least dispose myself - to clean up.
*/
dispose();
}