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

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

Introduction

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

Prototype

String OK_LABEL

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

Click Source Link

Document

The label for OK buttons.

Usage

From source file:com.bdaum.zoom.gps.internal.dialogs.MapDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (current != null)
        super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:com.bdaum.zoom.peer.internal.services.ROSGiManager.java

License:Open Source License

public void checkListeningPort(final int port, IAdaptable adaptable) {
    if (listeningPort != port) {
        final Shell shell = adaptable.getAdapter(Shell.class);
        if (shell != null && !shell.isDisposed()) {
            shell.getDisplay().asyncExec(() -> {
                if (!shell.isDisposed()) {
                    new AcousticMessageDialog(shell, Constants.APPLICATION_NAME, null,
                            NLS.bind(Messages.ROSGiManager_port_occupied, port, listeningPort),
                            AcousticMessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0) {
                        @Override
                        protected Control createCustomArea(Composite parent) {
                            Composite composite = new Composite(parent, SWT.NONE);
                            composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                            composite.setLayout(new GridLayout());
                            CLink link = new CLink(composite, SWT.NONE);
                            link.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
                            link.setText(Messages.ROSGiManager_configure_network);
                            link.addListener(new Listener() {
                                @Override
                                public void handleEvent(Event event) {
                                    close();
                                    PreferencesUtil.createPreferenceDialogOn(shell,
                                            "com.bdaum.zoom.peer.PeerPreferencePage", //$NON-NLS-1$
                                            new String[0], null).open();

                                }/*from   ww  w.  ja v a2s. c  om*/
                            });
                            return composite;
                        }
                    }.open();
                }
            });
        }
    }
}

From source file:com.bdaum.zoom.rcp.internal.StatusHandler.java

License:Open Source License

@Override
public void handle(StatusAdapter statusAdapter, int style) {
    if (style == StatusManager.SHOW) {
        final IStatus status = statusAdapter.getStatus();
        if (status.getSeverity() == IStatus.ERROR) {
            ++errors;//from  w  ww  .j a  va2  s .  c o  m
            UiActivator.getDefault().setRepairCat(true);
            final IWorkbench workbench = PlatformUI.getWorkbench();
            final Display display = workbench.getDisplay();
            if (!display.isDisposed())
                display.asyncExec(() -> {
                    if (!display.isDisposed()) {
                        if (dialog != null) {
                            dialog.close();
                            dialog = null;
                        }
                        Shell activeShell = display.getActiveShell();
                        if (activeShell != null) {
                            IStatus aStatus = status;
                            if (status instanceof MultiStatus) {
                                IStatus[] children = ((MultiStatus) status).getChildren();
                                if (children.length == 1)
                                    aStatus = children[0];
                            }
                            String title = NLS.bind(Messages.getString("StatusHandler.error_report"), //$NON-NLS-1$
                                    Constants.APPNAME);
                            if (status == aStatus) {
                                dialog = new AcousticMessageDialog(activeShell, title, null,
                                        NLS.bind(Messages.getString("StatusHandler.multiple_error_processing"), //$NON-NLS-1$
                                                errors, status.getMessage()),
                                        MessageDialog.ERROR,
                                        new String[] { IDialogConstants.OK_LABEL,
                                                Messages.getString("StatusHandler.View_log") }, //$NON-NLS-1$
                                        0);
                            } else
                                dialog = new AcousticMessageDialog(activeShell, title, null,
                                        NLS.bind(Messages.getString("StatusHandler.Error_processing"), errors, //$NON-NLS-1$
                                                aStatus.getMessage()),
                                        MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
                            int ret = dialog.open();
                            if (ret == 1) {
                                dialog.close();
                                IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
                                if (activeWorkbenchWindow != null) {
                                    IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
                                    if (activePage != null) {
                                        try {
                                            activePage.showView(AbstractPerspective.LOG_VIEW);
                                            Shell shell = activeWorkbenchWindow.getShell();
                                            shell.setVisible(true);
                                            shell.setMinimized(false);
                                            shell.forceActive();
                                        } catch (PartInitException e) {
                                            // ignore
                                        }
                                    }
                                }
                            }
                            dialog = null;
                        }
                    }
                });
        }
    }
}

From source file:com.bdaum.zoom.ui.dialogs.AcousticMessageDialog.java

License:Open Source License

/**
 * Convenience method to open a simple confirm (OK/Cancel) dialog.
 *
 * @param parent/*from w w w.  j  a  va 2  s .  c  o m*/
 *            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 message
 *            the message
 * @return <code>true</code> if the user presses the OK button,
 *         <code>false</code> otherwise
 */
public static boolean openConfirm(Shell parent, String title, String message) {
    return new AcousticMessageDialog(parent, title, null, message, QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0).open() == 0;
}

From source file:com.bdaum.zoom.ui.dialogs.AcousticMessageDialog.java

License:Open Source License

/**
 * Convenience method to open a standard error dialog.
 *
 * @param parent// w  w w.j a  va2s  . c  o m
 *            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 message
 *            the message
 */
public static void openError(Shell parent, String title, String message) {
    new AcousticMessageDialog(parent, title, null, message, ERROR, new String[] { IDialogConstants.OK_LABEL },
            0).open();
}

From source file:com.bdaum.zoom.ui.dialogs.AcousticMessageDialog.java

License:Open Source License

/**
 * Convenience method to open a standard information dialog.
 *
 * @param parent/* w  w w  . java 2s  .  co  m*/
 *            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 message
 *            the message
 * @param validator
 *            when the validator is executed and returns true the dialog closes
 */
public static void openInformation(Shell parent, String title, String message, IValidator validator) {
    AcousticMessageDialog dialog = new AcousticMessageDialog(parent, title, null, message, INFORMATION,
            new String[] { IDialogConstants.OK_LABEL }, 0);
    dialog.setValidator(validator);
    dialog.open();
}

From source file:com.bdaum.zoom.ui.dialogs.AcousticMessageDialog.java

License:Open Source License

/**
 * Convenience method to open a standard warning dialog.
 *
 * @param parent//from ww w  .  j ava 2 s .c  o m
 *            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 message
 *            the message
 */
public static void openWarning(Shell parent, String title, String message) {
    new AcousticMessageDialog(parent, title, null, message, WARNING, new String[] { IDialogConstants.OK_LABEL },
            0).open();
}

From source file:com.bdaum.zoom.ui.internal.dialogs.SaveTemplateDialog.java

License:Open Source License

protected void updateButtons() {
    Button okButton = getButton(IDialogConstants.OK_ID);
    String name = nameField.getText().trim();
    if (name.isEmpty()) {
        msgLabel.setText(Messages.SaveTemplateDialog_please_specify_a_design_name);
        msgLabel.setForeground(msgLabel.getDisplay().getSystemColor(SWT.COLOR_RED));
        getShell().setModified(false);/*from www  .  j  a  v  a 2  s  . co  m*/
        okButton.setEnabled(false);
        return;
    }
    getShell().setModified(true);
    okButton.setEnabled(true);
    if (Core.getCore().getDbManager().obtainObjects(WebGalleryImpl.class, false, "name", //$NON-NLS-1$
            name, QueryField.EQUALS, "template", Boolean.TRUE, QueryField.EQUALS).iterator().hasNext()) { //$NON-NLS-1$
        msgLabel.setText(Messages.SaveTemplateDialog_a_design_with_that_name_already_exists);
        msgLabel.setForeground(msgLabel.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
        okButton.setText(Messages.SaveTemplateDialog_overwrite);
    } else {
        msgLabel.setText(MESSAGE);
        msgLabel.setForeground(msgLabel.getParent().getForeground());
        okButton.setText(IDialogConstants.OK_LABEL);
    }
}

From source file:com.bdaum.zoom.ui.internal.dialogs.ViewVocabDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (select)//from  w  w w .j  a  va  2  s  .  c om
        super.createButtonsForButtonBar(parent);
    else
        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:com.bdaum.zoom.ui.internal.preferences.FileExtensionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    okButton.setEnabled(false);//  w w  w  .ja  v  a 2 s .c  o  m
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}