Source:
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getActivePart(event).getSite().getWorkbenchWindow().getSelectionService().getSelection(); IResourceUIModel[] resources = UIUtils.getElements(selection, IResourceUIModel.class); if(resources == null || resources.length == 0) { return OpenShiftUIActivator.statusFactory().cancelStatus("No resource selected that we can delete."); } try (Stream<IResourceUIModel> stream = Arrays.stream(resources)) { boolean willDeleteSubResources = stream.anyMatch(resource -> Platform.getAdapterManager().getAdapter(resource.getResource(), ResourceProcessor.class).willCascadeDeleteLinkedResources()); boolean confirm; String message = (resources.length > 1)?(willDeleteSubResources)?OpenShiftUIMessages.ResourceWithLinkedResourcesDeletionConfirmationN:OpenShiftUIMessages.ResourceDeletionConfirmationN :(willDeleteSubResources)?NLS.bind(OpenShiftUIMessages.ResourceWithLinkedResourcesDeletionConfirmation, resources[0].getResource().getName(), resources[0].getResource().getKind()): NLS.bind(OpenShiftUIMessages.ResourceDeletionConfirmation, resources[0].getResource().getName(), resources[0].getResource().getKind()); if (willDeleteSubResources) { int status = new CheckboxMessageDialog(HandlerUtil.getActiveShell(event), OpenShiftUIMessages.ResourceDeletionDialogTitle, message, "Cascade delete").open(); confirm = ((status & 0x01) == 0); willDeleteSubResources = (status & 0x02) == 2; } else { confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), OpenShiftUIMessages.ResourceDeletionDialogTitle, message); } if (confirm) { deleteResources(resources, willDeleteSubResources); } return null; } }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getActivePart(event).getSite().getWorkbenchWindow().getSelectionService().getSelection(); IResourceUIModel[] resources = UIUtils.getElements(selection, IResourceUIModel.class); if(resources == null || resources.length == 0) { return OpenShiftUIActivator.statusFactory().cancelStatus("No resource selected that we can delete."); } try (Stream<IResourceUIModel> stream = Arrays.stream(resources)) { boolean willDeleteSubResources = stream.anyMatch(resource -> Platform.getAdapterManager().getAdapter(resource.getResource(), ResourceProcessor.class).willCascadeDeleteLinkedResources()); boolean confirm; String message = (resources.length > 1)?(willDeleteSubResources)?OpenShiftUIMessages.ResourceWithLinkedResourcesDeletionConfirmationN:OpenShiftUIMessages.ResourceDeletionConfirmationN :(willDeleteSubResources)?NLS.bind(OpenShiftUIMessages.ResourceWithLinkedResourcesDeletionConfirmation, resources[0].getResource().getName(), resources[0].getResource().getKind()): NLS.bind(OpenShiftUIMessages.ResourceDeletionConfirmation, resources[0].getResource().getName(), resources[0].getResource().getKind()); if (willDeleteSubResources) { int status = new CheckboxMessageDialog(HandlerUtil.getActiveShell(event), OpenShiftUIMessages.ResourceDeletionDialogTitle, message, "Cascade delete").open(); confirm = ((status & Window.CANCEL) == 0); willDeleteSubResources = (status & CheckboxMessageDialog.CHECKBOX_SELECTED) == CheckboxMessageDialog.CHECKBOX_SELECTED; } else { confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), OpenShiftUIMessages.ResourceDeletionDialogTitle, message); } if (confirm) { deleteResources(resources, willDeleteSubResources); } return null; } }