Example usage for org.eclipse.jface.dialogs IDialogConstants RETRY_LABEL

List of usage examples for org.eclipse.jface.dialogs IDialogConstants RETRY_LABEL

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants RETRY_LABEL.

Prototype

String RETRY_LABEL

To view the source code for org.eclipse.jface.dialogs IDialogConstants RETRY_LABEL.

Click Source Link

Document

The label for retry buttons.

Usage

From source file:com.bdaum.zoom.ui.internal.commands.ImportDeviceCommand.java

License:Open Source License

public void doRun() {
    StorageObject[] dcims;//from   w  w w. j a  v  a2  s .c  om
    while (true) {
        dcims = Core.getCore().getVolumeManager().findDCIMs();
        if (dcims.length > 0)
            break;
        MessageDialog dialog = new AcousticMessageDialog(getShell(),
                Messages.ImportFromDeviceAction_Import_from_device, null,
                Messages.ImportFromDeviceAction_there_seems_no_suitable_device, MessageDialog.QUESTION,
                new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.CANCEL_LABEL }, 1);
        if (dialog.open() > 0)
            return;
    }
    ImportFromDeviceWizard wizard = new ImportFromDeviceWizard(null, dcims, true, true, true, null, false);
    WizardDialog wizardDialog = new WizardDialog(getShell(), wizard);
    wizard.init(null, null);
    wizardDialog.open();
}

From source file:com.iauto.mist.spec.m2t.uml2html.launch.UML2HtmlDynamicSpecificationLaunch.java

License:Open Source License

private void giveErrorMessage(List<StateMachine> stateMachines) {
    // ??//from ww w. j  a va2s .com
    StringBuffer opendFilesb = new StringBuffer();
    FileOutputStream out = null;
    for (StateMachine sm : stateMachines) {
        try {
            File filePath = new File(XlsRender2.write_path);
            if (!filePath.exists()) {
                filePath.mkdirs();
            }
            String fileName = XlsRender2.write_path + File.separator + sm.getName() + Define.FILE_SUFFIX_XLS;
            File file = new File(fileName);
            if (file.exists()) {
                out = new FileOutputStream(fileName);
            }
        } catch (FileNotFoundException e) {
            // ???
            opendFilesb.append(sm.getName());
            opendFilesb.append("\r\n");
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                }
            }
        }
    }
    // ???
    String dialogMessageFixed = "The excel file corresponding to the following model(s) is opening now, please close it(them) and click \"Retry\".";
    if ("".equals(opendFilesb.toString())) {
        retryFlg = false;
        return;
    }
    final String dialogMessage = dialogMessageFixed + "\r\n\r\n" + opendFilesb.toString();
    // ??
    Display.getDefault().syncExec(new Runnable() {
        @Override
        public void run() {
            MessageDialog dialog = new MessageDialog(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", null,
                    dialogMessage, MessageDialog.ERROR, new String[] { IDialogConstants.RETRY_LABEL }, 0);
            dialog.open();
            if (dialog.getReturnCode() == Window.OK) {
                retryFlg = true;
            }
        }
    });
}

From source file:com.salesforce.ide.core.internal.utils.DialogUtils.java

License:Open Source License

public int retryAbortMessage(String title, String message) {
    // retry is the default
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
            new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.ABORT_LABEL },
            IDialogConstants.RETRY_ID);/*  w  ww  .  j  av  a2s .c  o m*/
    return dialog.open();
}

From source file:com.salesforce.ide.core.internal.utils.DialogUtils.java

License:Open Source License

public int retryAbortCancelMessage(String title, String message) {
    // retry is the default
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
            new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.ABORT_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            IDialogConstants.RETRY_ID);/*from  w ww  .ja  v  a  2s  .  c om*/
    return dialog.open();
}

From source file:com.salesforce.ide.core.internal.utils.DialogUtils.java

License:Open Source License

public int retryOkCancelMessage(String title, String message) {
    // retry is the default
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
            new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.OK_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            IDialogConstants.RETRY_ID);//from w  ww. j  a va 2 s  .co m
    return dialog.open();
}

From source file:com.salesforce.ide.core.internal.utils.DialogUtils.java

License:Open Source License

public int retryOkMessage(String title, String message) {
    // retry is the default
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
            new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.OK_LABEL },
            IDialogConstants.RETRY_ID);/*  w w  w .  j  ava2s  .  c om*/
    return dialog.open();
}

From source file:com.salesforce.ide.ui.wizards.project.ProjectOrganizationPage.java

License:Open Source License

private int createOfflineAbortRetryMessage(String title, String message) {
    // retry is the default
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
            new String[] { "Create Offline", IDialogConstants.ABORT_LABEL, IDialogConstants.RETRY_LABEL },
            IDialogConstants.RETRY_ID);//from  www  .j a v  a 2s  .co m
    return dialog.open();
}

From source file:org.apache.directory.studio.connection.ui.PasswordsKeyStoreManagerUtils.java

License:Apache License

/**
 * Asks the user to load the keystore.//from   w  w w.j  a  v a 2 s.  co m
 *
 * @return <code>true</code> if the keystore was loaded,
 *         <code>false</code> if not.
 */
public static boolean askUserToLoadKeystore() {
    final boolean[] keystoreLoaded = new boolean[1];
    keystoreLoaded[0] = false;

    PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
        while (true) {
            // Getting the shell
            Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();

            // We ask the user for the keystore password
            PasswordDialog passwordDialog = new PasswordDialog(shell,
                    Messages.getString("PasswordsKeyStoreManagerUtils.VerifyMasterPassword"), //$NON-NLS-1$
                    Messages.getString("PasswordsKeyStoreManagerUtils.PleaseEnterMasterPassword"), null); //$NON-NLS-1$

            if (passwordDialog.open() == PasswordDialog.CANCEL) {
                // The user cancelled the action
                keystoreLoaded[0] = false;
                return;
            }

            // Getting the password
            String masterPassword = passwordDialog.getPassword();

            // Checking the password
            Exception checkPasswordException = null;
            try {
                if (ConnectionCorePlugin.getDefault().getPasswordsKeyStoreManager()
                        .checkMasterPassword(masterPassword)) {
                    keystoreLoaded[0] = true;
                    break;
                }
            } catch (KeyStoreException e) {
                checkPasswordException = e;
            }

            // Creating the message
            String message = null;

            if (checkPasswordException == null) {
                message = Messages.getString("PasswordsKeyStoreManagerUtils.MasterPasswordVerificationFailed"); //$NON-NLS-1$
            } else {
                message = Messages.getString(
                        "PasswordsKeyStoreManagerUtils.MasterPasswordVerificationFailedWithException") //$NON-NLS-1$
                        + checkPasswordException.getMessage();
            }

            // We ask the user if he wants to retry to unlock the passwords keystore
            MessageDialog errorDialog = new MessageDialog(shell,
                    Messages.getString("PasswordsKeyStoreManagerUtils.VerifyMasterPasswordFailed"), null, //$NON-NLS-1$
                    message, MessageDialog.ERROR,
                    new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.CANCEL_LABEL }, 0);

            if (errorDialog.open() == MessageDialog.CANCEL) {
                // The user cancelled the action
                keystoreLoaded[0] = false;
                return;
            }
        }
    });

    return keystoreLoaded[0];
}

From source file:org.apache.directory.studio.connection.ui.preferences.PasswordsKeystorePreferencePage.java

License:Apache License

/**
 * Disables the passwords keystore./*from ww  w  . ja va  2s .c  om*/
 *
 * @return <code>true</code> if the passwords keystore was successfully disabled,
 *         <code>false</code> if not.
 */
private boolean disablePasswordsKeystore() {
    // Asking the user if he wants to keep its connections passwords
    MessageDialog keepConnectionsPasswordsDialog = new MessageDialog(enableKeystoreCheckbox.getShell(),
            Messages.getString("PasswordsKeystorePreferencePage.KeepConnectionsPasswords"), //$NON-NLS-1$
            null, Messages.getString("PasswordsKeystorePreferencePage.DoYouWantToKeepYourConnectionsPasswords"), //$NON-NLS-1$
            MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0);
    int keepConnectionsPasswordsValue = keepConnectionsPasswordsDialog.open();

    if (keepConnectionsPasswordsValue == 1) {
        // The user chose NOT to keep the connections passwords
        connectionsPasswordsBackup.clear();
        passwordsKeyStoreManager.deleteKeystoreFile();
        return true;
    } else if (keepConnectionsPasswordsValue == 0) {
        // The user chose to keep the connections passwords
        connectionsPasswordsBackup.clear();

        while (true) {
            // We ask the user for the keystore password
            PasswordDialog passwordDialog = new PasswordDialog(enableKeystoreCheckbox.getShell(),
                    Messages.getString("PasswordsKeystorePreferencePage.VerifyMasterPassword"), //$NON-NLS-1$
                    Messages.getString("PasswordsKeystorePreferencePage.PleaseEnterYourMasterPassword"), //$NON-NLS-1$
                    null);

            if (passwordDialog.open() == PasswordDialog.CANCEL) {
                // The user cancelled the action
                return false;
            }

            // Getting the password
            String password = passwordDialog.getPassword();

            // Checking the password
            Exception checkPasswordException = null;
            try {
                if (passwordsKeyStoreManager.checkMasterPassword(password)) {
                    break;
                }
            } catch (KeyStoreException e) {
                checkPasswordException = e;
            }

            // Creating the message
            String message = null;

            if (checkPasswordException == null) {
                message = Messages
                        .getString("PasswordsKeystorePreferencePage.MasterPasswordVerificationFailed"); //$NON-NLS-1$
            } else {
                message = Messages.getString(
                        "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailedWithException") //$NON-NLS-1$
                        + checkPasswordException.getMessage();
            }

            // We ask the user if he wants to retry to unlock the passwords keystore
            MessageDialog errorDialog = new MessageDialog(enableKeystoreCheckbox.getShell(),
                    Messages.getString("PasswordsKeystorePreferencePage.VerifyMasterPasswordFailed"), null, //$NON-NLS-1$
                    message, MessageDialog.ERROR, new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.CANCEL_LABEL }, 0);

            if (errorDialog.open() == MessageDialog.CANCEL) {
                // The user cancelled the action
                return false;
            }
        }

        // Getting the connection IDs having their passwords saved in the keystore
        String[] connectionIds = passwordsKeyStoreManager.getConnectionIds();

        if (connectionIds != null) {
            // Adding the passwords to the backup map
            for (String connectionId : connectionIds) {
                String password = passwordsKeyStoreManager.getConnectionPassword(connectionId);

                if (password != null) {
                    connectionsPasswordsBackup.put(connectionId, password);
                }
            }
        }

        passwordsKeyStoreManager.deleteKeystoreFile();

        return true;
    } else {
        // The user cancelled the action
        return false;
    }
}

From source file:org.apache.directory.studio.connection.ui.preferences.PasswordsKeystorePreferencePage.java

License:Apache License

/**
 * Changes the master password./*ww w  .j a  v  a  2s .  co  m*/
 *
 * @return <code>true</code> if the master password was successfully changed,
 *         <code>false</code> if not.
 */
private void changeMasterPassword() {
    String newMasterPassword = null;

    while (true) {
        // We ask the user to reset his master password
        ResetPasswordDialog resetPasswordDialog = new ResetPasswordDialog(changeMasterPasswordButton.getShell(),
                StringUtils.EMPTY, null, null); //$NON-NLS-1$

        if (resetPasswordDialog.open() != ResetPasswordDialog.OK) {
            // The user cancelled the action
            return;
        }

        // Checking the password
        Exception checkPasswordException = null;
        try {
            if (passwordsKeyStoreManager.checkMasterPassword(resetPasswordDialog.getCurrentPassword())) {
                newMasterPassword = resetPasswordDialog.getNewPassword();
                break;
            }
        } catch (KeyStoreException e) {
            checkPasswordException = e;
        }

        // Creating the message
        String message = null;

        if (checkPasswordException == null) {
            message = Messages.getString("PasswordsKeystorePreferencePage.MasterPasswordVerificationFailed"); //$NON-NLS-1$
        } else {
            message = Messages
                    .getString("PasswordsKeystorePreferencePage.MasterPasswordVerificationFailedWithException") //$NON-NLS-1$
                    + checkPasswordException.getMessage();
        }

        // We ask the user if he wants to retry to unlock the passwords keystore
        MessageDialog errorDialog = new MessageDialog(enableKeystoreCheckbox.getShell(),
                Messages.getString("PasswordsKeystorePreferencePage.VerifyMasterPasswordFailed"), null, message, //$NON-NLS-1$
                MessageDialog.ERROR, new String[] { IDialogConstants.RETRY_LABEL, IDialogConstants.CANCEL_LABEL }, 0);

        if (errorDialog.open() == MessageDialog.CANCEL) {
            // The user cancelled the action
            return;
        }
    }

    if (newMasterPassword != null) {
        try {
            passwordsKeyStoreManager.setMasterPassword(newMasterPassword);
            passwordsKeyStoreManager.save();
        } catch (KeyStoreException e) {
            ConnectionUIPlugin.getDefault().getLog().log(new Status(Status.ERROR,
                    ConnectionUIConstants.PLUGIN_ID, Status.ERROR, "Couldn't save the keystore file.", e)); //$NON-NLS-1$
        }
    }
}