PL-8610 Close standard Remove Confirmation dialog if delete has failed because of deletion policy

This commit is contained in:
Konstantin Krivopustov 2017-03-28 11:28:04 +04:00
parent d504b51a88
commit 6cc99b5932
2 changed files with 16 additions and 3 deletions

View File

@ -219,7 +219,17 @@ public class RemoveAction extends ItemTrackingAction implements Action.HasBefore
new DialogAction(Type.OK, Status.PRIMARY) {
@Override
public void actionPerform(Component component) {
try {
remove(selected);
} finally {
target.requestFocus();
try {
//noinspection unchecked
target.setSelected(selected);
} catch (Exception e) {
// ignore
}
}
}
},
new DialogAction(Type.CANCEL) {

View File

@ -1262,8 +1262,11 @@ public class WebWindowManager extends WindowManager {
Button button = WebComponentsHelper.createButton();
button.setCaption(action.getCaption());
button.addClickListener(event -> {
try {
action.actionPerform(null);
} finally {
ui.removeWindow(window);
}
});
if (StringUtils.isNotEmpty(action.getIcon())) {