Search in sources :

Example 21 with TextWithOpenFile

use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by dbeaver.

the class OracleScriptExecuteWizardPageSettings method createControl.

@Override
public void createControl(Composite parent) {
    Composite composite = UIUtils.createPlaceholder(parent, 1);
    Group outputGroup = UIUtils.createControlGroup(composite, OracleUIMessages.tools_script_execute_wizard_page_settings_group_input, 3, GridData.FILL_HORIZONTAL, 0);
    outputGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    inputFileText = new TextWithOpenFile(outputGroup, OracleUIMessages.tools_script_execute_wizard_page_settings_label_input_file, new String[] { "*.sql", "*.txt", "*" });
    inputFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    wizard.createTaskSaveGroup(composite);
    setControl(composite);
// updateState();
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Example 22 with TextWithOpenFile

use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by dbeaver.

the class SSHTunnelConfiguratorUI method createControl.

@Override
public void createControl(Composite parent, Runnable propertyChangeListener) {
    final Composite composite = new Composite(parent, SWT.NONE);
    // gd.minimumHeight = 200;
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout(1, false));
    {
        Group settingsGroup = UIUtils.createControlGroup(composite, SSHUIMessages.model_ssh_configurator_group_settings, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, SWT.DEFAULT);
        UIUtils.createControlLabel(settingsGroup, SSHUIMessages.model_ssh_configurator_label_host_ip);
        Composite hostPortComp = UIUtils.createComposite(settingsGroup, 3);
        hostPortComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        // $NON-NLS-2$
        hostText = new Text(hostPortComp, SWT.BORDER);
        hostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        portText = UIUtils.createLabelSpinner(hostPortComp, SSHUIMessages.model_ssh_configurator_label_port, SSHConstants.DEFAULT_SSH_PORT, StandardConstants.MIN_PORT_VALUE, StandardConstants.MAX_PORT_VALUE);
        GridData gdt = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
        gdt.widthHint = UIUtils.getFontHeight(portText) * 7;
        portText.setLayoutData(gdt);
        // $NON-NLS-2$
        userNameText = UIUtils.createLabelText(settingsGroup, SSHUIMessages.model_ssh_configurator_label_user_name, null, SWT.BORDER, new GridData(GridData.FILL_HORIZONTAL));
        authMethodCombo = UIUtils.createLabelCombo(settingsGroup, SSHUIMessages.model_ssh_configurator_combo_auth_method, SWT.DROP_DOWN | SWT.READ_ONLY);
        authMethodCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        authMethodCombo.add(SSHUIMessages.model_ssh_configurator_combo_password);
        authMethodCombo.add(SSHUIMessages.model_ssh_configurator_combo_pub_key);
        authMethodCombo.add(SSHUIMessages.model_ssh_configurator_combo_agent);
        privateKeyLabel = UIUtils.createControlLabel(settingsGroup, SSHUIMessages.model_ssh_configurator_label_private_key);
        privateKeyLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        privateKeyText = new TextWithOpenFile(settingsGroup, SSHUIMessages.model_ssh_configurator_dialog_choose_private_key, new String[] { "*", "*.ssh", "*.pem", "*.*" });
        privateKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        {
            pwdLabel = UIUtils.createControlLabel(settingsGroup, SSHUIMessages.model_ssh_configurator_label_password);
            Composite passComp = UIUtils.createComposite(settingsGroup, 2);
            passComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            passwordText = new Text(passComp, SWT.BORDER | SWT.PASSWORD);
            passwordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            savePasswordCheckbox = UIUtils.createCheckbox(passComp, SSHUIMessages.model_ssh_configurator_checkbox_save_pass, false);
            savePasswordCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        }
    }
    {
        Group advancedGroup = UIUtils.createControlGroup(composite, SSHUIMessages.model_ssh_configurator_group_advanced, 4, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, SWT.DEFAULT);
        tunnelImplCombo = UIUtils.createLabelCombo(advancedGroup, SSHUIMessages.model_ssh_configurator_label_implementation, SWT.DROP_DOWN | SWT.READ_ONLY);
        GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
        gd.horizontalSpan = 3;
        tunnelImplCombo.setLayoutData(gd);
        for (SSHImplementationDescriptor it : SSHImplementationRegistry.getInstance().getDescriptors()) {
            tunnelImplCombo.add(it.getLabel());
        }
        localHostText = UIUtils.createLabelText(advancedGroup, SSHUIMessages.model_ssh_configurator_label_local_host, null, SWT.BORDER, new GridData(GridData.FILL_HORIZONTAL));
        localHostText.setToolTipText(SSHUIMessages.model_ssh_configurator_label_local_host_description);
        localHostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        remoteHostText = UIUtils.createLabelText(advancedGroup, SSHUIMessages.model_ssh_configurator_label_remote_host, null, SWT.BORDER, new GridData(GridData.FILL_HORIZONTAL));
        remoteHostText.setToolTipText(SSHUIMessages.model_ssh_configurator_label_remote_host_description);
        remoteHostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        localPortSpinner = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_local_port, 0, StandardConstants.MIN_PORT_VALUE, StandardConstants.MAX_PORT_VALUE);
        localPortSpinner.setToolTipText(SSHUIMessages.model_ssh_configurator_label_local_port_description);
        localPortSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        remotePortSpinner = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_remote_port, 0, StandardConstants.MIN_PORT_VALUE, StandardConstants.MAX_PORT_VALUE);
        remotePortSpinner.setToolTipText(SSHUIMessages.model_ssh_configurator_label_remote_port_description);
        remotePortSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createHorizontalLine(advancedGroup, 4, 0);
        keepAliveText = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_keep_alive, 0, 0, Integer.MAX_VALUE);
        keepAliveText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        tunnelTimeout = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_tunnel_timeout, SSHConstants.DEFAULT_CONNECT_TIMEOUT, 0, 300000);
        tunnelTimeout.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }
    {
        Composite controlGroup = UIUtils.createComposite(composite, 2);
        controlGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createDialogButton(controlGroup, SSHUIMessages.model_ssh_configurator_button_test_tunnel, new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                testTunnelConnection();
            }
        });
        String hint = "You can use variables in SSH parameters.";
        variablesHintLabel = new VariablesHintLabel(controlGroup, hint, hint, DataSourceDescriptor.CONNECT_VARIABLES, false);
    }
    authMethodCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateAuthMethodVisibility();
        }
    });
}
Also used : SSHImplementationDescriptor(org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationDescriptor) GridLayout(org.eclipse.swt.layout.GridLayout) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Example 23 with TextWithOpenFile

use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by dbeaver.

the class SSLConfiguratorTrustStoreUI method createTrustStoreConfigGroup.

protected Group createTrustStoreConfigGroup(Composite composite) {
    final boolean certificatesSupported = isCertificatesSupported();
    final boolean keyStoreSupported = isKeystoreSupported();
    assert certificatesSupported || keyStoreSupported;
    Group sslParameters = UIUtils.createControlGroup(composite, UIConnectionMessages.dialog_setting_ssl_configurator_legend_parameters, 1, GridData.FILL_HORIZONTAL, SWT.DEFAULT);
    if (certificatesSupported && keyStoreSupported) {
        final SelectionAdapter methodSwitcher = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                showMethodControls((SSLConfigurationMethod) e.widget.getData());
            }
        };
        Composite sslMethodComposite = UIUtils.createComposite(sslParameters, 3);
        UIUtils.createControlLabel(sslMethodComposite, UIConnectionMessages.dialog_setting_ssl_configurator_method);
        certRadioButton = UIUtils.createRadioButton(sslMethodComposite, UIConnectionMessages.dialog_setting_ssl_configurator_method_certs, SSLConfigurationMethod.CERTIFICATES, methodSwitcher);
        keyStoreRadioButton = UIUtils.createRadioButton(sslMethodComposite, UIConnectionMessages.dialog_setting_ssl_configurator_method_keystore, SSLConfigurationMethod.KEYSTORE, methodSwitcher);
    }
    {
        sslCertComposite = UIUtils.createComposite(sslParameters, 2);
        sslCertComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        if (useCACertificate()) {
            UIUtils.createControlLabel(sslCertComposite, UIConnectionMessages.dialog_setting_ssl_configurator_certs_ca_name);
            caCertPath = new TextWithOpenFile(sslCertComposite, UIConnectionMessages.dialog_setting_ssl_configurator_certs_ca_title, new String[] { "*.*", "*.crt", "*" });
            caCertPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        }
        UIUtils.createControlLabel(sslCertComposite, UIConnectionMessages.dialog_setting_ssl_configurator_certs_client_name);
        clientCertPath = new TextWithOpenFile(sslCertComposite, UIConnectionMessages.dialog_setting_ssl_configurator_certs_client_title, new String[] { "*.*", "*.crt", "*" });
        clientCertPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createControlLabel(sslCertComposite, UIConnectionMessages.dialog_setting_ssl_configurator_certs_client_key_name);
        clientKeyPath = new TextWithOpenFile(sslCertComposite, UIConnectionMessages.dialog_setting_ssl_configurator_certs_client_key_title, new String[] { "*.*", "*.key", "*" });
        clientKeyPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }
    {
        sslKeyStoreComposite = UIUtils.createComposite(sslParameters, 2);
        sslKeyStoreComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createControlLabel(sslKeyStoreComposite, UIConnectionMessages.dialog_setting_ssl_configurator_keystore_name);
        keyStorePath = new TextWithOpenFile(sslKeyStoreComposite, UIConnectionMessages.dialog_setting_ssl_configurator_keystore_title, new String[] { "*.jks;*.pfx", "*.*" });
        keyStorePath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createControlLabel(sslKeyStoreComposite, UIConnectionMessages.dialog_setting_ssl_configurator_keystore_password_name);
        keyStorePassword = new Text(sslKeyStoreComposite, SWT.BORDER | SWT.PASSWORD);
        keyStorePassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }
    return sslParameters;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Aggregations

GridData (org.eclipse.swt.layout.GridData)23 TextWithOpenFile (org.jkiss.dbeaver.ui.controls.TextWithOpenFile)23 GridLayout (org.eclipse.swt.layout.GridLayout)16 Composite (org.eclipse.swt.widgets.Composite)10 ModifyListener (org.eclipse.swt.events.ModifyListener)8 SWT (org.eclipse.swt.SWT)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 UIUtils (org.jkiss.dbeaver.ui.UIUtils)6 CommonUtils (org.jkiss.utils.CommonUtils)6 File (java.io.File)4 IDialogPage (org.eclipse.jface.dialogs.IDialogPage)4 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)4 ModifyEvent (org.eclipse.swt.events.ModifyEvent)4 Text (org.eclipse.swt.widgets.Text)4 Log (org.jkiss.dbeaver.Log)4 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)4 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)4 ICompositeDialogPage (org.jkiss.dbeaver.ui.ICompositeDialogPage)4 ConnectionPageAbstract (org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract)4