Search in sources :

Example 6 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 = 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 (PostgreDatabaseBackupSettings.ExportFormat format : PostgreDatabaseBackupSettings.ExportFormat.values()) {
        formatCombo.add(format.getTitle());
    }
    formatCombo.select(wizard.getSettings().getFormat().ordinal());
    formatCombo.addListener(SWT.Selection, updateListener);
    cleanFirstButton = UIUtils.createCheckbox(formatGroup, PostgreMessages.wizard_restore_page_setting_btn_clean_first, null, wizard.getSettings().isCleanFirst(), 2);
    cleanFirstButton.addListener(SWT.Selection, updateListener);
    noOwnerCheck = UIUtils.createCheckbox(formatGroup, PostgreMessages.wizard_backup_page_setting_checkbox_no_owner, null, wizard.getSettings().isNoOwner(), 2);
    noOwnerCheck.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", "*.sql", "*" });
    inputFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    inputFileText.getTextControl().addListener(SWT.Modify, updateListener);
    inputFileText.setText(wizard.getSettings().getInputFile());
    createExtraArgsInput(inputGroup);
    Composite extraGroup = UIUtils.createComposite(composite, 2);
    createSecurityGroup(extraGroup);
    wizard.createTaskSaveGroup(extraGroup);
    setControl(composite);
}
Also used : TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile) CommonUtils(org.jkiss.utils.CommonUtils) PostgreDatabaseRestoreSettings(org.jkiss.dbeaver.ext.postgresql.tasks.PostgreDatabaseRestoreSettings) UIUtils(org.jkiss.dbeaver.ui.UIUtils) SWT(org.eclipse.swt.SWT) org.eclipse.swt.widgets(org.eclipse.swt.widgets) PostgreMessages(org.jkiss.dbeaver.ext.postgresql.PostgreMessages) GridData(org.eclipse.swt.layout.GridData) PostgreDatabaseBackupSettings(org.jkiss.dbeaver.ext.postgresql.tasks.PostgreDatabaseBackupSettings) GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile) PostgreDatabaseBackupSettings(org.jkiss.dbeaver.ext.postgresql.tasks.PostgreDatabaseBackupSettings)

Example 7 with TextWithOpenFile

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

the class SpannerConnectionPage method createControl.

@Override
public void createControl(Composite composite) {
    setImageDescriptor(logoImage);
    Composite settingsGroup = new Composite(composite, SWT.NONE);
    settingsGroup.setLayout(new GridLayout(1, false));
    settingsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    ModifyListener textListener = e -> site.updateButtons();
    {
        Composite addrGroup = UIUtils.createControlGroup(settingsGroup, SpannerMessages.label_connection, 2, 0, 0);
        addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        // $NON-NLS-2$
        projectText = UIUtils.createLabelText(addrGroup, SpannerMessages.label_project, "");
        projectText.addModifyListener(textListener);
        // $NON-NLS-2$
        instanceText = UIUtils.createLabelText(addrGroup, SpannerMessages.label_instance, "");
        // $NON-NLS-1$
        instanceText.setToolTipText("Spanner Instance ID");
        instanceText.addModifyListener(textListener);
        // $NON-NLS-2$
        databaseText = UIUtils.createLabelText(addrGroup, SpannerMessages.label_database, "");
        // $NON-NLS-1$
        databaseText.setToolTipText("Spanner Database ID");
        databaseText.addModifyListener(textListener);
        UIUtils.createControlLabel(addrGroup, SpannerMessages.label_private_key_path);
        // $NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        privateKeyFile = new TextWithOpenFile(addrGroup, SpannerMessages.label_private_key_path, new String[] { "*", "*.json" });
        GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
        // gd.horizontalSpan = 3;
        privateKeyFile.setLayoutData(gd);
    }
    createDriverPanel(settingsGroup);
    setControl(settingsGroup);
}
Also used : CommonUtils(org.jkiss.utils.CommonUtils) Text(org.eclipse.swt.widgets.Text) DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) SpannerMessages(org.jkiss.dbeaver.ext.spanner.ui.internal.SpannerMessages) DriverPropertiesDialogPage(org.jkiss.dbeaver.ui.dialogs.connection.DriverPropertiesDialogPage) ConnectionPageAbstract(org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract) ICompositeDialogPage(org.jkiss.dbeaver.ui.ICompositeDialogPage) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile) SpannerConstants(org.jkiss.dbeaver.ext.spanner.model.SpannerConstants) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) UIUtils(org.jkiss.dbeaver.ui.UIUtils) SWT(org.eclipse.swt.SWT) Log(org.jkiss.dbeaver.Log) SpannerActivator(org.jkiss.dbeaver.ext.spanner.ui.SpannerActivator) IDialogPage(org.eclipse.jface.dialogs.IDialogPage) GridData(org.eclipse.swt.layout.GridData) GridLayout(org.eclipse.swt.layout.GridLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Example 8 with TextWithOpenFile

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

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)

Example 9 with TextWithOpenFile

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

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 10 with TextWithOpenFile

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

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)

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