Source:
static boolean promptOnExit(Shell parentShell) { IPreferenceStore store = IDEWorkbenchPlugin.getDefault() .getPreferenceStore(); boolean promptOnExit = store .getBoolean(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW); if (promptOnExit) { if (parentShell == null) { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow != null) { parentShell = workbenchWindow.getShell(); } } if (parentShell != null) { parentShell.setMinimized(false); parentShell.forceActive(); } String message; String productName = null; IProduct product = Platform.getProduct(); if (product != null) { productName = product.getName(); } if (productName == null) { message = IDEWorkbenchMessages.PromptOnExitDialog_message0; } else { message = NLS.bind( IDEWorkbenchMessages.PromptOnExitDialog_message1, productName); } Map<String, Integer> buttonLabelToIdMap = new LinkedHashMap<>(); buttonLabelToIdMap.put(IDEWorkbenchMessages.PromptOnExitDialog_button_label_exit, IDialogConstants.OK_ID); buttonLabelToIdMap.put(IDEWorkbenchMessages.PromptOnExitDialog_button_label_cancel, IDialogConstants.CANCEL_ID); MessageDialogWithToggle dlg = MessageDialogWithToggle.open(MessageDialog.CONFIRM, parentShell, IDEWorkbenchMessages.PromptOnExitDialog_shellTitle, message, IDEWorkbenchMessages.PromptOnExitDialog_choice, false, null, null, SWT.NONE, buttonLabelToIdMap); if (dlg.getReturnCode() != IDialogConstants.OK_ID) { return false; } if (dlg.getToggleState()) { store .setValue( IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, false); IDEWorkbenchPlugin.getDefault().savePluginPreferences(); } } return true; }

Target:
static boolean promptOnExit(Shell parentShell) { IPreferenceStore store = IDEWorkbenchPlugin.getDefault() .getPreferenceStore(); boolean promptOnExit = store .getBoolean(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW); if (promptOnExit) { if (parentShell == null) { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow != null) { parentShell = workbenchWindow.getShell(); } } if (parentShell != null) { parentShell.setMinimized(false); parentShell.forceActive(); } String message; String productName = null; IProduct product = Platform.getProduct(); if (product != null) { productName = product.getName(); } if (productName == null) { message = IDEWorkbenchMessages.PromptOnExitDialog_message0; } else { message = NLS.bind( IDEWorkbenchMessages.PromptOnExitDialog_message1, productName); } Map<String, Integer> buttonLabelToIdMap = new LinkedHashMap<>(); buttonLabelToIdMap.put(IDEWorkbenchMessages.PromptOnExitDialog_button_label_exit, IDialogConstants.OK_ID); buttonLabelToIdMap.put(IDialogConstants.CANCEL_LABEL, IDialogConstants.CANCEL_ID); MessageDialogWithToggle dlg = MessageDialogWithToggle.open(MessageDialog.CONFIRM, parentShell, IDEWorkbenchMessages.PromptOnExitDialog_shellTitle, message, IDEWorkbenchMessages.PromptOnExitDialog_choice, false, null, null, SWT.NONE, buttonLabelToIdMap); if (dlg.getReturnCode() != IDialogConstants.OK_ID) { return false; } if (dlg.getToggleState()) { store .setValue( IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, false); IDEWorkbenchPlugin.getDefault().savePluginPreferences(); } } return true; }