Search in sources :

Example 1 with TextWithOpenFile

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

the class PostgreSSLConfigurator method createControl.

@Override
public void createControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.minimumHeight = 200;
    composite.setLayoutData(gd);
    {
        Group certGroup = UIUtils.createControlGroup(composite, "Certificates", 2, GridData.FILL_HORIZONTAL, -1);
        UIUtils.createControlLabel(certGroup, "Root certificate");
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.minimumWidth = 130;
        rootCertText = new TextWithOpenFile(certGroup, "CA Certificate", new String[] { "*.*", "*.crt", "*.cert", "*.pem", "*" });
        rootCertText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createControlLabel(certGroup, "SSL certificate");
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.minimumWidth = 130;
        clientCertText = new TextWithOpenFile(certGroup, "SSL Certificate", new String[] { "*.*", "*.cert", "*.pem", "*" });
        clientCertText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        UIUtils.createControlLabel(certGroup, "SSL certificate key");
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.minimumWidth = 130;
        clientKeyText = new TextWithOpenFile(certGroup, "SSL Certificate", new String[] { "*.*", "*.cert", "*.pem", "*" });
        clientKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }
    {
        Group advGroup = UIUtils.createControlGroup(composite, "Advanced", 2, GridData.FILL_HORIZONTAL, -1);
        sslModeCombo = UIUtils.createLabelCombo(advGroup, "SSL mode", SWT.READ_ONLY | SWT.DROP_DOWN);
        sslModeCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        for (String mode : SSL_MODES) {
            sslModeCombo.add(mode);
        }
        sslFactoryCombo = UIUtils.createLabelCombo(advGroup, "SSL Factory", SWT.DROP_DOWN);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Example 2 with TextWithOpenFile

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

the class SSHTunnelConfiguratorUI method createControl.

@Override
public void createControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.minimumHeight = 200;
    composite.setLayoutData(gd);
    composite.setLayout(new GridLayout(2, false));
    //$NON-NLS-2$
    hostText = UIUtils.createLabelText(composite, CoreMessages.model_ssh_configurator_label_host_ip, null);
    hostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    portText = UIUtils.createLabelSpinner(composite, CoreMessages.model_ssh_configurator_label_port, SSHConstants.DEFAULT_SSH_PORT, 0, 65535);
    //$NON-NLS-2$
    userNameText = UIUtils.createLabelText(composite, CoreMessages.model_ssh_configurator_label_user_name, null);
    userNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    authMethodCombo = UIUtils.createLabelCombo(composite, CoreMessages.model_ssh_configurator_combo_auth_method, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.minimumWidth = 130;
    authMethodCombo.setLayoutData(gd);
    authMethodCombo.add(CoreMessages.model_ssh_configurator_combo_password);
    authMethodCombo.add(CoreMessages.model_ssh_configurator_combo_pub_key);
    privateKeyLabel = UIUtils.createControlLabel(composite, CoreMessages.model_ssh_configurator_label_private_key);
    privateKeyLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    pkControlGroup = UIUtils.createPlaceholder(composite, 1);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.minimumWidth = 130;
    pkControlGroup.setLayoutData(gd);
    privateKeyText = new TextWithOpenFile(pkControlGroup, CoreMessages.model_ssh_configurator_dialog_choose_private_key, new String[] { "*", "*.ssh", "*.pem", "*.*" });
    privateKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pwdLabel = UIUtils.createControlLabel(composite, CoreMessages.model_ssh_configurator_label_password);
    pwdControlGroup = UIUtils.createPlaceholder(composite, 3);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.minimumWidth = 200;
    pwdControlGroup.setLayoutData(gd);
    passwordText = new Text(pwdControlGroup, SWT.BORDER | SWT.PASSWORD);
    new Label(pwdControlGroup, SWT.NONE).setText("   ");
    savePasswordCheckbox = UIUtils.createCheckbox(pwdControlGroup, CoreMessages.model_ssh_configurator_checkbox_save_pass, false);
    keepAliveText = UIUtils.createLabelSpinner(composite, CoreMessages.model_ssh_configurator_label_keep_alive, 0, 0, Integer.MAX_VALUE);
    tunnelTimeout = UIUtils.createLabelSpinner(composite, CoreMessages.model_ssh_configurator_label_tunnel_timeout, SSHConstants.DEFAULT_CONNECT_TIMEOUT, 0, 300000);
    authMethodCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updatePrivateKeyVisibility();
            composite.layout();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) 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 3 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) {
    final Composite composite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_BOTH);
    // gd.minimumHeight = 200;
    composite.setLayoutData(gd);
    composite.setLayout(new GridLayout(1, false));
    {
        Group settingsGroup = UIUtils.createControlGroup(composite, SSHUIMessages.model_ssh_configurator_group_settings, 2, GridData.FILL_HORIZONTAL, SWT.DEFAULT);
        // $NON-NLS-2$
        hostText = UIUtils.createLabelText(settingsGroup, SSHUIMessages.model_ssh_configurator_label_host_ip, null, SWT.BORDER, new GridData(GridData.FILL_HORIZONTAL));
        portText = UIUtils.createLabelSpinner(settingsGroup, SSHUIMessages.model_ssh_configurator_label_port, SSHConstants.DEFAULT_SSH_PORT, 0, 65535);
        // $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);
        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);
            passwordText = new Text(settingsGroup, SWT.BORDER | SWT.PASSWORD);
            passwordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            savePasswordCheckbox = UIUtils.createLabelCheckbox(settingsGroup, SSHUIMessages.model_ssh_configurator_checkbox_save_pass, false);
        }
    }
    {
        Group advancedGroup = UIUtils.createControlGroup(composite, SSHUIMessages.model_ssh_configurator_group_advanced, 2, GridData.FILL_HORIZONTAL, SWT.DEFAULT);
        tunnelImplCombo = UIUtils.createLabelCombo(advancedGroup, SSHUIMessages.model_ssh_configurator_label_implementation, SWT.DROP_DOWN | SWT.READ_ONLY);
        tunnelImplCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        for (SSHImplementationDescriptor it : SSHImplementationRegistry.getInstance().getDescriptors()) {
            tunnelImplCombo.add(it.getLabel());
        }
        localPortSpinner = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_local_port, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
        localPortSpinner.setToolTipText(SSHUIMessages.model_ssh_configurator_label_local_port_description);
        keepAliveText = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_keep_alive, 0, 0, Integer.MAX_VALUE);
        tunnelTimeout = UIUtils.createLabelSpinner(advancedGroup, SSHUIMessages.model_ssh_configurator_label_tunnel_timeout, SSHConstants.DEFAULT_CONNECT_TIMEOUT, 0, 300000);
    }
    authMethodCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updatePrivateKeyVisibility();
        }
    });
}
Also used : SSHImplementationDescriptor(org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationDescriptor) GridLayout(org.eclipse.swt.layout.GridLayout) 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 4 with TextWithOpenFile

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

the class ConfigImportWizardPageCustomSettings method createControl.

@Override
public void createControl(Composite parent) {
    Composite placeholder = new Composite(parent, SWT.NONE);
    placeholder.setLayout(new GridLayout(1, true));
    Composite typeGroup = UIUtils.createControlGroup(placeholder, "Input type", 2, GridData.FILL_HORIZONTAL, SWT.DEFAULT);
    xmlButton = new Button(typeGroup, SWT.RADIO);
    xmlButton.setText("XML");
    xmlButton.setSelection(true);
    csvButton = new Button(typeGroup, SWT.RADIO);
    csvButton.setText("CSV");
    UIUtils.createControlLabel(placeholder, "Input file");
    filePathText = new TextWithOpenFile(placeholder, "Configuration Input File", new String[] { "*", "*.csv", "*.xml", "*.*" });
    filePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    filePathText.getTextControl().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            inputFile = new File(filePathText.getText());
            if (!inputFile.exists()) {
                setErrorMessage("File '" + inputFile.getAbsolutePath() + "' doesn't exist");
            } else {
                setErrorMessage(null);
            }
            getWizard().getContainer().updateButtons();
        }
    });
    UIUtils.createControlLabel(placeholder, "File encoding");
    encodingCombo = UIUtils.createEncodingCombo(placeholder, GeneralUtils.DEFAULT_ENCODING);
    /*
         * final SelectionAdapter typeListener = new SelectionAdapter() {
         * 
         * @Override public void widgetSelected(SelectionEvent e) { boolean
         * isCSV = csvButton.getSelection(); } };
         * csvButton.addSelectionListener(typeListener);
         * xmlButton.addSelectionListener(typeListener);
         */
    setControl(placeholder);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile) File(java.io.File) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Example 5 with TextWithOpenFile

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

the class PostgreRestoreWizardPageSettings method createControl.

@Override
public void createControl(Composite parent) {
    Composite composite = UIUtils.createPlaceholder(parent, 1);
    Listener updateListener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            updateState();
        }
    };
    Group formatGroup = UIUtils.createControlGroup(composite, PostgreMessages.wizard_restore_page_setting_label_setting, 2, GridData.FILL_HORIZONTAL, 0);
    formatCombo = UIUtils.createLabelCombo(formatGroup, PostgreMessages.wizard_restore_page_setting_label_format, SWT.DROP_DOWN | SWT.READ_ONLY);
    formatCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    for (PostgreBackupWizard.ExportFormat format : PostgreBackupWizard.ExportFormat.values()) {
        formatCombo.add(format.getTitle());
    }
    formatCombo.select(wizard.format.ordinal());
    formatCombo.addListener(SWT.Selection, updateListener);
    cleanFirstButton = UIUtils.createCheckbox(formatGroup, PostgreMessages.wizard_restore_page_setting_btn_clean_first, false);
    cleanFirstButton.addListener(SWT.Selection, updateListener);
    Group inputGroup = UIUtils.createControlGroup(composite, PostgreMessages.wizard_restore_page_setting_label_input, 2, GridData.FILL_HORIZONTAL, 0);
    UIUtils.createControlLabel(inputGroup, PostgreMessages.wizard_restore_page_setting_label_backup_file);
    inputFileText = new TextWithOpenFile(inputGroup, PostgreMessages.wizard_restore_page_setting_label_choose_backup_file, new String[] { "*.backup", "*" });
    inputFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    inputFileText.getTextControl().addListener(SWT.Modify, updateListener);
    createExtraArgsInput(inputGroup);
    createSecurityGroup(composite);
    setControl(composite);
}
Also used : GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Aggregations

GridData (org.eclipse.swt.layout.GridData)18 TextWithOpenFile (org.jkiss.dbeaver.ui.controls.TextWithOpenFile)18 GridLayout (org.eclipse.swt.layout.GridLayout)13 Composite (org.eclipse.swt.widgets.Composite)7 ModifyListener (org.eclipse.swt.events.ModifyListener)6 File (java.io.File)4 ModifyEvent (org.eclipse.swt.events.ModifyEvent)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 SWT (org.eclipse.swt.SWT)3 UIUtils (org.jkiss.dbeaver.ui.UIUtils)3 CommonUtils (org.jkiss.utils.CommonUtils)3 IDialogPage (org.eclipse.jface.dialogs.IDialogPage)2 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)2 Button (org.eclipse.swt.widgets.Button)2 Text (org.eclipse.swt.widgets.Text)2 Log (org.jkiss.dbeaver.Log)2 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)2 SSHImplementationDescriptor (org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationDescriptor)2