public final void run() { if (!fShell.isDisposed()) { final String count= new Integer(fCount).toString(); String message= null; if (fProject != null) message= Messages.format(RefactoringUIMessages.RefactoringPropertyPage_confirm_delete_pattern, new String[] { count, fProject.getName()}); else message= Messages.format(ScriptingMessages.ShowRefactoringHistoryWizard_confirm_deletion, count); final MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(fShell, RefactoringUIMessages.RefactoringPropertyPage_confirm_delete_caption, message, RefactoringUIMessages.RefactoringHistoryWizard_do_not_show_message, store.getBoolean(PREFERENCE_DO_NOT_WARN_DELETE), null, null); store.setValue(PREFERENCE_DO_NOT_WARN_DELETE, dialog.getToggleState()); fReturnCode= dialog.getReturnCode(); } } });
/** * Asks the user whether he wants to configure a user dictionary. * * @param shell the shell * @return <code>true</code> if the user wants to configure the user dictionary * @since 3.3 */ private boolean askUserToConfigureUserDictionary(Shell shell) { MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( shell, JavaUIMessages.Spelling_add_askToConfigure_title, JavaUIMessages.Spelling_add_askToConfigure_question, JavaUIMessages.Spelling_add_askToConfigure_ignoreMessage, false, null, null); PreferenceConstants.getPreferenceStore().setValue(PREF_KEY_DO_NOT_ASK, toggleDialog.getToggleState()); return toggleDialog.getReturnCode() == IDialogConstants.YES_ID; }
/** * Asks the user whether he wants to configure * a user dictionary. * * @param shell * @return <code>true</code> if the user wants to configure the user dictionary * @since 3.3 */ private boolean askUserToConfigureUserDictionary(Shell shell) { MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( shell, JavaUIMessages.Spelling_add_askToConfigure_title, JavaUIMessages.Spelling_add_askToConfigure_question, JavaUIMessages.Spelling_add_askToConfigure_ignoreMessage, false, null, null); PreferenceConstants.getPreferenceStore().setValue(PREF_KEY_DO_NOT_ASK, toggleDialog.getToggleState()); return toggleDialog.getReturnCode() == IDialogConstants.YES_ID; }
/** * Asks the user whether he wants to configure a user dictionary. * * @param shell the shell * @return <code>true</code> if the user wants to configure the user dictionary * @since 3.3 */ private boolean askUserToConfigureUserDictionary(Shell shell) { MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( shell, JavaUIMessages.Spelling_add_askToConfigure_title, JavaUIMessages.Spelling_add_askToConfigure_question, JavaUIMessages.Spelling_add_askToConfigure_ignoreMessage, false, null, null); PreferenceConstants.getPreferenceStore().setValue(PREF_KEY_DO_NOT_ASK, toggleDialog.getToggleState()); return toggleDialog.getReturnCode() == IDialogConstants.YES_ID; }
/** * Returns the preference for whether to open required projects when opening * a project. Consults the preference and prompts the user if necessary. * * @return <code>true</code> if referenced projects should be opened, and * <code>false</code> otherwise. */ private boolean promptToOpenWithReferences() { IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); String key = IDEInternalPreferences.OPEN_REQUIRED_PROJECTS; String value = store.getString(key); if (MessageDialogWithToggle.ALWAYS.equals(value)) { return true; } if (MessageDialogWithToggle.NEVER.equals(value)) { return false; } String message = IDEWorkbenchMessages.OpenResourceAction_openRequiredProjects; MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(getShell(), IDEWorkbenchMessages.Question, message, null, false, store, key); int result = dialog.getReturnCode(); // the result is equal to SWT.DEFAULT if the user uses the 'esc' key to close the dialog if (result == Window.CANCEL || result == SWT.DEFAULT) { throw new OperationCanceledException(); } return dialog.getReturnCode() == IDialogConstants.YES_ID; }
String choice = preferences.getString(IPreferenceConstants.PROP_PROMPT_REMOVE_TARGET); if (!MessageDialogWithToggle.ALWAYS.equalsIgnoreCase(choice)) { MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(getShell(), PDEUIMessages.TargetPlatformPreferencePage2_19, PDEUIMessages.TargetPlatformPreferencePage2_20, PDEUIMessages.TargetPlatformPreferencePage2_21, false, PDEPlugin.getDefault().getPreferenceStore(), IPreferenceConstants.PROP_PROMPT_REMOVE_TARGET); preferences.savePluginPreferences(); if (dialog.getReturnCode() != IDialogConstants.YES_ID) {
message = NLS.bind(TeamUIMessages.SynchronizeManager_32, new String[] { perspectiveDescriptor.getLabel(), desc }); MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(Utils.getShell(null), TeamUIMessages.SynchronizeManager_27, message,
message = NLS.bind(TeamUIMessages.SynchronizeManager_32, new String[] { perspectiveDescriptor.getLabel(), desc }); MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(Utils.getShell(null), TeamUIMessages.SynchronizeManager_27, message,
return true; MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( shell, ActionMessages.ActionUtil_warning_derived_title,
return true; MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( getSite().getShell(), TextEditorMessages.AbstractDecoratedTextEditor_warning_derived_title,
MessageDialogWithToggle dlg = MessageDialogWithToggle.openYesNoQuestion(SQLEditorPlugin .getActiveWorkbenchShell(), Messages.getString("GroupPlanSupportRunnable.continue_explain"), //$NON-NLS-1$ Messages.getString("GroupPlanSupportRunnable.error_info"), //$NON-NLS-1$
public boolean validateToolsJAR() { validated++; boolean check = AntUIPlugin.getDefault().getPreferenceStore().getBoolean(IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING); if (check && !AntUIPlugin.isMacOS()) { Object[] entries = antContentProvider.getModel().getEntries(ClasspathModel.ANT_HOME); boolean valid = !JARPresent(entries, TOOLS).isEmpty(); if (!valid) { entries = antContentProvider.getModel().getEntries(ClasspathModel.GLOBAL_USER); valid = !JARPresent(entries, TOOLS).isEmpty(); if (!valid) { entries = antContentProvider.getModel().getEntries(ClasspathModel.USER); valid = !JARPresent(entries, TOOLS).isEmpty(); if (!valid) { MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(AntUIPlugin.getActiveWorkbenchWindow().getShell(), AntPreferencesMessages.AntClasspathBlock_31, AntPreferencesMessages.AntClasspathBlock_32, AntPreferencesMessages.AntClasspathBlock_33, false, AntUIPlugin.getDefault().getPreferenceStore(), IAntUIPreferenceConstants.ANT_TOOLS_JAR_WARNING); valid = dialog.getReturnCode() == IDialogConstants.YES_ID; } } } if (!valid) { container.setErrorMessage(AntPreferencesMessages.AntClasspathBlock_34); setValidated(); } return valid; } return true; }
MessageDialogWithToggle dlg = MessageDialogWithToggle.openYesNoQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() , Messages.GroupSQLResultRunnable_title, Messages.GroupSQLResultRunnable_message,
return true; MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( getSite().getShell(), TextEditorMessages.AbstractDecoratedTextEditor_warning_derived_title,
boolean proceed = true; if (prompt) { MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(window.getShell(), ActionMessages.RemoveAllTriggerPointsAction_0, ActionMessages.RemoveAllTriggerPointsAction_1, ActionMessages.RemoveAllBreakpointsAction_3, !prompt, null, null); if (mdwt.getReturnCode() != IDialogConstants.YES_ID) { proceed = false;
public final void widgetSelected(final SelectionEvent event) { final IProject project= getCurrentProject(); if (project != null) { final IRunnableContext context= new ProgressMonitorDialog(getShell()); final IPreferenceStore store= RefactoringUIPlugin.getDefault().getPreferenceStore(); MessageDialogWithToggle dialog= null; if (!store.getBoolean(PREFERENCE_DO_NOT_WARN_DELETE_ALL) && !fHistoryControl.getInput().isEmpty()) { dialog= MessageDialogWithToggle.openYesNoQuestion(getShell(), RefactoringUIMessages.RefactoringPropertyPage_confirm_delete_all_caption, Messages.format(RefactoringUIMessages.RefactoringPropertyPage_confirm_delete_all_pattern, project.getName()), RefactoringUIMessages.RefactoringHistoryWizard_do_not_show_message, false, null, null); store.setValue(PREFERENCE_DO_NOT_WARN_DELETE_ALL, dialog.getToggleState()); } if (dialog == null || dialog.getReturnCode() == IDialogConstants.YES_ID) promptDeleteHistory(context, project); } } });
@Override public void run(IAction action) { IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); if (window != null) { IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); boolean prompt = store.getBoolean(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS); boolean proceed = true; if (prompt) { MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(window.getShell(), ActionMessages.RemoveAllExpressionsAction_0, ActionMessages.RemoveAllExpressionsAction_1, ActionMessages.RemoveAllBreakpointsAction_3, !prompt, null, null); if(mdwt.getReturnCode() != IDialogConstants.YES_ID){ proceed = false; } else { store.setValue(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, !mdwt.getToggleState()); } } if (proceed) { IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager(); IExpression[] expressions= manager.getExpressions(); manager.removeExpressions(expressions); } } }
public static boolean isEditable(Shell shell, IJavaElement element) { if (! isProcessable(shell, element)) return false; IJavaElement cu= element.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) { IResource resource= cu.getResource(); if (resource != null && resource.isDerived(IResource.CHECK_ANCESTORS)) { // see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#validateEditorInputState() final String warnKey= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED; IPreferenceStore store= EditorsUI.getPreferenceStore(); if (!store.getBoolean(warnKey)) return true; MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( shell, ActionMessages.ActionUtil_warning_derived_title, Messages.format(ActionMessages.ActionUtil_warning_derived_message, BasicElementLabels.getPathLabel(resource.getFullPath(), false)), ActionMessages.ActionUtil_warning_derived_dontShowAgain, false, null, null); EditorsUI.getPreferenceStore().setValue(warnKey, !toggleDialog.getToggleState()); return toggleDialog.getReturnCode() == IDialogConstants.YES_ID; } } return true; }
public static boolean isEditable(Shell shell, IJavaElement element) { if (! isProcessable(shell, element)) return false; IJavaElement cu= element.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) { IResource resource= cu.getResource(); if (resource != null && resource.isDerived(IResource.CHECK_ANCESTORS)) { // see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#validateEditorInputState() final String warnKey= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED; IPreferenceStore store= EditorsUI.getPreferenceStore(); if (!store.getBoolean(warnKey)) return true; MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion( shell, ActionMessages.ActionUtil_warning_derived_title, Messages.format(ActionMessages.ActionUtil_warning_derived_message, BasicElementLabels.getPathLabel(resource.getFullPath(), false)), ActionMessages.ActionUtil_warning_derived_dontShowAgain, false, null, null); EditorsUI.getPreferenceStore().setValue(warnKey, !toggleDialog.getToggleState()); return toggleDialog.getReturnCode() == IDialogConstants.YES_ID; } } return true; }
MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(DebugUIPlugin.getShell(), ActionMessages.LaunchAction_0, MessageFormat.format(ActionMessages.LaunchAction_1, new Object[] { fConfiguration.getName() }),