TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
if (actionid.equals("empty")) {
int rowid = te.getRowId();
String cname = cnames[rowid];
Cache toEmpty = cm.getCache(cname);
//provide dc as argument, this ensures that dc is disposed before newly created
dc = activateYesNoDialog(ureq, null, translate("confirm.emptycache"), dc);
//remember Cache to be emptied if yes is chosen
dc.setUserObject(toEmpty);
//activateYesNoDialog means that this controller listens to it, and dialog is shown on screen.
//nothing further to do here!
return;
}
}
}
else if (source == dc) {
//the dialogbox is already removed from the gui stack - do not use getWindowControl().pop(); to remove dialogbox
if (DialogBoxUIFactory.isYesEvent(event)) { // ok
String cacheName = null;
try {
// delete cache
Cache c = (Cache)dc.getUserObject();
cacheName = c.getName();
c.removeAll();
} catch (IllegalStateException e) {
// ignore
log.error("Cannot remove Cache:"+cacheName, e);
}
// update tablemodel