Example usage for org.eclipse.jface.dialogs MessageDialog ERROR

List of usage examples for org.eclipse.jface.dialogs MessageDialog ERROR

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog ERROR.

Prototype

int ERROR

To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.

Click Source Link

Document

Constant for the error image, or a simple dialog with the error image and a single OK button (value 1).

Usage

From source file:com.nokia.sdt.editor.SourceGenProblemsDialog.java

License:Open Source License

/**
 * @param shell//from   w  w w .j a  v  a2  s.  co  m
 * @param displayName
 * @param messages
 * @return
 */
public static SourceGenProblemsDialog create(Shell shell, String displayName, Collection<IMessage> messages) {
    boolean anyErrors = false;
    for (Iterator iter = messages.iterator(); iter.hasNext();) {
        IMessage message = (IMessage) iter.next();
        if (message.getSeverity() == IMessage.ERROR) {
            anyErrors = true;
            break;
        }
    }
    StringBuffer buffer = new StringBuffer();
    buffer.append(MessageFormat.format(
            Messages.getString("SourceGenProblemsDialog.SourceGenProblemsEncounteredMessage"), //$NON-NLS-1$
            displayName));

    SourceGenProblemsDialog dialog = new SourceGenProblemsDialog(shell,
            Messages.getString("SourceGenProblemsDialog.SourceGenProblemsEncounteredTitle"), null, //$NON-NLS-1$
            buffer.toString(), (anyErrors ? MessageDialog.ERROR : MessageDialog.WARNING),
            new String[] { IDialogConstants.OK_LABEL }, IDialogConstants.OK_ID);
    dialog.setMessages(messages);
    return dialog;
}

From source file:com.palantir.typescript.preferences.BuildPathPropertyPage.java

License:Apache License

private Button createUseTsConfigField(final Composite composite) {
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(GridData.BEGINNING, SWT.CENTER, false, false));
    label.setText("Use tsconfig");

    final Button button = new Button(composite, SWT.CHECK);
    button.setLayoutData(new GridData(GridData.BEGINNING, SWT.CENTER, false, false));
    button.addListener(SWT.Selection, new Listener() {
        @Override/*from   w w w  .j  a v  a 2s.co  m*/
        public void handleEvent(Event e) {
            projectPreferenceStore.setUsingTsConfigFile(button.getSelection());
            if (button.getSelection()) {
                Builders.promptRecompile(getShell(), getProject());
            }
            updateFieldStates();
            updateFieldValues();
        }
    });
    button.setSelection(projectPreferenceStore.isUsingTsConfigFile());

    Button forceReloadButton = new Button(composite, SWT.NONE);
    forceReloadButton.setLayoutData(new GridData(GridData.CENTER, SWT.CENTER, false, false));
    forceReloadButton.setText("Force reload");
    forceReloadButton.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event e) {
            boolean loaded = projectPreferenceStore.getTsConfigPreferences().reloadTsConfigFile();
            if (!loaded) {
                String title = Resources.BUNDLE.getString("title.error");
                String message = Resources.BUNDLE.getString("preferences.tsconfig.loadError");
                String[] buttonLabels = new String[] { IDialogConstants.OK_LABEL };
                MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
                        buttonLabels, 1);
                dialog.open();
                return;
            }
            projectPreferenceStore.setUsingTsConfigFile(true);
            Builders.promptRecompile(getShell(), getProject());
            updateFieldStates();
            updateFieldValues();
        }
    });

    return button;
}

From source file:com.puppetlabs.geppetto.ui.wizard.ModuleExportToFileWizard.java

License:Open Source License

boolean executeExport(ModuleExportOperation op) {
    try {//from   w w  w .j av  a 2s.  c  o  m
        getContainer().run(true, true, op);
    } catch (InterruptedException e) {
        return false;
    } catch (InvocationTargetException e) {
        Throwable exception = e.getTargetException();
        String message = exception.getMessage();
        // Some system exceptions have no message
        if (message == null)
            message = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_exceptionMessage, exception);
        MessageDialog.open(MessageDialog.ERROR, getShell(),
                IDEWorkbenchMessages.WizardExportPage_internalErrorTitle, message, SWT.SHEET);
        return false;
    }

    IStatus status = op.getStatus();
    if (!status.isOK()) {
        ErrorDialog.openError(getShell(), DataTransferMessages.DataTransfer_exportProblems, null, // no special message
                status);
        return false;
    }
    return true;
}

From source file:com.python.pydev.ui.search.ReplaceDialog2.java

License:Open Source License

private int askForSkip(final IFile file) {

    String message = Messages.format(SearchMessages.ReadOnlyDialog_message, file.getFullPath().toOSString());
    String[] buttonLabels = null;
    boolean showSkip = countResources() > 1;
    if (showSkip) {
        String skipLabel = SearchMessages.ReadOnlyDialog_skipFile;
        String skipAllLabel = SearchMessages.ReadOnlyDialog_skipAll;
        buttonLabels = new String[] { skipLabel, skipAllLabel, IDialogConstants.CANCEL_LABEL };
    } else {/*from  w w w .j  av  a  2  s. c o  m*/
        buttonLabels = new String[] { IDialogConstants.CANCEL_LABEL };

    }

    MessageDialog msd = new MessageDialog(getShell(), getShell().getText(), null, message, MessageDialog.ERROR,
            buttonLabels, 0);
    int rc = msd.open();
    switch (rc) {
    case 0:
        return showSkip ? SKIP_FILE : CANCEL;
    case 1:
        return SKIP_ALL;
    default:
        return CANCEL;
    }
}

From source file:com.safi.workshop.sqlexplorer.dbproduct.ConnectionJob.java

License:Open Source License

/**
 * Prompts the user for a new username/password to attempt login with; if the dialog is
 * cancelled then this.user is set to null.
 * /*  w w w . ja  v a  2  s .c o m*/
 * @param message
 */
private void promptForPassword(final String message) {
    final Shell shell = SafiWorkshopEditorUtil.getSafiNavigator().getSite().getShell();

    // Switch to the UI thread to run the password dialog, but run it synchronously so we
    // wait for it to complete
    shell.getDisplay().syncExec(new Runnable() {
        public void run() {
            if (message != null) {
                String title = Messages.getString("Progress.Connection.Title") + ' ' + alias.getName();
                if (user != null && !alias.hasNoUserName())
                    title += '/' + user.getUserName();
                if (alias.hasNoUserName()) {
                    MessageDialog dlg = new MessageDialog(shell, title, null,
                            Messages.getString("Progress.Connection.ErrorMessage_Part1") + "\n\n" + message,
                            MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
                    dlg.open();
                    cancelled = true;
                    return;
                } else {
                    MessageDialog dlg = new MessageDialog(shell, title, null,
                            Messages.getString("Progress.Connection.ErrorMessage_Part1") + "\n\n" + message
                                    + "\n\n" + Messages.getString("Progress.Connection.ErrorMessage_Part2"),
                            MessageDialog.ERROR,
                            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
                    boolean retry = dlg.open() == 0;
                    if (!retry) {
                        cancelled = true;
                        return;
                    }
                }
            }

            Shell shell = Display.getCurrent().getActiveShell();
            PasswordConnDlg dlg = new PasswordConnDlg(shell, user.getAlias(), user);
            if (dlg.open() != Window.OK) {
                cancelled = true;
                return;
            }

            // Create a new user and add it to the alias
            User userTmp = new User(dlg.getUserName(), dlg.getPassword());
            userTmp.setAutoCommit(dlg.getAutoCommit());
            userTmp.setCommitOnClose(dlg.getCommitOnClose());
            user = alias.addUser(userTmp);
        }
    });
}

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  w w  .  j av  a 2s  . com
    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  www  .j  a va2s .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  w w.ja v  a 2s .  com
    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);/*ww w .  j a va2  s  .  c  o m*/
    return dialog.open();
}

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

License:Open Source License

public int okMessage(String title, String message) {
    return okMessage(title, message, MessageDialog.ERROR);
}