org.eclipse.jface.dialogs.MessageDialogWithToggle Java Examples
The following examples show how to use
org.eclipse.jface.dialogs.MessageDialogWithToggle.
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: ShowAnnotationOperation.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example #2
Source File: ContractInputGenerationWizard.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private boolean performFinishForBusinessObjectData() { final BusinessObjectData data = (BusinessObjectData) selectedDataObservable.getValue(); final RootContractInputGenerator contractInputGenerator = getRootContractGenerator(); final int returnCode = openInfoDialog(); if (returnCode == MessageDialogWithToggle.OK || returnCode == ContractInputGenerationInfoDialogFactory.NOT_OPENED) { try { getContainer().run(true, false, buildContractOperationFromData(data, contractInputGenerator)); } catch (InvocationTargetException | InterruptedException e) { BonitaStudioLog.error("Failed to create Operations from contract", e); new BonitaErrorDialog(getShell(), Messages.errorTitle, Messages.contractFromDataCreationErrorMessage, e.getCause()) .open(); return false; } openWarningDialog(contractInputGenerator.isAllAttributesGenerated()); return true; } contractInputFromBusinessObjectWizardPage.disableAutoGeneration(); getContainer().showPage(contractInputFromBusinessObjectWizardPage); contractInputFromBusinessObjectWizardPage.setPreviousPage(selectBusinessDataWizardPage); return false; }
Example #3
Source File: MultiMergeJoinDialog.java From hop with Apache License 2.0 | 6 votes |
private void ok() { if ( Utils.isEmpty( wTransformName.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().getImageHopUi() ); md.open(); props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" ); } transformName = wTransformName.getText(); // return value dispose(); }
Example #4
Source File: GuiResource.java From hop with Apache License 2.0 | 6 votes |
/** * 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; default: 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() ) }; }
Example #5
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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" ), null, BaseMessages.getString( PKG, "TransLog.Dialog.FileHasChanged1.Message" ) + Const.CR + BaseMessages.getString( PKG, "TransLog.Dialog.FileHasChanged2.Message" ) + Const.CR, MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 0, BaseMessages.getString( PKG, "TransLog.Dialog.Option.AutoSaveTransformation" ), spoon.props.getAutoSave() ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int answer = md.open(); if ( ( answer & 0xFF ) == 0 ) { spoon.saveToFile( transMeta ); } spoon.props.setAutoSave( md.getToggleState() ); } } }
Example #6
Source File: RepositoryImportProgressDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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; }
Example #7
Source File: RemoteEclipseApplication.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void launchTerminated(ILaunch launch) { if (debugPFInfo != null && launch == debugPFInfo.launch) { // The user terminated the port forwarding IPreferenceStore prefs = CodewindCorePlugin.getDefault().getPreferenceStore(); if (!prefs.getBoolean(NOTIFY_PORT_FORWARD_TERMINATED_PREFSKEY)) { Display.getDefault().asyncExec(() -> { MessageDialogWithToggle portForwardEndDialog = MessageDialogWithToggle.openInformation(Display.getDefault().getActiveShell(), Messages.PortForwardTerminateTitle, NLS.bind(Messages.PortForwardTerminateMsg, new String[] {name, connection.getName(), Integer.toString(debugPFInfo.remotePort)}), Messages.PortForwardTerminateToggleMsg, false, null, null); prefs.setValue(NOTIFY_PORT_FORWARD_TERMINATED_PREFSKEY, portForwardEndDialog.getToggleState()); }); } debugPFInfo = null; CoreUtil.updateApplication(this); } else if (launch == getLaunch()) { // Make sure the port forward process is terminated if (debugPFInfo != null) { debugPFInfo.terminate(); debugPFInfo = null; } CoreUtil.updateApplication(this); } }
Example #8
Source File: RepositoryImportProgressDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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; }
Example #9
Source File: HopGuiPipelineGraph.java From hop with Apache License 2.0 | 6 votes |
public void handlePipelineMetaChanges( PipelineMeta pipelineMeta ) throws HopException { if ( pipelineMeta.hasChanged() ) { if ( hopGui.getProps().getAutoSave() ) { save(); } else { MessageDialogWithToggle md = new MessageDialogWithToggle( hopShell(), BaseMessages.getString( PKG, "PipelineLog.Dialog.FileHasChanged.Title" ), null, BaseMessages.getString( PKG, "PipelineLog.Dialog.FileHasChanged1.Message" ) + Const.CR + BaseMessages.getString( PKG, "PipelineLog.Dialog.FileHasChanged2.Message" ) + Const.CR, MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 0, BaseMessages.getString( PKG, "PipelineLog.Dialog.Option.AutoSavePipeline" ), hopGui.getProps().getAutoSave() ); MessageDialogWithToggle.setDefaultImage( GuiResource.getInstance().getImageHopUi() ); int answer = md.open(); if ( ( answer & 0xFF ) == 0 ) { save(); } hopGui.getProps().setAutoSave( md.getToggleState() ); } } }
Example #10
Source File: ContractInputGenerationInfoDialogFactory.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public int openInfoDialog(final IPreferenceStore preferenceStore, final Shell shell, final ContractContainer contractContainer, final boolean isAutogeneratedScript) { if (isNullOrEmpty(preferenceStore.getString(SHOW_GENERATION_SUCCESS_DIALOG)) && isAutogeneratedScript) { return MessageDialogWithToggle.openOkCancelConfirm(shell, Messages.contractGenerationTitle, getInfoMessage(contractContainer), Messages.doNotShowMeAgain, false, preferenceStore, SHOW_GENERATION_SUCCESS_DIALOG).getReturnCode(); } return NOT_OPENED; }
Example #11
Source File: CheckstyleUIPluginPrefs.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * {@inheritDoc} */ @Override public void initializeDefaultPreferences() { IEclipsePreferences prefs = DefaultScope.INSTANCE.getNode(CheckstyleUIPlugin.PLUGIN_ID); prefs.putBoolean(PREF_FILESET_WARNING, true); prefs.put(PREF_ASK_BEFORE_REBUILD, MessageDialogWithToggle.PROMPT); prefs.putBoolean(PREF_TRANSLATE_TOKENS, true); prefs.putBoolean(PREF_SORT_TOKENS, false); prefs.putBoolean(PREF_OPEN_MODULE_EDITOR, true); prefs.putInt(PREF_DUPLICATED_CODE_MIN_LINES, DUPLICATED_CODE_MIN_LINES); prefs.putBoolean(PREF_STATS_SHOW_ALL_CATEGORIES, false); try { prefs.flush(); } catch (BackingStoreException e) { CheckstyleLog.log(e); } }
Example #12
Source File: RunProcessOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void redirectToPortalTaskList(final String togglePreference, final String shellTitle, final String message) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { final IPreferenceStore preferenceStore = EnginePlugin.getDefault().getPreferenceStore(); final String pref = preferenceStore.getString(togglePreference); if (MessageDialogWithToggle.NEVER.equals(pref)) { MessageDialogWithToggle.openWarning(Display.getDefault().getActiveShell(), shellTitle, message, Messages.dontaskagain, false, preferenceStore, togglePreference); } } }); status = openConsole(); }
Example #13
Source File: EnginePreferencesInitializer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void initializeDefaultPreferences() { final IPreferenceStore store = EnginePlugin.getDefault().getPreferenceStore(); store.setDefault(EnginePreferenceConstants.CURRENT_CONFIG, EnginePreferenceConstants.DEFAULT_CONFIG); store.setDefault(EnginePreferenceConstants.REMOTE_DEPLOYMENT_CHOICE, EnginePreferenceConstants.STANDARD_MODE); store.setDefault(EnginePreferenceConstants.TOGGLE_STATE_FOR_NO_INITIATOR, MessageDialogWithToggle.NEVER); store.setDefault(EnginePreferenceConstants.TOGGLE_STATE_FOR_CONTRACT_AND_NOFORM_AND_INITIATOR, MessageDialogWithToggle.NEVER); store.setDefault(EnginePreferenceConstants.DROP_BUSINESS_DATA_DB_ON_EXIT_PREF, false); store.setDefault(EnginePreferenceConstants.DROP_BUSINESS_DATA_DB_ON_INSTALL, false); store.setDefault(DesignerPreferenceConstants.FORCE_INTERNAL_FORM_MAPPING, true); store.setDefault(EnginePreferenceConstants.LAZYLOAD_ENGINE, false); store.setDefault(EnginePreferenceConstants.TOMCAT_XMX_OPTION, 1024); store.setDefault(EnginePreferenceConstants.TOMCAT_EXTRA_PARAMS, getDefaultOr(EnginePreferenceConstants.TOMCAT_EXTRA_PARAMS,"-DnoCacheCustomPage=true")); if (PlatformUI.isWorkbenchRunning()) { DebugUITools.getPreferenceStore().setValue( org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, MessageDialogWithToggle.NEVER); } }
Example #14
Source File: CommitCommentArea.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
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); }
Example #15
Source File: DialogUtils.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * 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 #16
Source File: ManyEntriesSelectedDialogPreCheckedListener.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * * @return if the checking should be cancelled */ private boolean showWarning(int nb) { /* * Show a dialog warning users that selecting many entries will be slow. */ IPreferenceStore corePreferenceStore = Activator.getDefault().getPreferenceStore(); boolean hide = corePreferenceStore.getBoolean(ITmfUIPreferences.HIDE_MANY_ENTRIES_SELECTED_TOGGLE); if (nb > 20 && !hide) { MessageDialogWithToggle openOkCancelConfirm = MessageDialogWithToggle.openOkCancelConfirm( fFilteredCheckboxTree.getShell(), Messages.ManyEntriesSelectedDialogPreCheckedListener_ManyEntriesSelectedTitle, NLS.bind(Messages.ManyEntriesSelectedDialogPreCheckedListener_ManyEntriesSelectedMessage, nb), Messages.ManyEntriesSelectedDialogPreCheckedListener_ManyEntriesSelectedDontShowAgain, false, null, null); corePreferenceStore.setValue(ITmfUIPreferences.HIDE_MANY_ENTRIES_SELECTED_TOGGLE, openOkCancelConfirm.getToggleState()); int retCode = openOkCancelConfirm.getReturnCode(); return retCode == Window.CANCEL; } return false; }
Example #17
Source File: DialogUtils.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * 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(); }
Example #18
Source File: FindBugsAction.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
protected static void askUserToSwitch(IWorkbenchPart part, int warningsNumber) { final IPreferenceStore store = FindbugsPlugin.getDefault().getPreferenceStore(); String message = "SpotBugs analysis finished, " + warningsNumber + " warnings found.\n\nSwitch to the SpotBugs perspective?"; MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(null, "SpotBugs 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); } } }
Example #19
Source File: PyDialogHelpers.java From Pydev with Eclipse Public License 1.0 | 6 votes |
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 #20
Source File: NatureAddingEditorCallback.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void afterCreatePartControl(XtextEditor editor) { IResource resource = editor.getResource(); if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) { String title = Messages.NatureAddingEditorCallback_MessageDialog_Title; String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1; boolean addNature = false; if (MessageDialogWithToggle.PROMPT.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) { int userAnswer = dialogs.askUser(message, title, ADD_XTEXT_NATURE, editor.getEditorSite().getShell()); if (userAnswer == IDialogConstants.YES_ID) { addNature = true; } else if (userAnswer == IDialogConstants.CANCEL_ID) { return; } } else if (MessageDialogWithToggle.ALWAYS.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) { addNature = true; } if (addNature) { toggleNature.toggleNature(resource.getProject()); } } }
Example #21
Source File: PaloCellInputDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public static void showPaloLibWarningDialog( Shell shell ) { PropsUI props = PropsUI.getInstance(); if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, "Y" ) ) ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogTitle" ), null, BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogMessage", Const.CR ) + Const.CR, MessageDialog.WARNING, new String[]{ BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option1" ) }, 0, BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option2" ), "N".equalsIgnoreCase( props.getCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, "Y" ) ) ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); md.open(); props.setCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" ); props.saveProps(); } }
Example #22
Source File: ExitDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public static MessageDialogWithToggle openExitDialog(final Shell parentShell) { MessageDialogWithToggle dialog = null; if (deleteTenantOnExit()) { dialog = new ExitDialog(parentShell, IDEWorkbenchMessages.PromptOnExitDialog_shellTitle, null, null, WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, IDEWorkbenchMessages.PromptOnExitDialog_choice, false); dialog.open(); } else { dialog = MessageDialogWithToggle .openOkCancelConfirm(parentShell, IDEWorkbenchMessages.PromptOnExitDialog_shellTitle, exitMessage(), IDEWorkbenchMessages.PromptOnExitDialog_choice, false, null, null); } return dialog; }
Example #23
Source File: JobGraph.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Go from serial to parallel to serial execution */ public void editEntryParallel() { JobEntryCopy je = getJobEntry(); JobEntryCopy jeOld = (JobEntryCopy) je.clone_deep(); je.setLaunchingInParallel( !je.isLaunchingInParallel() ); JobEntryCopy jeNew = (JobEntryCopy) je.clone_deep(); spoon.addUndoChange( jobMeta, new JobEntryCopy[] { jeOld }, new JobEntryCopy[] { jeNew }, new int[] { jobMeta .indexOfJobEntry( jeNew ) } ); jobMeta.setChanged(); if ( getJobEntry().isLaunchingInParallel() ) { // Show a warning (optional) // if ( "Y".equalsIgnoreCase( spoon.props.getCustomParameter( STRING_PARALLEL_WARNING_PARAMETER, "Y" ) ) ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "JobGraph.ParallelJobEntriesWarning.DialogTitle" ), null, BaseMessages.getString( PKG, "JobGraph.ParallelJobEntriesWarning.DialogMessage", Const.CR ) + Const.CR, MessageDialog.WARNING, new String[] { BaseMessages.getString( PKG, "JobGraph.ParallelJobEntriesWarning.Option1" ) }, 0, BaseMessages.getString( PKG, "JobGraph.ParallelJobEntriesWarning.Option2" ), "N".equalsIgnoreCase( spoon.props.getCustomParameter( STRING_PARALLEL_WARNING_PARAMETER, "Y" ) ) ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); md.open(); spoon.props.setCustomParameter( STRING_PARALLEL_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" ); spoon.props.saveProps(); } } spoon.refreshGraph(); }
Example #24
Source File: DialogUtils.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * openIgnoreMessageDialogInformation * * @param shell * @param title * @param message * @param store * @param key * @return int */ public static int openIgnoreMessageDialogInformation(Shell shell, String title, String message, IPreferenceStore store, String key) { if (!store.getString(key).equals(MessageDialogWithToggle.ALWAYS)) { MessageDialogWithToggle d = MessageDialogWithToggle.openInformation(shell, title, message, Messages.DialogUtils_HideMessage, false, store, key); if (d.getReturnCode() == 3) { return MessageDialog.CANCEL; } } return MessageDialog.OK; }
Example #25
Source File: SortedMergeDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } stepname = wStepname.getText(); // return value int nrfields = wFields.nrNonEmpty(); input.allocate( nrfields ); //CHECKSTYLE:Indentation:OFF for ( int i = 0; i < nrfields; i++ ) { TableItem ti = wFields.getNonEmpty( i ); input.getFieldName()[i] = ti.getText( 1 ); input.getAscending()[i] = BaseMessages.getString( PKG, "System.Combo.Yes" ).equalsIgnoreCase( ti.getText( 2 ) ); } // Show a warning (optional) // if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.DialogTitle" ), null, BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR, MessageDialog.WARNING, new String[] { BaseMessages.getString( PKG, "SortedMergeDialog.InputNeedSort.Option1" ) }, 0, BaseMessages.getString( PKG, "SortedMergeDialog.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(); } dispose(); }
Example #26
Source File: DataColumnXTabDropAdapter.java From birt with Eclipse Public License 1.0 | 5 votes |
private void storePreference( ) { String prompt = PreferenceFactory.getInstance( ) .getPreferences( CrosstabPlugin.getDefault( ) ) .getString( CrosstabPlugin.CUBE_BUILDER_WARNING_PREFERENCE ); if ( prompt == null || prompt.length( ) == 0 || ( prompt.equals( MessageDialogWithToggle.PROMPT ) ) ) { MessageDialogWithToggle opendialog = MessageDialogWithToggle.openInformation( UIUtil.getDefaultShell( ), Messages.getString( "CubeBuilder.warning.title" ), //$NON-NLS-1$ Messages.getString( "CubeBuilder.warning.message" ), //$NON-NLS-1$ Messages.getString( "CubeBuilder.warning.prompt" ), //$NON-NLS-1$ false, null, null ); if ( opendialog.getReturnCode( ) != Window.OK ) { return; } if ( opendialog.getToggleState( ) == true ) { savePreference( MessageDialogWithToggle.NEVER ); } else { savePreference( MessageDialogWithToggle.PROMPT ); } } }
Example #27
Source File: SaveAndLaunchPromptDialog.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
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 #28
Source File: SaveAndLaunchPromptDialog.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
@Override public int open() { String saveDirty = Platform.getPreferencesService().getString(IDebugUIConstants.PLUGIN_ID, IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, StringUtil.EMPTY, new IScopeContext[] { EclipseUtil.instanceScope(), EclipseUtil.defaultScope() }); if (saveDirty.equals(MessageDialogWithToggle.ALWAYS)) { setResult(dirtyResources); return Window.OK; } return super.open(); }
Example #29
Source File: ActionUtil.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example #30
Source File: MigrationStatusView.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createMarkAsCompletedButton(final Composite bottomComposite) { final Button markAsCompletedButton = new Button(bottomComposite, SWT.NONE); markAsCompletedButton.setLayoutData(GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(true, false).create()); markAsCompletedButton.setText(Messages.completeImport); markAsCompletedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { super.widgetSelected(e); final MessageDialogWithToggle mdwt = MessageDialogWithToggle.openOkCancelConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.completeImport, Messages.completeImportMessage, Messages.completeImportToggleMessage, true, MigrationPlugin.getDefault().getPreferenceStore(), "toggleStateForImportExportStatus"); if (IDialogConstants.OK_ID == mdwt.getReturnCode()) { if (mdwt.getToggleState()) { exportAction.run(); } try { clearMigrationReport(true); } catch (final IOException e1) { BonitaStudioLog.error(e1, MigrationPlugin.PLUGIN_ID); } final String id = BonitaPerspectivesUtils.getPerspectiveId((IEditorPart) tableViewer.getInput()); if (id != null) { BonitaPerspectivesUtils.switchToPerspective(id); } } } }); }