org.eclipse.ui.internal.ide.IDEInternalPreferences#org.eclipse.jface.dialogs.MessageDialogWithToggle源码实例Demo

下面列出了org.eclipse.ui.internal.ide.IDEInternalPreferences#org.eclipse.jface.dialogs.MessageDialogWithToggle 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hop   文件: HopGuiPipelineGraph.java
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() );
    }
  }
}
 
源代码2 项目: hop   文件: GuiResource.java
/**
 * 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() ) };
}
 
源代码3 项目: hop   文件: MultiMergeJoinDialog.java
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();
}
 
源代码4 项目: pentaho-kettle   文件: TransGraph.java
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() );
    }
  }
}
 
@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);
	}
}
 
源代码6 项目: eclipse-cs   文件: CheckstyleUIPluginPrefs.java
/**
 * {@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);
  }
}
 
@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());
		}
	}
}
 
源代码8 项目: spotbugs   文件: FindBugsAction.java
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);
        }
    }
}
 
/**
 *
 * @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;
}
 
源代码10 项目: APICloud-Studio   文件: ShowAnnotationOperation.java
/**
 * 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;
}
 
源代码11 项目: APICloud-Studio   文件: CommitCommentArea.java
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);
}
 
源代码12 项目: APICloud-Studio   文件: DialogUtils.java
/**
 * 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();
}
 
源代码13 项目: APICloud-Studio   文件: DialogUtils.java
/**
 * 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();
}
 
源代码14 项目: Pydev   文件: PyDialogHelpers.java
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;
}
 
源代码15 项目: pentaho-kettle   文件: PaloCellInputDialog.java
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();
  }
}
 
源代码16 项目: bonita-studio   文件: RunProcessOperation.java
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();
}
 
@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);
    }
}
 
源代码18 项目: bonita-studio   文件: ExitDialog.java
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;
}
 
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;
}
 
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;
}
 
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;
}
 
源代码23 项目: hop   文件: HopGuiWorkflowGraph.java
public void handleWorkflowMetaChanges( WorkflowMeta workflowMeta ) throws HopException {
  if ( workflowMeta.hasChanged() ) {
    if ( hopGui.getProps().getAutoSave() ) {
      if ( log.isDetailed() ) {
        log.logDetailed( BaseMessages.getString( PKG, "WorkflowLog.Log.AutoSaveFileBeforeRunning" ) );
      }
      save();
    } else {
      MessageDialogWithToggle md =
        new MessageDialogWithToggle(
          hopShell(), BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Title" ), null, BaseMessages
          .getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Message" )
          + Const.CR
          + BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Message2" )
          + Const.CR,
          MessageDialog.QUESTION,
          new String[] {
            BaseMessages.getString( PKG, "System.Button.Yes" ),
            BaseMessages.getString( PKG, "System.Button.No" ) },
          0, BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveChangedFile.Toggle" ), hopGui.getProps().getAutoSave() );
      int answer = md.open();
      if ( ( answer & 0xFF ) == 0 ) {
        save();
      }
      hopGui.getProps().setAutoSave( md.getToggleState() );
    }
  }
}
 
源代码24 项目: hop   文件: FieldsChangeSequenceDialog.java
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }
  transformName = wTransformName.getText(); // return value

  input.setStart( wStart.getText() );
  input.setIncrement( wIncrement.getText() );
  input.setResultFieldName( wResult.getText() );

  int nrFields = wFields.nrNonEmpty();
  input.allocate( nrFields );
  for ( int i = 0; i < nrFields; i++ ) {
    TableItem ti = wFields.getNonEmpty( i );
    //CHECKSTYLE:Indentation:OFF
    input.getFieldName()[ i ] = ti.getText( 1 );
  }

  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_CHANGE_SEQUENCE_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "FieldsChangeSequenceDialog.InputNeedSort.Option2" ), "N".equalsIgnoreCase(
        props.getCustomParameter( STRING_CHANGE_SEQUENCE_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GuiResource.getInstance().getImageHopUi() );
    md.open();
    props.setCustomParameter( STRING_CHANGE_SEQUENCE_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
  }

  dispose();
}
 
源代码25 项目: hop   文件: MergeJoinDialog.java
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }

  getMeta( input );

  // Show a warning (optional)
  //
  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "MergeJoinDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "MergeJoinDialog.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();
}
 
源代码26 项目: hop   文件: SortedMergeDialog.java
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }

  transformName = wTransformName.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().getImageHopUi() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
  }

  dispose();
}
 
源代码27 项目: codewind-eclipse   文件: CodewindInstall.java
private static boolean getStopAll(IProgressMonitor monitor) {
	if (!ENABLE_STOP_APPS_OPTION) {
		return true;
	}
	IPreferenceStore prefs = CodewindCorePlugin.getDefault().getPreferenceStore();
	if (InstallUtil.STOP_APP_CONTAINERS_PROMPT.contentEquals(prefs.getString(InstallUtil.STOP_APP_CONTAINERS_PREFSKEY))) {
		if (!CodewindManager.getManager().hasActiveApplications()) {
			return false;
		}
		final boolean[] stopApps = new boolean[] {false};
		Display.getDefault().syncExec(new Runnable() {

			@Override
			public void run() {
				MessageDialogWithToggle stopAppsQuestion = MessageDialogWithToggle.openYesNoCancelQuestion(
						Display.getDefault().getActiveShell(), Messages.StopAllDialog_Title,
						Messages.StopAllDialog_Message,
						Messages.StopAllDialog_ToggleMessage, false, null, null);
				switch(stopAppsQuestion.getReturnCode()) {
					case IDialogConstants.YES_ID:
						stopApps[0] = true;
						break;
					case IDialogConstants.CANCEL_ID:
						monitor.setCanceled(true);
						break;
					default:
						break;
				}
				if (!monitor.isCanceled() && stopAppsQuestion.getToggleState()) {
					// Save the user's selection
					prefs.setValue(InstallUtil.STOP_APP_CONTAINERS_PREFSKEY,
							stopApps[0] ? InstallUtil.STOP_APP_CONTAINERS_ALWAYS : InstallUtil.STOP_APP_CONTAINERS_NEVER);
				}
			}
		});
		return stopApps[0];
	}

	return InstallUtil.STOP_APP_CONTAINERS_ALWAYS.contentEquals(prefs.getString(InstallUtil.STOP_APP_CONTAINERS_PREFSKEY));
}
 
源代码28 项目: nebula   文件: XPromptChange.java
public static Boolean promptChangeBoolean(String displayName, String toggleMessage, boolean currSelection) {
   MessageDialogWithToggle md =
      new MessageDialogWithToggle(Display.getCurrent().getActiveShell(), displayName, null, displayName,
         MessageDialog.QUESTION,
         new String[] {XViewerText.get("button.ok"), XViewerText.get("button.cancel")}, Window.OK, //$NON-NLS-1$ //$NON-NLS-2$
         (toggleMessage != null ? toggleMessage : displayName), currSelection);
   int result = md.open();
   if (result == Window.OK) {
      return md.getToggleState();
   }
   return null;
}
 
源代码29 项目: wildwebdeveloper   文件: TestDebug.java
@Before
public void setUpLaunch() throws DebugException {
	this.launchManager = DebugPlugin.getDefault().getLaunchManager();
	removeAllLaunches();
	ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.debug.ui");
	prefs.setValue("org.eclipse.debug.ui.switch_perspective_on_suspend", MessageDialogWithToggle.ALWAYS);
}
 
源代码30 项目: xds-ide   文件: AddWordProposal.java
/**
 * Asks the user whether he wants to configure a user dictionary.
 * 
 * @param shell the shell
 * @return <code>true</code> if the user wants to configure the user dictionary
 * @since 3.3
 */
private boolean askUserToConfigureUserDictionary(Shell shell) {
	MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion(
			shell,
			Messages.Spelling_add_askToConfigure_title,
			Messages.Spelling_add_askToConfigure_question,
			Messages.Spelling_add_askToConfigure_ignoreMessage,
			false,
			null,
			null);

	PREF_KEY_PREF_KEY_DO_NOT_ASK.setStoredBoolean(toggleDialog.getToggleState());
	
	return toggleDialog.getReturnCode() == IDialogConstants.YES_ID;
}