}
private void handleWarnings(Collection<AbstractComponent> toDelete, Collection<AbstractComponent> toRemove,
Collection<AbstractComponent> cannotRemove) {
// Get references to platform and window manager; these will be used a few times
Platform platform = PlatformAccess.getPlatform();
WindowManager windowManager = platform.getWindowManager();
// Can only complete action if there are no components which cannot be removed
if (cannotRemove.isEmpty()) {
String confirm = bundle.getString("DeleteAllCoreText");
String abort = bundle.getString("DeleteAllAbortText");
String[] options = { confirm, abort };
// Issue a warning dialog to the user
Map<String, Object> hints = new HashMap<String, Object>();
hints.put(WindowManagerImpl.PARENT_COMPONENT, actionContext.getWindowManifestation());
hints.put(WindowManagerImpl.OPTION_TYPE, OptionBox.YES_NO_OPTION);
hints.put(WindowManagerImpl.MESSAGE_TYPE, OptionBox.WARNING_MESSAGE);
hints.put(WindowManagerImpl.MESSAGE_OBJECT, buildWarningPanel(toDelete, toRemove));
String choice = windowManager.showInputDialog(
WARNING, //title
"", // message - will be overridden by custom object
options, // options
null, // default option
hints); // hints
// Complete the action, if the user has confirmed it
if (confirm.equals(choice)) {
for (AbstractComponent delete : toDelete) {
windowManager.closeWindows(delete.getComponentId());
}
platform.getPersistenceProvider().delete(toDelete);
}
} else {
// Some components cannot be removed safely - let the user know this
String ok = bundle.getString("DeleteAllErrorConfirm");
Map<String, Object> hints = new HashMap<String, Object>();