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

The following examples show how to use org.eclipse.jface.dialogs.MessageDialogWithToggle#ALWAYS . 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: DialogUtils.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * openIgnoreMessageDialogConfirm
 * 
 * @param shell
 * @param title
 * @param message
 * @param store
 * @param key
 *            Key to store the show/hide this message. Message will be hidden if true
 * @return int
 */
public static int openIgnoreMessageDialogConfirm(Shell shell, String title, String message, IPreferenceStore store,
		String key)
{
	String value = store.getString(key);
	if (!shouldShowDialog(key))
	{
		return value == MessageDialogWithToggle.ALWAYS ? IDialogConstants.YES_ID : IDialogConstants.NO_ID;
	}
	MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(shell, title, message,
			Messages.DialogUtils_doNotShowMessageAgain, false, store, key);
	if (dialog.getToggleState())
	{
		setShouldShowDialog(key, false);
		store.putValue(key, dialog.getReturnCode() == IDialogConstants.YES_ID ? MessageDialogWithToggle.ALWAYS
				: MessageDialogWithToggle.NEVER);
	}
	return dialog.getReturnCode();
}
 
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: CrosstabAdaptUtil.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static boolean needRemoveInvaildBindings(
		CrosstabReportItemHandle handle )
{
	String preferenceData = PreferenceFactory.getInstance( )
			.getPreferences( CrosstabPlugin.getDefault( ) )
			.getString( CrosstabPlugin.PREFERENCE_AUTO_DEL_BINDINGS );
	if ( preferenceData == null
			|| preferenceData.length( ) == 0
			|| preferenceData.equals( MessageDialogWithToggle.PROMPT ) )
	{
		MessageDialogWithToggle msgDlg = MessageDialogWithToggle.openYesNoQuestion( UIUtil.getDefaultShell( ),
				Messages.getString( "DeleteBindingDialog.Title" ), //$NON-NLS-1$
				Messages.getString( "DeleteBindingDialog.Message" ), //$NON-NLS-1$
				Messages.getString( "DeleteBindingDialog.ToggleMessage" ), //$NON-NLS-1$
				false,
				null,
				null );

		if ( msgDlg.getToggleState( ) )
		{
			String value = "";
			if ( msgDlg.getReturnCode( ) == IDialogConstants.YES_ID )
			{
				value = MessageDialogWithToggle.ALWAYS;
			}
			else if ( msgDlg.getReturnCode( ) == IDialogConstants.NO_ID )
			{
				value = MessageDialogWithToggle.NEVER;
			}
			PreferenceFactory.getInstance( )
					.getPreferences( CrosstabPlugin.getDefault( ) )
					.setValue( CrosstabPlugin.PREFERENCE_AUTO_DEL_BINDINGS,
							value );
		}
		if ( msgDlg.getReturnCode( ) == IDialogConstants.YES_ID )
		{
			return true;
			// removeInvalidBindings( handle );
		}
		else if ( msgDlg.getReturnCode( ) == IDialogConstants.NO_ID )
		{
			return false;
			// dothing
		}

	}
	else if ( preferenceData != null
			&& preferenceData.equals( MessageDialogWithToggle.ALWAYS ) )
	{
		return true;
		// removeInvalidBindings( handle );
	}
	return false;
	// removeInvalidBindings(handle);
}