當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageDialogWithToggle類代碼示例

本文整理匯總了Java中org.eclipse.jface.dialogs.MessageDialogWithToggle的典型用法代碼示例。如果您正苦於以下問題:Java MessageDialogWithToggle類的具體用法?Java MessageDialogWithToggle怎麽用?Java MessageDialogWithToggle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MessageDialogWithToggle類屬於org.eclipse.jface.dialogs包,在下文中一共展示了MessageDialogWithToggle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createFieldEditors

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
@Override
protected void createFieldEditors() {

    addField( new ComboFieldEditor(PG_EDIT_PREF.PERSPECTIVE_CHANGING_STATUS,
            Messages.generalPrefPage_perspective_changing_status, new String[][] {
        {Messages.prespective_change_status_always, MessageDialogWithToggle.ALWAYS},
        {Messages.prespective_change_status_never, MessageDialogWithToggle.NEVER},
        {Messages.prespective_change_status_ask, MessageDialogWithToggle.PROMPT}},
            getFieldEditorParent()));

    addField( new ComboFieldEditor(PG_EDIT_PREF.EDITOR_UPDATE_ACTION,
            Messages.ProjectEditorPrefPage_action_type, new String[][] {
        {Messages.ProjectEditorPrefPage_action_update, PG_EDIT_PREF.UPDATE},
        {Messages.ProjectEditorPrefPage_action_reset, PG_EDIT_PREF.RESET},
        {Messages.ProjectEditorPrefPage_action_no_action, PG_EDIT_PREF.NO_ACTION}},
            getFieldEditorParent()));
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:18,代碼來源:ProjectEditorPrefPage.java

示例2: askDeleteScript

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
public void askDeleteScript(IFile f) {
    String mode = mainPrefs.getString(DB_UPDATE_PREF.DELETE_SCRIPT_AFTER_CLOSE);
    // if select "YES" with toggle
    if (mode.equals(MessageDialogWithToggle.ALWAYS)){
        deleteFile(f);
        // if not select "NO" with toggle, show choice message dialog
    } else if (!mode.equals(MessageDialogWithToggle.NEVER)){
        MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(getSite().getShell(),
                Messages.SqlEditor_script_delete_dialog_title, MessageFormat.format(
                        Messages.SqlEditor_script_delete_dialog_message, f.getName()),
                Messages.remember_choice_toggle, false, mainPrefs, DB_UPDATE_PREF.DELETE_SCRIPT_AFTER_CLOSE);
        if(dialog.getReturnCode() == IDialogConstants.YES_ID){
            deleteFile(f);
        }
    }
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:17,代碼來源:SQLEditor.java

示例3: createSaveJobPromtGroup

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * @param selection
 */
private void createSaveJobPromtGroup(String selection) {
	HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
	hydroGroup.setHydroGroupText(Messages.SAVE_JOBS_BEFORE_LAUNCHING_MESSAGE);
	hydroGroup.setLayout(new GridLayout(1, false));
	hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
	hydroGroup.getHydroGroupClientArea().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	btnRadioButtonAlways = new Button(hydroGroup.getHydroGroupClientArea(), SWT.RADIO);
	btnRadioButtonAlways.setText(StringUtils.capitalize((MessageDialogWithToggle.ALWAYS)));

	btnRadioButtonPrompt = new Button(hydroGroup.getHydroGroupClientArea(), SWT.RADIO);
	btnRadioButtonPrompt.setText(StringUtils.capitalize(MessageDialogWithToggle.PROMPT));

	if (StringUtils.equals(selection, MessageDialogWithToggle.ALWAYS)) {
		btnRadioButtonAlways.setSelection(true);
	} else {
		btnRadioButtonPrompt.setSelection(true);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:JobRunPreferenceComposite.java

示例4: openInformation

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * Convenience method to optionally open a standard information dialog and
 * store the preference.
 *
 * @param parent
 *        the parent shell of the dialog, or <code>null</code> if none
 * @param title
 *        the dialog's title, or <code>null</code> if none
 * @param message
 *        the message
 * @param toggleMessage
 *        the message for the toggle control, or <code>null</code> for the
 *        default message
 * @param defaultToggleState
 *        the initial state for the toggle
 * @param key
 *        the key to use when persisting the user's preference;
 *        <code>null</code> if you don't want it persisted.
 */
public static void openInformation(
    final Shell parent,
    final String title,
    final String message,
    final String toggleMessage,
    final boolean defaultToggleState,
    final String preferenceKey) {
    final IPreferenceStore prefStore = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();

    final boolean toggleState = MessageDialogWithToggle.ALWAYS.equals(prefStore.getString(preferenceKey));

    if (!toggleState) {
        MessageDialogWithToggle.openInformation(
            parent,
            title,
            message,
            toggleMessage,
            defaultToggleState,
            prefStore,
            preferenceKey);

        TFSCommonUIClientPlugin.getDefault().savePluginPreferences();
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:44,代碼來源:ToggleMessageHelper.java

示例5: promptForQuickDiffAnnotate

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * Returns true if the user wishes to always use the live annotate view, false otherwise.
 * @return
 */
private boolean promptForQuickDiffAnnotate(){
	//check whether we should ask the user.
	final IPreferenceStore store = SVNUIPlugin.getPlugin().getPreferenceStore();
	final String option = store.getString(ISVNUIConstants.PREF_USE_QUICKDIFFANNOTATE);
	
	if (option.equals(MessageDialogWithToggle.ALWAYS))
		return true; //use live annotate
	else if (option.equals(MessageDialogWithToggle.NEVER))
		return false; //don't use live annotate
	
	final MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(Utils.getShell(null), Policy.bind("AnnotateOperation_QDAnnotateTitle"),
			Policy.bind("AnnotateOperation_QDAnnotateMessage"), Policy.bind("AnnotateOperation_4"), false, store, ISVNUIConstants.PREF_USE_QUICKDIFFANNOTATE);
	
	final int result = dialog.getReturnCode();
	switch (result) {
		//yes
		case IDialogConstants.YES_ID:
		case IDialogConstants.OK_ID :
		    return true;
	}
	return false;
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:27,代碼來源:ShowAnnotationOperation.java

示例6: getCommentWithPrompt

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
public String getCommentWithPrompt(Shell shell) {
    final String comment= getComment(false);
    if (comment.length() == 0) {
        final IPreferenceStore store= SVNUIPlugin.getPlugin().getPreferenceStore();
        final String value= store.getString(ISVNUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS);
        
        if (MessageDialogWithToggle.NEVER.equals(value))
            return null;
        
        if (MessageDialogWithToggle.PROMPT.equals(value)) {
            
            final String title= Policy.bind("CommitCommentArea_2"); 
            final String message= Policy.bind("CommitCommentArea_3"); 
            final String toggleMessage= Policy.bind("CommitCommentArea_4"); 
            
            final MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(shell, title, message, toggleMessage, false, store, ISVNUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS);
            if (dialog.getReturnCode() != IDialogConstants.YES_ID) {
                fTextBox.setFocus();
                return null;
            }
        }
    }
    return getComment(true);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:25,代碼來源:CommitCommentArea.java

示例7: extractServer

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
private static String extractServer(Server server) {
	String serverName = server.getDnsName();
	if (serverName==null || "".equals(serverName.trim()))
		serverName = server.getHost();
	IdentityVault vault = server.getIdentityVault();

	if (serverName==null || "".equals(serverName.trim())){
		
		serverName = vault.getHost();
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		store.setDefault(STORE_SHOW_HOST_MISSING, true);
		if (store.getBoolean(STORE_SHOW_HOST_MISSING)){
			MessageDialogWithToggle dialog = MessageDialogWithToggle.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Hostname missing", "No hostname was found on server object. Defaulting to the hostname of the Identity Vault object", "Do not show this anymore", false, Activator.getDefault().getPreferenceStore(), STORE_SHOW_HOST_MISSING);
		}
	}
	int port = 636;
	if (extractUseSSL(server)){
		port = vault.getLdapSecurePort();
	}else{
		port = vault.getLdapClearTextPort();
	}
	serverName = serverName+":"+port;
	System.out.println(LiveServerTraceEditorInput.class.getName()+" - extractServer() returned: "+serverName);
	return serverName;
}
 
開發者ID:scauwe,項目名稱:IDM-Enh-Trace,代碼行數:26,代碼來源:LiveServerTraceEditorInput.java

示例8: showDetachedHeadWarning

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
private void showDetachedHeadWarning() {
	PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
		public void run() {
			IPreferenceStore store = Activator.getDefault()
					.getPreferenceStore();

			if (store.getBoolean(UIPreferences.SHOW_DETACHED_HEAD_WARNING)) {
				String toggleMessage = UIText.BranchResultDialog_DetachedHeadWarningDontShowAgain;
				MessageDialogWithToggle.openInformation(PlatformUI
						.getWorkbench().getActiveWorkbenchWindow()
						.getShell(),
						UIText.BranchOperationUI_DetachedHeadTitle,
						UIText.BranchOperationUI_DetachedHeadMessage,
						toggleMessage, false, store,
						UIPreferences.SHOW_DETACHED_HEAD_WARNING);
			}
		}
	});
}
 
開發者ID:Genuitec,項目名稱:gerrit-tools,代碼行數:20,代碼來源:BranchOperationUI.java

示例9: openIgnoreMessageDialogConfirm

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:30,代碼來源:DialogUtils.java

示例10: openIgnoreMessageDialogInformation

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * Conditionally open an information message dialog. In case this is the first time this dialog is opened (defined
 * by its key), the dialog will be displayed, and a "Do not show this message again" checkbox will be available. The
 * message dialog will not be opened again when the checkbox is selected.<br>
 * Once checked, the only way to display this dialog again is by resetting the messaged through the Studio's main
 * preference page.
 * 
 * @param shell
 * @param title
 * @param message
 * @param dialogKey
 *            A dialog key that will be checked to confirm if the dialog should be diaplayed.
 * @return The dialog's return code.
 */
public static int openIgnoreMessageDialogInformation(Shell shell, String title, String message, String dialogKey)
{
	if (!shouldShowDialog(dialogKey))
	{
		return MessageDialog.CANCEL;
	}
	MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation(shell, title, message,
			Messages.DialogUtils_doNotShowMessageAgain, false, null, null);
	if (dialog.getReturnCode() == Dialog.OK)
	{
		// check the toggle state to see if we need to add the dialog key to the list of hidden dialogs.
		if (dialog.getToggleState())
		{
			setShouldShowDialog(dialogKey, false);
		}
	}
	return dialog.getReturnCode();
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:33,代碼來源:DialogUtils.java

示例11: actionReimportTour_12_ConfirmDialog

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
private boolean actionReimportTour_12_ConfirmDialog(final String toggleState, final String confirmMessage) {

		if (_prefStore.getBoolean(toggleState)) {

			return true;

		} else {

			final MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(//
					Display.getCurrent().getActiveShell(), //
					Messages.import_data_dlg_reimport_title, //
					confirmMessage, //
					Messages.App_ToggleState_DoNotShowAgain, //
					false, // toggle default state
					null,
					null);

			if (dialog.getReturnCode() == Window.OK) {
				_prefStore.setValue(toggleState, dialog.getToggleState());
				return true;
			}
		}

		return false;
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:26,代碼來源:RawDataManager.java

示例12: confirmUndoChanges

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
private boolean confirmUndoChanges() {

		// check if confirmation is disabled
		if (_prefStore.getBoolean(ITourbookPreferences.TOURDATA_EDITOR_CONFIRMATION_REVERT_TOUR)) {

			return true;

		} else {

			final MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(//
					Display.getCurrent().getActiveShell(), //
					Messages.tour_editor_dlg_revert_tour_title, // title
					Messages.tour_editor_dlg_revert_tour_message, // message
					Messages.tour_editor_dlg_revert_tour_toggle_message, // toggle message
					false, // toggle default state
					null,
					null);

			_prefStore.setValue(ITourbookPreferences.TOURDATA_EDITOR_CONFIRMATION_REVERT_TOUR, dialog.getToggleState());

			return dialog.getReturnCode() == Window.OK;
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:24,代碼來源:TourDataEditorView.java

示例13: isRowSelectionMode

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * check row/cell mode, row mode must be set, it works with the cell mode but can be confusing
 * because multiple rows can be selected but they are not visible
 * 
 * @return
 */
private boolean isRowSelectionMode() {

	if (_isRowEditMode == false) {
		final MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation(
				Display.getCurrent().getActiveShell(),
				Messages.tour_editor_dlg_delete_rows_title,
				Messages.tour_editor_dlg_delete_rows_mode_message,
				Messages.tour_editor_dlg_delete_rows_mode_toggle_message,
				true,
				null,
				null);

		if (dialog.getToggleState()) {
			_actionToggleRowSelectMode.setChecked(true);
			actionToggleRowSelectMode();
		}

		return false;
	}

	return true;
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:29,代碼來源:TourDataEditorView.java

示例14: showDimWarning

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
/**
 * show warning that map is dimmed and can be invisible
 */
private void showDimWarning() {

	if (_prefStore.getBoolean(ITourbookPreferences.MAP_VIEW_CONFIRMATION_SHOW_DIM_WARNING) == false) {

		Display.getCurrent().asyncExec(new Runnable() {
			@Override
			public void run() {

				final MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation(
						Display.getCurrent().getActiveShell(),
						Messages.map_dlg_dim_warning_title, // title
						Messages.map_dlg_dim_warning_message, // message
						Messages.map_dlg_dim_warning_toggle_message, // toggle message
						false, // toggle default state
						null,
						null);

				_prefStore.setValue(
						ITourbookPreferences.MAP_VIEW_CONFIRMATION_SHOW_DIM_WARNING,
						dialog.getToggleState());
			}
		});
	}
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:28,代碼來源:Map2View.java

示例15: migratePreferences

import org.eclipse.jface.dialogs.MessageDialogWithToggle; //導入依賴的package包/類
public static void migratePreferences() {

		Preferences pref = new ProfileScope(getDefaultAgentLocation(), IProfileRegistry.SELF).getNode(P2_Activator.PLUGIN_ID);

		try {
			if (pref.keys().length == 0) {
				// migrate preferences from instance scope to profile scope
				Preferences oldPref = new InstanceScope().getNode(P2_Activator.PLUGIN_ID);
				// don't migrate everything.  Some of the preferences moved to
				// another bundle.
				pref.put(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, oldPref.get(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.PROMPT));
				pref.putBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, oldPref.getBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, true));
				pref.flush();
			}
		} catch (BackingStoreException e) {
			StatusManager.getManager().handle(new Status(IStatus.ERROR, P2_Activator.PLUGIN_ID, 0, ProvSDKMessages.PreferenceInitializer_Error, e), StatusManager.LOG);
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:19,代碼來源:PreferenceInitializer.java


注:本文中的org.eclipse.jface.dialogs.MessageDialogWithToggle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。