@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())); }
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); } } }
/** * @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); } }
/** * 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(); } }
/** * 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; }
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); }
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; }
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); } } }); }
/** * 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(); }
/** * 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(); }
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; }
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; } }
/** * 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; }
/** * 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()); } }); } }
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); } }
@Override public boolean performOk() { final IPreferenceStore pref = P2_Activator.getDefault().getPreferenceStore(); pref.setValue(PreferenceConstants.PREF_SHOW_LATEST_VERSION, showLatestRadio.getSelection()); if (alwaysShowFailedPlan.getSelection()) { pref.setValue(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.ALWAYS); } else if (neverShowFailedPlan.getSelection()) { pref.setValue(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.NEVER); } else { pref.setValue(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.PROMPT); } P2_Activator.getDefault().savePreferences(); return true; }
/** * Go from serial to parallel to serial execution */ public void editEntryParallel() { getJobEntry().setLaunchingInParallel(!getJobEntry().isLaunchingInParallel()); if (getJobEntry().isLaunchingInParallel()) { // Show a warning (optional) // if ("Y".equalsIgnoreCase(spoon.props.getCustomParameter(STRING_PARALLEL_WARNING_PARAMETER, "Y"))) //$NON-NLS-1$ //$NON-NLS-2$ { MessageDialogWithToggle md = new MessageDialogWithToggle(shell, Messages .getString("JobGraph.ParallelJobEntriesWarning.DialogTitle"), //$NON-NLS-1$ null, Messages.getString("JobGraph.ParallelJobEntriesWarning.DialogMessage", Const.CR) + Const.CR, //$NON-NLS-1$ //$NON-NLS-2$ MessageDialog.WARNING, new String[] { Messages.getString("JobGraph.ParallelJobEntriesWarning.Option1") }, //$NON-NLS-1$ 0, Messages.getString("JobGraph.ParallelJobEntriesWarning.Option2"), //$NON-NLS-1$ "N".equalsIgnoreCase(spoon.props.getCustomParameter(STRING_PARALLEL_WARNING_PARAMETER, "Y")) //$NON-NLS-1$ //$NON-NLS-2$ ); MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon()); md.open(); spoon.props.setCustomParameter(STRING_PARALLEL_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y"); //$NON-NLS-1$ //$NON-NLS-2$ spoon.props.saveProps(); } } redraw(); }
/** * Generic popup with a toggle option * * @param dialogTitle * @param image * @param message * @param dialogImageType * @param buttonLabels * @param defaultIndex * @param toggleMessage * @param toggleState * @return */ public Object[] messageDialogWithToggle(Shell shell, String dialogTitle, Image image, String message, int dialogImageType, String buttonLabels[], int defaultIndex, String toggleMessage, boolean toggleState) { int imageType = 0; switch (dialogImageType) { case Const.WARNING: imageType = MessageDialog.WARNING; break; } MessageDialogWithToggle md = new MessageDialogWithToggle(shell, dialogTitle, image, message, imageType, buttonLabels, defaultIndex, toggleMessage, toggleState); int idx = md.open(); return new Object[] { Integer.valueOf(idx), Boolean.valueOf(md.getToggleState()) }; }
protected static void askUserToSwitch(IWorkbenchPart part, int warningsNumber) { final IPreferenceStore store = FindbugsPlugin.getDefault().getPreferenceStore(); String message = "FindBugs analysis finished, " + warningsNumber + " warnings found.\n\nSwitch to the FindBugs perspective?"; MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(null, "FindBugs analysis finished", message, "Remember the choice and do not ask me in the future", false, store, FindBugsConstants.ASK_ABOUT_PERSPECTIVE_SWITCH); boolean remember = dialog.getToggleState(); int returnCode = dialog.getReturnCode(); if (returnCode == IDialogConstants.YES_ID) { if (remember) { store.setValue(FindBugsConstants.SWITCH_PERSPECTIVE_AFTER_ANALYSIS, true); } switchPerspective(part); } else if (returnCode == IDialogConstants.NO_ID) { if (remember) { store.setValue(FindBugsConstants.SWITCH_PERSPECTIVE_AFTER_ANALYSIS, false); } } }
private void ok() { if (Const.isEmpty(wStepname.getText())) return; getMeta(joinMeta); // Show a warning (optional) if ( "Y".equalsIgnoreCase( props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y") )) //$NON-NLS-1$ //$NON-NLS-2$ { MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "MultiMergeJoinDialog.InputNeedSort.DialogTitle"), //$NON-NLS-1$ null, BaseMessages.getString(PKG, "MultiMergeJoinDialog.InputNeedSort.DialogMessage", Const.CR )+Const.CR, //$NON-NLS-1$ //$NON-NLS-2$ MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "MultiMergeJoinDialog.InputNeedSort.Option1") }, //$NON-NLS-1$ 0, BaseMessages.getString(PKG, "MultiMergeJoinDialog.InputNeedSort.Option2"), //$NON-NLS-1$ "N".equalsIgnoreCase( props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y") ) //$NON-NLS-1$ //$NON-NLS-2$ ); MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon()); md.open(); props.setCustomParameter(STRING_SORT_WARNING_PARAMETER, md.getToggleState()?"N":"Y"); //$NON-NLS-1$ //$NON-NLS-2$ props.saveProps(); } stepname = wStepname.getText(); // return value dispose(); }
/** * Go from serial to parallel to serial execution */ public void editEntryParallel() { getJobEntry().setLaunchingInParallel(!getJobEntry().isLaunchingInParallel()); if (getJobEntry().isLaunchingInParallel()) { // Show a warning (optional) // if ("Y".equalsIgnoreCase(spoon.props.getCustomParameter(STRING_PARALLEL_WARNING_PARAMETER, "Y"))) //$NON-NLS-1$ //$NON-NLS-2$ { MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "JobGraph.ParallelJobEntriesWarning.DialogTitle"), //$NON-NLS-1$ null, BaseMessages.getString(PKG, "JobGraph.ParallelJobEntriesWarning.DialogMessage", Const.CR) + Const.CR, //$NON-NLS-1$ //$NON-NLS-2$ MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "JobGraph.ParallelJobEntriesWarning.Option1") }, //$NON-NLS-1$ 0, BaseMessages.getString(PKG, "JobGraph.ParallelJobEntriesWarning.Option2"), //$NON-NLS-1$ "N".equalsIgnoreCase(spoon.props.getCustomParameter(STRING_PARALLEL_WARNING_PARAMETER, "Y")) //$NON-NLS-1$ //$NON-NLS-2$ ); MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon()); md.open(); spoon.props.setCustomParameter(STRING_PARALLEL_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y"); //$NON-NLS-1$ //$NON-NLS-2$ spoon.props.saveProps(); } } redraw(); }
public void handleTransMetaChanges(TransMeta transMeta) throws KettleException { if (transMeta.hasChanged()) { if (spoon.props.getAutoSave()) { spoon.saveToFile(transMeta); } else { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString(PKG, "TransLog.Dialog.FileHasChanged.Title"), //$NON-NLS-1$ null, BaseMessages.getString(PKG, "TransLog.Dialog.FileHasChanged1.Message") + Const.CR + BaseMessages.getString(PKG, "TransLog.Dialog.FileHasChanged2.Message") + Const.CR, //$NON-NLS-1$ //$NON-NLS-2$ MessageDialog.QUESTION, new String[] { BaseMessages.getString(PKG, "System.Button.Yes"), BaseMessages.getString(PKG, "System.Button.No") }, //$NON-NLS-1$ //$NON-NLS-2$ 0, BaseMessages.getString(PKG, "TransLog.Dialog.Option.AutoSaveTransformation"), //$NON-NLS-1$ spoon.props.getAutoSave()); int answer = md.open(); if ((answer & 0xFF) == 0) { spoon.saveToFile(transMeta); } spoon.props.setAutoSave(md.getToggleState()); } } }
public static void showPaloLibWarningDialog(Shell shell) { PropsUI props = PropsUI.getInstance(); if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_PALO_LIB_WARNING_PARAMETER, "Y"))) //$NON-NLS-1$ //$NON-NLS-2$ { MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogTitle"), //$NON-NLS-1$ null, BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogMessage", Const.CR) + Const.CR, //$NON-NLS-1$ //$NON-NLS-2$ MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option1") }, //$NON-NLS-1$ 0, BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option2"), //$NON-NLS-1$ "N".equalsIgnoreCase(props.getCustomParameter(STRING_PALO_LIB_WARNING_PARAMETER, "Y")) //$NON-NLS-1$ //$NON-NLS-2$ ); MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon()); md.open(); props.setCustomParameter(STRING_PALO_LIB_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y"); //$NON-NLS-1$ //$NON-NLS-2$ props.saveProps(); } }
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; }
public void refreshTableColumn(Map mPdmColumn, Config1MainRuleWizardPage config1MainRuleWizardPage) { List<String[]> lToUpdate = updateDisplayNameValue(mPdmColumn, false); if(lToUpdate.size() > 0) { StringBuilder updateInfo = new StringBuilder(); int count = 0; for(String[] toUpdate : lToUpdate) { updateInfo.append(toUpdate[0]).append(":").append(toUpdate[1]).append(" ").append(toUpdate[2]).append("->").append(toUpdate[3]).append("\n"); if(count ++ > 20) { updateInfo.append("...").append("\n").append("total: ").append(lToUpdate.size()); break; } } MessageDialogWithToggle dialog = new MessageDialogWithToggle(config1MainRuleWizardPage.getShell(), "是否更新pdm信息到已设置的表中?", null, updateInfo.toString(), MessageDialogWithToggle.CONFIRM , new String[]{"OK", "Cancel"}, 0, null, false); dialog.create(); if(dialog.open() == 0) { updateDisplayNameValue(mPdmColumn, true); } } }
private void ok() { if (Const.isEmpty(wStepname.getText())) return; stepname = wStepname.getText(); // return value getInfo(input); if ("Y".equalsIgnoreCase(props.getCustomParameter("TABLEAU_OUTPUT_WINDOWS_WARNING", "Y"))) { MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "TDEOutput.TDEWindowsWarning.DialogTitle"), null, BaseMessages.getString(PKG, "TDEOutput.TDEWindowsWarning.DialogMessage", Const.CR) + Const.CR, MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "TDEOutput.TDEWindowsWarning.Option1") }, 0, BaseMessages.getString(PKG, "TDEOutput.TDEWindowsWarning.Option2"), "N".equalsIgnoreCase(props.getCustomParameter("TABLEAU_OUTPUT_WINDOWS_WARNING", "Y")) ); MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon()); md.open(); props.setCustomParameter("TABLEAU_OUTPUT_WINDOWS_WARNING", md.getToggleState() ? "N" : "Y"); props.saveProps(); } dispose(); }
public boolean transOverwritePrompt( TransMeta transMeta ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteTrans.Title" ), null, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteTrans.Message", transMeta.getName() ), MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 1, BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ), !askOverwrite ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int answer = md.open(); askOverwrite = !md.getToggleState(); return ( answer & 0xFF ) == 0; }
public boolean jobOverwritePrompt( JobMeta jobMeta ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteJob.Title" ), null, BaseMessages .getString( PKG, "RepositoryImportDialog.OverwriteJob.Message", jobMeta.getName() ), MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 1, BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ), !askOverwrite ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int answer = md.open(); askOverwrite = !md.getToggleState(); return ( answer & 0xFF ) == 0; }
private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } getMeta( joinMeta ); // Show a warning (optional) if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.DialogTitle" ), null, BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR, MessageDialog.WARNING, new String[] { BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.Option1" ) }, 0, BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.Option2" ), "N".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); md.open(); props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" ); props.saveProps(); } stepname = wStepname.getText(); // return value dispose(); }