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

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

Introduction

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

Prototype

String CANCEL_LABEL

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

Click Source Link

Document

The label for cancel buttons.

Usage

From source file:org.apache.directory.studio.ldapservers.actions.StartAction.java

License:Apache License

/**
 * {@inheritDoc}/*from   www .j a  v  a 2  s.  c  om*/
 */
public void run() {
    if (view != null) {
        // Getting the selection
        StructuredSelection selection = (StructuredSelection) view.getViewer().getSelection();
        if ((!selection.isEmpty()) && (selection.size() == 1)) {
            // Getting the server
            LdapServer server = (LdapServer) selection.getFirstElement();

            LdapServerAdapterExtension ldapServerAdapterExtension = server.getLdapServerAdapterExtension();
            if ((ldapServerAdapterExtension != null) && (ldapServerAdapterExtension.getInstance() != null)) {
                LdapServerAdapter ldapServerAdapter = ldapServerAdapterExtension.getInstance();

                try {

                    // Getting the ports already in use
                    String[] portsAlreadyInUse = ldapServerAdapter.checkPortsBeforeServerStart(server);
                    if ((portsAlreadyInUse == null) || (portsAlreadyInUse.length > 0)) {
                        String title = null;
                        String message = null;

                        if (portsAlreadyInUse.length == 1) {
                            title = Messages.getString("StartAction.PortInUse"); //$NON-NLS-1$
                            message = NLS.bind(Messages.getString("StartAction.PortOfProtocolInUse"), //$NON-NLS-1$
                                    new String[] { portsAlreadyInUse[0] });
                        } else {
                            title = Messages.getString("StartAction.PortsInUse"); //$NON-NLS-1$
                            message = Messages.getString("StartAction.PortsOfProtocolsInUse"); //$NON-NLS-1$
                            for (String portAlreadyInUse : portsAlreadyInUse) {
                                message += "\n    - " + portAlreadyInUse; //$NON-NLS-1$
                            }
                        }

                        message += "\n\n" + Messages.getString("StartAction.Continue"); //$NON-NLS-1$ //$NON-NLS-2$

                        MessageDialog dialog = new MessageDialog(view.getSite().getShell(), title, null,
                                message, MessageDialog.WARNING,
                                new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
                                MessageDialog.OK);
                        if (dialog.open() == MessageDialog.CANCEL) {
                            return;
                        }
                    }

                    // Creating and scheduling the job to start the server
                    StudioLdapServerJob job = new StudioLdapServerJob(new StartLdapServerRunnable(server));
                    job.schedule();
                } catch (Exception e) {
                    // Showing an error in case no LDAP Server Adapter can be found
                    MessageDialog.openError(view.getSite().getShell(),
                            Messages.getString("StartAction.ErrorStartingServer"), //$NON-NLS-1$
                            NLS.bind(
                                    Messages.getString("StartAction.ServerCanNotBeStarted") + "\n" //$NON-NLS-1$//$NON-NLS-2$
                                            + Messages.getString("StartAction.Cause"), //$NON-NLS-1$
                                    server.getName(), e.getMessage()));
                }
            } else {
                // Showing an error in case no LDAP Server Adapter can be found
                MessageDialog.openError(view.getSite().getShell(),
                        Messages.getString("StartAction.NoLdapServerAdapter"), //$NON-NLS-1$
                        NLS.bind(Messages.getString("StartAction.ServerCanNotBeStarted") + "\n" //$NON-NLS-1$ //$NON-NLS-2$
                                + Messages.getString("StartAction.NoLdapServerAdapterCouldBeFound"), //$NON-NLS-1$
                                server.getName()));
            }
        }
    }
}

From source file:org.apache.directory.studio.ldapservers.dialogs.DeleteServerDialog.java

License:Apache License

/**
 * Creates a new DeleteServerDialog./*from   w w w  .j a  v a 2  s.  co m*/
 * 
 * @param parentShell a shell
 * @param server
 *      the server
 */
public DeleteServerDialog(Shell parentShell, LdapServer server) {
    super(parentShell, Messages.getString("DeleteServerDialog.DeleteServer"), null, null, QUESTION, new String[] //$NON-NLS-1$
    { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, OK);

    if (server == null) {
        throw new IllegalArgumentException();
    }

    this.server = server;
    message = NLS.bind(Messages.getString("DeleteServerDialog.SureToDelete"), server.getName()); //$NON-NLS-1$
}

From source file:org.apache.directory.studio.ldifeditor.dialogs.LdifEntryEditorDialog.java

License:Apache License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    if (entry != null) {
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    }//from w  w w. jav a 2 s  .  c om

    getShell().update();
    getShell().layout(true, true);
}

From source file:org.apache.directory.studio.openldap.common.ui.dialogs.PasswordDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *///from   ww w.  j  a  v  a 2  s.  c o  m
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    if (hasCurrentPassword()) {
        updateCurrentPasswordGroup();
    }

    updateNewPasswordGroup();
}

From source file:org.apache.directory.studio.openldap.config.acl.dialogs.OpenLdapAccessLevelDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *//*  w w w . j  a  va 2 s  .  com*/
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:org.apache.directory.studio.openldap.config.acl.dialogs.OpenLdapAclDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *//*  w  w w  .  j  a  v  a 2  s .  co m*/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, FORMAT_BUTTON, "Format", false);
    createButton(parent, CHECK_SYNTAX_BUTTON, "Check Syntax", false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:org.apache.directory.studio.openldap.config.editor.dialogs.ReplicationConsumerDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 */// ww w.j  a  va  2 s  .  c  o m
@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    updateOkButtonEnableState();
}

From source file:org.apache.directory.studio.openldap.config.editor.dialogs.RwmMappingDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *///  w w  w . j  a  v a 2  s  .c o  m
@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    checkAndUpdateOkButtonEnableState();
}

From source file:org.apache.directory.studio.schemaeditor.view.dialogs.AbstractRenameDialog.java

License:Apache License

/**
 * {@inheritDoc}/*from   w w  w  .j  a  va  2 s  .c  o  m*/
 */
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:org.apache.directory.studio.schemaeditor.view.dialogs.AttributeTypeSelectionDialog.java

License:Apache License

/**
 * {@inheritDoc}/*w  ww  .  ja v a  2s. com*/
 */
protected void createButtonsForButtonBar(Composite parent) {
    chooseButton = createButton(parent, IDialogConstants.OK_ID,
            Messages.getString("AttributeTypeSelectionDialog.Choose"), true); //$NON-NLS-1$
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    StructuredSelection selection = (StructuredSelection) attributeTypesTableViewer.getSelection();
    if (selection.isEmpty()) {
        if ((chooseButton != null) && (!chooseButton.isDisposed())) {
            chooseButton.setEnabled(false);
        }
    } else {
        if ((chooseButton != null) && (!chooseButton.isDisposed())) {
            chooseButton.setEnabled(true);
        }
    }
}