Search in sources :

Example 1 with MySQLNativeCredentialsSettings

use of org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeCredentialsSettings in project dbeaver by serge-rider.

the class MySQLWizardPageSettings method createSecurityGroup.

public void createSecurityGroup(Composite parent) {
    final DBPConnectionConfiguration connectionInfo = wizard.getSettings().getDataSourceContainer().getActualConnectionConfiguration();
    if (connectionInfo != null) {
        Group securityGroup = UIUtils.createControlGroup(parent, MySQLUIMessages.tools_db_export_wizard_page_settings_security_group, 3, GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
        Label infoLabel = new Label(securityGroup, SWT.NONE);
        infoLabel.setText(NLS.bind(MySQLUIMessages.tools_db_export_wizard_page_settings_security_label_info, connectionInfo.getUserName()));
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalSpan = 3;
        infoLabel.setLayoutData(gd);
        Button authButton = new Button(securityGroup, SWT.PUSH);
        authButton.setText(MySQLUIMessages.tools_db_export_wizard_page_settings_security_button_auth);
        authButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                BaseAuthDialog authDialog = new BaseAuthDialog(getShell(), MySQLUIMessages.tools_db_export_wizard_page_settings_auth_title, false, true);
                authDialog.setUserName(wizard.getSettings().getToolUserName());
                authDialog.setUserPassword(wizard.getSettings().getToolUserPassword());
                authDialog.setSavePassword(true);
                authDialog.setSavePasswordText(MySQLUIMessages.tools_db_export_wizard_page_settings_auth_save_password_checkbox);
                authDialog.setSavePasswordToolTipText(MySQLUIMessages.tools_db_export_wizard_page_settings_auth_save_password_checkbox_tip);
                if (authDialog.open() == IDialogConstants.OK_ID) {
                    wizard.getSettings().setToolUserName(authDialog.getUserName());
                    wizard.getSettings().setToolUserPassword(authDialog.getUserPassword());
                }
            }
        });
        Button resetButton = new Button(securityGroup, SWT.PUSH);
        resetButton.setText(MySQLUIMessages.tools_db_export_wizard_page_settings_security_button_reset);
        resetButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                wizard.getSettings().setToolUserName(null);
                wizard.getSettings().setToolUserPassword(null);
            }
        });
        if (wizard.getSettings() instanceof MySQLNativeCredentialsSettings) {
            MySQLNativeCredentialsSettings settings = (MySQLNativeCredentialsSettings) wizard.getSettings();
            Button overrideCredentials = UIUtils.createCheckbox(securityGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_security_checkbox_override_host_credentials, settings.isOverrideCredentials());
            overrideCredentials.setToolTipText(MySQLUIMessages.tools_db_export_wizard_page_settings_security_checkbox_override_host_credentials_tip);
            overrideCredentials.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    settings.setOverrideCredentials(overrideCredentials.getSelection());
                }
            });
        }
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) Group(org.eclipse.swt.widgets.Group) MySQLNativeCredentialsSettings(org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeCredentialsSettings) Button(org.eclipse.swt.widgets.Button) BaseAuthDialog(org.jkiss.dbeaver.ui.dialogs.BaseAuthDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 2 with MySQLNativeCredentialsSettings

use of org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeCredentialsSettings in project dbeaver by dbeaver.

the class MySQLWizardPageSettings method createSecurityGroup.

public void createSecurityGroup(Composite parent) {
    final DBPConnectionConfiguration connectionInfo = wizard.getSettings().getDataSourceContainer().getActualConnectionConfiguration();
    if (connectionInfo != null) {
        Group securityGroup = UIUtils.createControlGroup(parent, MySQLUIMessages.tools_db_export_wizard_page_settings_security_group, 3, GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
        Label infoLabel = new Label(securityGroup, SWT.NONE);
        infoLabel.setText(NLS.bind(MySQLUIMessages.tools_db_export_wizard_page_settings_security_label_info, connectionInfo.getUserName()));
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalSpan = 3;
        infoLabel.setLayoutData(gd);
        Button authButton = new Button(securityGroup, SWT.PUSH);
        authButton.setText(MySQLUIMessages.tools_db_export_wizard_page_settings_security_button_auth);
        authButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                BaseAuthDialog authDialog = new BaseAuthDialog(getShell(), MySQLUIMessages.tools_db_export_wizard_page_settings_auth_title, false, true);
                authDialog.setUserName(wizard.getSettings().getToolUserName());
                authDialog.setUserPassword(wizard.getSettings().getToolUserPassword());
                authDialog.setSavePassword(true);
                authDialog.setSavePasswordText(MySQLUIMessages.tools_db_export_wizard_page_settings_auth_save_password_checkbox);
                authDialog.setSavePasswordToolTipText(MySQLUIMessages.tools_db_export_wizard_page_settings_auth_save_password_checkbox_tip);
                if (authDialog.open() == IDialogConstants.OK_ID) {
                    wizard.getSettings().setToolUserName(authDialog.getUserName());
                    wizard.getSettings().setToolUserPassword(authDialog.getUserPassword());
                }
            }
        });
        Button resetButton = new Button(securityGroup, SWT.PUSH);
        resetButton.setText(MySQLUIMessages.tools_db_export_wizard_page_settings_security_button_reset);
        resetButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                wizard.getSettings().setToolUserName(null);
                wizard.getSettings().setToolUserPassword(null);
            }
        });
        if (wizard.getSettings() instanceof MySQLNativeCredentialsSettings) {
            MySQLNativeCredentialsSettings settings = (MySQLNativeCredentialsSettings) wizard.getSettings();
            Button overrideCredentials = UIUtils.createCheckbox(securityGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_security_checkbox_override_host_credentials, settings.isOverrideCredentials());
            overrideCredentials.setToolTipText(MySQLUIMessages.tools_db_export_wizard_page_settings_security_checkbox_override_host_credentials_tip);
            overrideCredentials.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    settings.setOverrideCredentials(overrideCredentials.getSelection());
                }
            });
        }
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) Group(org.eclipse.swt.widgets.Group) MySQLNativeCredentialsSettings(org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeCredentialsSettings) Button(org.eclipse.swt.widgets.Button) BaseAuthDialog(org.jkiss.dbeaver.ui.dialogs.BaseAuthDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 Button (org.eclipse.swt.widgets.Button)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 MySQLNativeCredentialsSettings (org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeCredentialsSettings)2 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)2 BaseAuthDialog (org.jkiss.dbeaver.ui.dialogs.BaseAuthDialog)2