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

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

Introduction

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

Prototype

int MINIMUM_MESSAGE_AREA_WIDTH

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

Click Source Link

Document

Minimum width of message area in dialog units (value 300).

Usage

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

License:Apache License

/**
 * {@inheritDoc}//from  w  w  w  .  j  av a2  s  .co  m
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Composite
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(compositeGridData);

    // Message
    if (message != null) {
        Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1);
        GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
        messageLabelGridData.widthHint = convertHorizontalDLUsToPixels(
                IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(messageLabelGridData);
    }

    // Current Password Group
    Group currentPasswordGroup = BaseWidgetUtils.createGroup(composite,
            Messages.getString("ResetPasswordDialog.CurrentPassword"), 1); //$NON-NLS-1$
    currentPasswordGroup.setLayout(new GridLayout(2, false));

    // Current Password Text
    BaseWidgetUtils.createLabel(currentPasswordGroup,
            Messages.getString("ResetPasswordDialog.CurrentPasswordColon"), 1); //$NON-NLS-1$
    currentPasswordText = BaseWidgetUtils.createText(currentPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    currentPasswordText.setEchoChar('\u2022');
    currentPasswordText.addModifyListener(event -> validate());

    // Show Current Password Checkbox
    BaseWidgetUtils.createLabel(currentPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showCurrentPasswordCheckbox = BaseWidgetUtils.createCheckbox(currentPasswordGroup,
            Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showCurrentPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showCurrentPasswordCheckbox.getSelection()) {
                currentPasswordText.setEchoChar('\0');
            } else {
                currentPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // New Password Group
    Group newPasswordGroup = BaseWidgetUtils.createGroup(composite,
            Messages.getString("ResetPasswordDialog.NewPassword"), 1); //$NON-NLS-1$
    newPasswordGroup.setLayout(new GridLayout(2, false));

    // New Password Text
    BaseWidgetUtils.createLabel(newPasswordGroup, Messages.getString("ResetPasswordDialog.NewPasswordColon"), //$NON-NLS-1$
            1);
    newPasswordText = BaseWidgetUtils.createText(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    newPasswordText.setEchoChar('\u2022');
    newPasswordText.addModifyListener(event -> validate());

    // Show New Password Checkbox
    BaseWidgetUtils.createLabel(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showNewPasswordCheckbox = BaseWidgetUtils.createCheckbox(newPasswordGroup,
            Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showNewPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showNewPasswordCheckbox.getSelection()) {
                newPasswordText.setEchoChar('\0');
            } else {
                newPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // Verify Text
    BaseWidgetUtils.createLabel(newPasswordGroup,
            Messages.getString("ResetPasswordDialog.VerifyNewPasswordColon"), 1); //$NON-NLS-1$
    verifyNewPasswordText = BaseWidgetUtils.createText(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    verifyNewPasswordText.setEchoChar('\u2022');
    verifyNewPasswordText.addModifyListener(event -> validate());

    // Show Verify New Password Checkbox
    BaseWidgetUtils.createLabel(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showVerifyNewPasswordCheckbox = BaseWidgetUtils.createCheckbox(newPasswordGroup,
            Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showVerifyNewPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showVerifyNewPasswordCheckbox.getSelection()) {
                verifyNewPasswordText.setEchoChar('\0');
            } else {
                verifyNewPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // Setting focus
    currentPasswordGroup.setFocus();

    applyDialogFont(composite);
    return composite;
}

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

License:Apache License

/**
 * {@inheritDoc}/*from  w w w  . j  av  a  2 s. c o m*/
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = new GridLayout();
    composite.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    gridData.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2);
    composite.setLayoutData(gridData);

    BaseWidgetUtils.createWrappedLabeledText(composite,
            Messages.getString("SelectReferralConnectionDialog.SelectConnectionToHandleReferral"), 1); //$NON-NLS-1$

    for (String url : referralUrls) {
        BaseWidgetUtils.createWrappedLabeledText(composite, " - " + url, 1); //$NON-NLS-1$
    }

    // create configuration
    configuration = new ConnectionConfiguration();

    // create main widget
    mainWidget = new ConnectionWidget(configuration, null);
    mainWidget.createWidget(composite);
    mainWidget.setInput(ConnectionCorePlugin.getDefault().getConnectionFolderManager());

    // create actions and context menu (and register global actions)
    actionGroup = new ConnectionActionGroup(mainWidget, configuration);
    actionGroup.fillToolBar(mainWidget.getToolBarManager());
    actionGroup.fillMenu(mainWidget.getMenuManager());
    actionGroup.fillContextMenu(mainWidget.getContextMenuManager());
    actionGroup.activateGlobalActionHandlers();

    // create the listener
    universalListener = new ConnectionUniversalListener(mainWidget.getViewer());

    mainWidget.getViewer().addSelectionChangedListener(event -> {
        selectedConnection = null;

        if (!event.getSelection().isEmpty()) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();

            if (object instanceof Connection) {
                selectedConnection = (Connection) object;
            }
        }

        validate();
    });

    mainWidget.getViewer().addDoubleClickListener(event -> {
        selectedConnection = null;

        if (!event.getSelection().isEmpty()) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();

            if (object instanceof Connection) {
                selectedConnection = (Connection) object;
            }
        }

        validate();
    });

    if (referralUrls != null) {
        Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();

        for (Connection connection : connections) {
            LdapUrl connectionUrl = connection.getUrl();
            String normalizedConnectionUrl = Utils.getSimpleNormalizedUrl(connectionUrl);

            for (String url : referralUrls) {
                try {
                    if ((url != null)
                            && Utils.getSimpleNormalizedUrl(new LdapUrl(url)).equals(normalizedConnectionUrl)) {
                        mainWidget.getViewer().reveal(connection);
                        mainWidget.getViewer().setSelection(new StructuredSelection(connection), true);
                        break;
                    }
                } catch (LdapURLEncodingException e) {
                    // Will never occur
                }
            }
        }
    }

    applyDialogFont(composite);
    validate();

    return composite;
}

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

License:Apache License

/**
 * {@inheritDoc}/*  w ww  .  ja v  a2 s.  c  o  m*/
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Composite
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(compositeGridData);

    // Message
    if (message != null) {
        Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1);
        GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
        messageLabelGridData.widthHint = convertHorizontalDLUsToPixels(
                IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(messageLabelGridData);
    }

    // Password Group
    Group passwordGroup = BaseWidgetUtils.createGroup(composite,
            Messages.getString("SetupPasswordDialog.Password"), 1); //$NON-NLS-1$
    passwordGroup.setLayout(new GridLayout(2, false));

    // Password Text
    BaseWidgetUtils.createLabel(passwordGroup, Messages.getString("SetupPasswordDialog.PasswordColon"), 1); //$NON-NLS-1$
    passwordText = BaseWidgetUtils.createText(passwordGroup, value, 1);
    passwordText.setEchoChar('\u2022');
    passwordText.addModifyListener(event -> validate());

    // Show Password Checkbox
    BaseWidgetUtils.createLabel(passwordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showPasswordCheckbox = BaseWidgetUtils.createCheckbox(passwordGroup,
            Messages.getString("SetupPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showPasswordCheckbox.getSelection()) {
                passwordText.setEchoChar('\0');
            } else {
                passwordText.setEchoChar('\u2022');
            }
        }
    });

    // Verify Text
    BaseWidgetUtils.createLabel(passwordGroup, Messages.getString("SetupPasswordDialog.VerifyPasswordColon"), //$NON-NLS-1$
            1);
    verifyPasswordText = BaseWidgetUtils.createText(passwordGroup, value, 1);
    verifyPasswordText.setEchoChar('\u2022');
    verifyPasswordText.addModifyListener(event -> validate());

    // Show Verify Password Checkbox
    BaseWidgetUtils.createLabel(passwordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showVerifyPasswordCheckbox = BaseWidgetUtils.createCheckbox(passwordGroup,
            Messages.getString("SetupPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showVerifyPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showVerifyPasswordCheckbox.getSelection()) {
                verifyPasswordText.setEchoChar('\0');
            } else {
                verifyPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // Setting focus
    passwordText.setFocus();

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.DnDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *//*w  ww . jav a2 s. com*/
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 3 / 2;
    composite.setLayoutData(gd);

    if (description != null) {
        BaseWidgetUtils.createLabel(composite, description, 1);
    }

    Composite innerComposite = BaseWidgetUtils.createColumnContainer(composite, 2, 1);
    entryWidget = new EntryWidget(connection, dn);
    entryWidget.addWidgetModifyListener(new WidgetModifyListener() {
        public void widgetModified(WidgetModifyEvent event) {
            updateWidgets();
        }
    });
    entryWidget.createWidget(innerComposite);

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.FilterDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *//*w  ww  . jav a2  s .co m*/
protected Control createDialogArea(Composite parent) {
    // Composite composite = parent;
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(gd);

    // create and configure source viewer
    sourceViewer = new SourceViewer(composite, new VerticalRuler(0), SWT.H_SCROLL | SWT.V_SCROLL);
    sourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    configuration = new FilterSourceViewerConfiguration(parser, browserConnection);
    sourceViewer.configure(configuration);

    // set document
    IDocument document = new Document(filter);
    sourceViewer.setDocument(document);

    // preformat
    IRegion region = new Region(0, sourceViewer.getDocument().getLength());
    configuration.getContentFormatter(sourceViewer).format(sourceViewer.getDocument(), region);

    // set focus to the source viewer
    sourceViewer.getTextWidget().setFocus();

    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.FilterWidgetDialog.java

License:Apache License

/**
 * {@inheritDoc}/*from   w  w  w. ja  va2s. co  m*/
 */
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(gd);

    Composite inner = new Composite(composite, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    inner.setLayout(gridLayout);
    gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    inner.setLayoutData(gd);

    filterWidget = new FilterWidget(filter != null ? filter : ""); //$NON-NLS-1$
    filterWidget.createWidget(inner);
    filterWidget.setBrowserConnection(connection);
    filterWidget.setFocus();
    filterWidget.addWidgetModifyListener(new WidgetModifyListener() {
        public void widgetModified(WidgetModifyEvent event) {
            validate();
        }
    });

    errorMessageLabel = BaseWidgetUtils.createLabel(inner,
            Messages.getString("FilterWidgetDialog.EnterValidFilter"), 2); //$NON-NLS-1$

    validate();

    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.HexDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *//*from w  w w .  j  av  a 2  s  .c  o  m*/
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);

    hexText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    hexText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));

    hexText.setText(toFormattedHex(currentData));
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH * 1.4));
    gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2);
    hexText.setLayoutData(gd);

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.MoveEntriesDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from  w  w w. j  ava2 s  .  com
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 3 / 2;
    composite.setLayoutData(gd);

    BaseWidgetUtils.createLabel(composite, Messages.getString("MoveEntriesDialog.MoveEntriesDescription"), 1); //$NON-NLS-1$

    dnBuilderWidget = new DnBuilderWidget(false, true);
    dnBuilderWidget.addWidgetModifyListener(this);
    dnBuilderWidget.createContents(composite);
    dnBuilderWidget.setInput(entries[0].getBrowserConnection(), null, null, entries[0].getDn().getParent());

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.RenameEntryDialog.java

License:Apache License

/**     
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from w  w w .  j  a  v  a 2 s.c  om
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 3 / 2;
    composite.setLayoutData(gd);

    BaseWidgetUtils.createLabel(composite, Messages.getString("RenameEntryDialog.RenameEntryDescription"), 1); //$NON-NLS-1$

    dnBuilderWidget = new DnBuilderWidget(true, false);
    dnBuilderWidget.addWidgetModifyListener(this);
    dnBuilderWidget.createContents(composite);
    Collection<AttributeType> allAtds = SchemaUtils.getAllAttributeTypeDescriptions(entry);
    String[] allAttributeNames = SchemaUtils.getNames(allAtds).toArray(ArrayUtils.EMPTY_STRING_ARRAY);
    dnBuilderWidget.setInput(entry.getBrowserConnection(), allAttributeNames, entry.getRdn(), null);

    applyDialogFont(composite);

    initialized = true;

    return composite;
}

From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.SelectBrowserConnectionDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *//*w w w .  j  a v a 2  s . c  om*/
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout gl = new GridLayout();
    composite.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2);
    composite.setLayoutData(gd);

    // create configuration
    connectionConfiguration = new ConnectionConfiguration();

    // create main widget
    connectionMainWidget = new ConnectionWidget(connectionConfiguration, null);
    connectionMainWidget.createWidget(composite);
    connectionMainWidget.setInput(ConnectionCorePlugin.getDefault().getConnectionFolderManager());

    // create actions and context menu (and register global actions)
    connectionActionGroup = new ConnectionActionGroup(connectionMainWidget, connectionConfiguration);
    connectionActionGroup.fillToolBar(connectionMainWidget.getToolBarManager());
    connectionActionGroup.fillMenu(connectionMainWidget.getMenuManager());
    connectionActionGroup.fillContextMenu(connectionMainWidget.getContextMenuManager());
    connectionActionGroup.activateGlobalActionHandlers();

    // create the listener
    connectionUniversalListener = new ConnectionUniversalListener(connectionMainWidget.getViewer());

    connectionMainWidget.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            if (!event.getSelection().isEmpty()) {
                Object o = ((IStructuredSelection) event.getSelection()).getFirstElement();
                if (o instanceof Connection) {
                    Connection connection = (Connection) o;
                    IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
                            .getBrowserConnection(connection);
                    initialBrowserConnection = browserConnection;
                }
            }
        }
    });

    connectionMainWidget.getViewer().addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            if (!event.getSelection().isEmpty()) {
                Object o = ((IStructuredSelection) event.getSelection()).getFirstElement();
                if (o instanceof Connection) {
                    Connection connection = (Connection) o;
                    IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
                            .getBrowserConnection(connection);
                    initialBrowserConnection = browserConnection;
                    okPressed();
                }
            }
        }
    });

    if (initialBrowserConnection != null) {
        Connection connection = initialBrowserConnection.getConnection();
        if (connection != null) {
            connectionMainWidget.getViewer().reveal(connection);
            connectionMainWidget.getViewer().setSelection(new StructuredSelection(connection), true);
        }
    }

    applyDialogFont(composite);

    connectionMainWidget.setFocus();

    return composite;
}