Java Code Examples for org.eclipse.jface.dialogs.MessageDialogWithToggle#PROMPT

The following examples show how to use org.eclipse.jface.dialogs.MessageDialogWithToggle#PROMPT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PyDialogHelpers.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public static boolean openQuestionWithIgnoreToggle(String title, String message, String key) {
    Shell shell = EditorUtils.getShell();
    IPreferenceStore store = PydevPlugin.getDefault().getPreferenceStore();
    String val = store.getString(key);
    if (val.trim().length() == 0) {
        val = MessageDialogWithToggle.PROMPT; //Initial value if not specified
    }

    if (!val.equals(MessageDialogWithToggle.ALWAYS)) {
        MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(shell, title, message,
                "Don't show this message again", false, store,
                key);
        if (dialog.getReturnCode() != IDialogConstants.YES_ID) {
            return false;
        }
    }
    return true;
}
 
Example 2
Source File: PerspectivesPreferencePage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void createFieldEditors() {

    RadioGroupFieldEditor switchToPerspective = new RadioGroupFieldEditor(
            ITmfUIPreferences.SWITCH_TO_PERSPECTIVE,
            Messages.PerspectivesPreferencePage_SwitchToPerspectiveGroupText,
            3,
            new String[][] {
                { Messages.PerspectivesPreferencePage_SwitchToPerspectiveAlways, MessageDialogWithToggle.ALWAYS },
                { Messages.PerspectivesPreferencePage_SwitchToPerspectiveNever, MessageDialogWithToggle.NEVER },
                { Messages.PerspectivesPreferencePage_SwitchToPerspectivePrompt, MessageDialogWithToggle.PROMPT }},
            getFieldEditorParent(),
            true);
    addField(switchToPerspective);
}
 
Example 3
Source File: SaveAndLaunchPromptDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected void okPressed()
{
	IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
	String val = (savePref.getSelection() ? MessageDialogWithToggle.ALWAYS : MessageDialogWithToggle.PROMPT);
	store.setValue(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, val);
	super.okPressed();
}
 
Example 4
Source File: PyDialogHelpers.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public static int openWarningWithIgnoreToggle(String title, String message, String key) {
    Shell shell = EditorUtils.getShell();
    IPreferenceStore store = PydevPlugin.getDefault().getPreferenceStore();
    String val = store.getString(key);
    if (val.trim().length() == 0) {
        val = MessageDialogWithToggle.PROMPT; //Initial value if not specified
    }

    if (!val.equals(MessageDialogWithToggle.ALWAYS)) {
        MessageDialogWithToggle.openWarning(shell, title, message, "Don't show this message again", false, store,
                key);
    }
    return MessageDialog.OK;
}
 
Example 5
Source File: DontAskAgainPreferences.java    From xtext-eclipse with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Returns the stored user answer to the question identified with the passed key.
 *
 * @param key
 *            unique identifier . Represents the key to use when storing or reading the setting.
 *
 * @return User decision for the corresponding question. Value is one of type <code>String</code> and is one of
 *         {@link org.eclipse.jface.dialogs.MessageDialogWithToggle#ALWAYS},
 *         {@link org.eclipse.jface.dialogs.MessageDialogWithToggle#NEVER} or (default)
 *         {@link org.eclipse.jface.dialogs.MessageDialogWithToggle#PROMPT}. Never <code>null</code>
 */
public String getUserDecision(String key) {
	String userDecision = getDontAskAgainDialogSettings().get(key);
	if (userDecision == null) {
		userDecision = MessageDialogWithToggle.PROMPT;
	}
	return userDecision;
}