Example usage for org.eclipse.jface.dialogs IDialogLabelKeys OK_LABEL_KEY

List of usage examples for org.eclipse.jface.dialogs IDialogLabelKeys OK_LABEL_KEY

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogLabelKeys OK_LABEL_KEY.

Prototype

String OK_LABEL_KEY

To view the source code for org.eclipse.jface.dialogs IDialogLabelKeys OK_LABEL_KEY.

Click Source Link

Document

The key used to retrieve the label for OK buttons.

Usage

From source file:de.bht.fpa.mail.s000000.common.filter.FilterDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from  w ww. j  a  v  a  2 s .  c  o  m*/
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    String ok = JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY);
    String cancel = JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY);

    createButton(parent, IDialogConstants.OK_ID, ok, true);
    createButton(parent, IDialogConstants.CANCEL_ID, cancel, false);
}

From source file:org.adichatz.widget.richText.HyperlinkDialog.java

License:CeCILL license

protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID,
            JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
    okButton.setEnabled(false);//from   w  w w.j  a v  a  2  s.c om
    createButton(parent, IDialogConstants.CANCEL_ID,
            JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY), false);
}

From source file:org.csstudio.apputil.ui.dialog.ErrorDetailDialog.java

License:Open Source License

/** Show only the 'OK' button, no 'Cancel' */
@Override/*from   ww  w.  j ava2  s .  c o  m*/
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
}

From source file:org.csstudio.ui.util.dialogs.ExceptionDetailsErrorDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, IDialogConstants.OK_ID, JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
    createDetailsButton(parent);/*from   www  .  j a  v  a  2 s .co m*/
}

From source file:org.eclipse.e4.ui.workbench.swt.internal.copy.ShowViewDialog.java

License:Open Source License

/**
 * Adds buttons to this dialog's button bar.
 * <p>/*from  ww w .  j a  v a  2 s.co  m*/
 * The default implementation of this framework method adds standard ok and
 * cancel buttons using the <code>createButton</code> framework method.
 * Subclasses may override.
 * </p>
 * 
 * @param parent
 *            the button bar composite
 */
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID,
            JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
    createButton(parent, IDialogConstants.CANCEL_ID,
            JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY), false);
    updateButtons();
}

From source file:org.eclipse.emf.ecp.internal.ui.dialogs.PropertiesDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);

    if (editable) {
        createButton(parent, IDialogConstants.CANCEL_ID,
                JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY), false);
    }/*from   ww w .j  a v  a  2 s  . co m*/
}

From source file:org.eclipse.emf.ecp.view.internal.editor.controls.EditableEReferenceLabelControlSWTRenderer.java

License:Open Source License

/**
 * Shows an error message dialog indicating a failed value link due to an exception.
 *
 * @param shell The parent {@link Shell} of the message dialog
 * @param ex The {@link Exception} causing the failure
 *//*from   w  w  w  . j  a va  2  s . c  o  m*/
protected void showLinkValueFailedMessageDialog(Shell shell, final Exception ex) {
    final MessageDialog dialog = new MessageDialog(shell, "Link Value Failed", null, //$NON-NLS-1$
            "The value could not be linked due to an exception: " + ex.getMessage(), MessageDialog.ERROR, //$NON-NLS-1$
            new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) },
            0);

    new ECPDialogExecutor(dialog) {
        @Override
        public void handleResult(int codeResult) {
            // no op
        }
    }.execute();
}

From source file:org.eclipse.jubula.client.ui.preferences.DatabaseConnectionPreferencePage.java

License:Open Source License

/**
 * Displays a dialog for the given wizard.
 * //from  www .  ja  v  a2  s.c  o  m
 * @param databaseConnectionWizard The wizard to display in the dialog.
 * @param display Used for registering/deregistering global listeners.
 * @return the result of {@link Window#open()}.
 */
private static int showDialog(DatabaseConnectionDialog databaseConnectionWizard, Display display) {
    WizardDialog dialog = new WizardDialog(display.getActiveShell(), databaseConnectionWizard) {
        protected void createButtonsForButtonBar(Composite parent) {
            super.createButtonsForButtonBar(parent);
            Button finishButton = getButton(IDialogConstants.FINISH_ID);
            finishButton.setText(JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY));
        }
    };
    databaseConnectionWizard.setWindowTitle(Messages.DatabaseConnectionDialogTitle);
    dialog.setHelpAvailable(true);

    display.addFilter(SWT.FocusIn, SELECT_ALL_LISTENER);
    display.addFilter(SWT.FocusOut, SELECT_ALL_LISTENER);
    display.addFilter(SWT.Traverse, SELECT_ALL_LISTENER);

    try {
        return dialog.open();
    } finally {
        display.removeFilter(SWT.FocusIn, SELECT_ALL_LISTENER);
        display.removeFilter(SWT.FocusOut, SELECT_ALL_LISTENER);
        display.removeFilter(SWT.Traverse, SELECT_ALL_LISTENER);
    }
}

From source file:org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil.java

License:Open Source License

/**
 * Open the message dialog./*from   w w w.  j  ava  2  s.  c o  m*/
 * <p><b>Use createMessageDialog(JBException ex, Object[] params, String[] details)
 * instead, if you want to get an entry in error log.</b></p>
 * @param messageID the actual messageID
 * @param params Parameter of the message text or null, if not needed.
 * @param details use null, or overwrite in MessageIDs hardcoded details.
 * @param parent the parent shell to use for this message dialog
 * @return the dialog.
 */
public static Dialog createMessageDialog(final Integer messageID, final Object[] params, final String[] details,
        final Shell parent) {
    String title = StringConstants.EMPTY;
    String message = StringConstants.EMPTY;
    String[] labels = new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) };
    int imageID = MessageDialog.INFORMATION;
    Message msg = MessageIDs.getMessageObject(messageID);
    String[] detail = lineFeed(msg.getDetails());
    if (details != null) {
        detail = lineFeed(details);
    }
    switch (msg.getSeverity()) {
    case Message.ERROR:
        title = Messages.UtilsError;
        message = Messages.UtilsErrorOccurred;
        break;
    case Message.INFO:
        title = Messages.UtilsInfo1;
        message = Messages.UtilsInfo2;
        break;
    case Message.WARNING:
        title = Messages.UtilsWarning1;
        message = Messages.UtilsWarning2;
        break;
    case Message.QUESTION:
        title = Messages.UtilsRequest1;
        message = Messages.UtilsRequest2;
        labels = new String[] { JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY),
                JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY) };
        imageID = MessageDialog.QUESTION;
        break;
    default:
        break;
    }
    IStatus[] status = new Status[detail.length];
    for (int i = 0; i < detail.length; i++) {
        status[i] = new Status(msg.getSeverity(), Constants.PLUGIN_ID, IStatus.OK, detail[i], null);
    }
    if ((msg.getSeverity() == Message.INFO || msg.getSeverity() == Message.QUESTION)) {
        StringBuilder messageBuilder = new StringBuilder(message);
        messageBuilder.append(msg.getMessage(params));
        messageBuilder.append(StringConstants.NEWLINE);
        for (IStatus s : status) {
            if (s.getMessage() != Message.NO_DETAILS) {
                messageBuilder.append(StringConstants.NEWLINE);
                messageBuilder.append(s.getMessage());
            }
        }
        dlg = new MessageDialog(parent, title, null, messageBuilder.toString(), imageID, labels, 0);
    } else {
        dlg = new ErrorDialog(parent, title, message,
                new MultiStatus(Constants.PLUGIN_ID, IStatus.OK, status, msg.getMessage(params), null),
                IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
    }
    dlg.create();
    DialogUtils.setWidgetNameForModalDialog(dlg);
    dlg.open();
    return dlg;
}

From source file:org.netxms.ui.eclipse.tools.MessageDialogHelper.java

License:Open Source License

/**
 * Convenience method to open a simple confirm (OK/Cancel) dialog with a check box
 * to remember selection. /*from w  w  w .  j  a v  a  2 s .co  m*/
 * 
 * @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 label the label for the check box
 * @param message the message
 * @return 
 */
public static DialogData openConfirmWithCheckbox(Shell parent, String title, String label, String message) {
    MessageDialogWithCheckbox msg = new MessageDialogWithCheckbox(MessageDialog.CONFIRM,
            new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY),
                    JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY) },
            parent, title, label, message);
    return msg.openMsg();
}