use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by dbeaver.
the class PrefPageDatabaseGeneral method createContents.
@Override
protected Control createContents(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1, 5);
{
Group groupObjects = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_general, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
automaticUpdateCheck = UIUtils.createCheckbox(groupObjects, CoreMessages.pref_page_ui_general_checkbox_automatic_updates, null, false, 2);
// automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
}
{
Group groupLanguage = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_language, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
workspaceLanguage = UIUtils.createLabelCombo(groupLanguage, CoreMessages.pref_page_ui_general_combo_language, CoreMessages.pref_page_ui_general_combo_language_tip, SWT.READ_ONLY | SWT.DROP_DOWN);
workspaceLanguage.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
List<PlatformLanguageDescriptor> languages = PlatformLanguageRegistry.getInstance().getLanguages();
DBPPlatformLanguage pLanguage = DBeaverCore.getInstance().getLanguage();
for (int i = 0; i < languages.size(); i++) {
PlatformLanguageDescriptor lang = languages.get(i);
workspaceLanguage.add(lang.getLabel());
if (CommonUtils.equalObjects(pLanguage, lang)) {
workspaceLanguage.select(i);
}
}
if (workspaceLanguage.getSelectionIndex() < 0) {
workspaceLanguage.select(0);
}
Label tipLabel = UIUtils.createLabel(groupLanguage, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
// Agent settings
{
Group agentGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_task_bar, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
longOperationsCheck = UIUtils.createCheckbox(agentGroup, CoreMessages.pref_page_ui_general_label_enable_long_operations, CoreMessages.pref_page_ui_general_label_enable_long_operations_tip, false, 2);
longOperationsTimeout = UIUtils.createLabelSpinner(agentGroup, CoreMessages.pref_page_ui_general_label_long_operation_timeout, 0, 0, Integer.MAX_VALUE);
if (RuntimeUtils.isPlatformMacOS()) {
ControlEnableState.disable(agentGroup);
}
}
/*
{
// Resources
Group groupResources = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_resources, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
UIUtils.createControlLabel(groupResources, CoreMessages.pref_page_ui_general_label_default_resource_encoding);
defaultResourceEncoding = UIUtils.createEncodingCombo(groupResources, GeneralUtils.DEFAULT_ENCODING);
defaultResourceEncoding.setToolTipText(CoreMessages.pref_page_ui_general_label_set_default_resource_encoding_tip);
}
*/
{
// Logs
Group groupLogs = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_debug_logs, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
logsDebugEnabled = UIUtils.createCheckbox(groupLogs, CoreMessages.pref_page_ui_general_label_enable_debug_logs, CoreMessages.pref_page_ui_general_label_enable_debug_logs_tip, false, 2);
UIUtils.createControlLabel(groupLogs, CoreMessages.pref_page_ui_general_label_log_file_location);
logsDebugLocation = new TextWithOpenFile(groupLogs, CoreMessages.pref_page_ui_general_label_open_file_text, new String[] { "*.log", "*.txt" });
UIUtils.installContentProposal(logsDebugLocation.getTextControl(), new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(SystemVariablesResolver.VAR_WORKSPACE), GeneralUtils.variablePattern(SystemVariablesResolver.VAR_HOME) }));
logsDebugLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label tipLabel = UIUtils.createLabel(groupLogs, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
{
// Link to secure storage config
new PreferenceLinkArea(composite, SWT.NONE, PrefPageEntityEditor.PAGE_ID, "<a>''{0}''</a> " + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
null);
new PreferenceLinkArea(composite, SWT.NONE, PrefPageSQLEditor.PAGE_ID, "<a>''{0}''</a>" + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
null);
}
performDefaults();
return composite;
}
use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by dbeaver.
the class BigQueryConnectionPage 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, BigQueryMessages.label_connection, 2, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-2$
projectText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_project, "");
projectText.addModifyListener(textListener);
// $NON-NLS-2$
extraProjectsText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_additional_project, "");
// $NON-NLS-1$
extraProjectsText.setToolTipText("Coma-separated list of projects (optional)");
extraProjectsText.addModifyListener(textListener);
}
{
Composite addrGroup = UIUtils.createControlGroup(settingsGroup, BigQueryMessages.label_security, 4, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-2$
usernameText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_service_account, "");
// $NON-NLS-1$
usernameText.setToolTipText("Google account email address. Can be left empty if auth type is service based and key file contains all user info (JSON).");
usernameText.addModifyListener(textListener);
UIUtils.createControlLabel(addrGroup, BigQueryMessages.label_oauth_type);
authTypeCombo = new Combo(addrGroup, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
authTypeCombo.add(BigQueryMessages.label_service_based);
authTypeCombo.add(BigQueryMessages.label_user_based);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
authTypeCombo.setLayoutData(gd);
authTypeCombo.addModifyListener(textListener);
authTypeCombo.select(0);
UIUtils.createControlLabel(addrGroup, BigQueryMessages.label_key_path);
// $NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
authCertFile = new TextWithOpenFile(addrGroup, BigQueryMessages.label_private_key_path, new String[] { "*", "*.p12", "*.json" });
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
authCertFile.setLayoutData(gd);
}
{
// Def host/port
Composite addrGroup = UIUtils.createControlGroup(settingsGroup, BigQueryMessages.label_server_info, 4, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
hostText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_host, BigQueryConstants.DEFAULT_HOST_NAME);
hostText.addModifyListener(textListener);
portText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_port, String.valueOf(BigQueryConstants.DEFAULT_PORT));
GridData gd = (GridData) portText.getLayoutData();
gd.widthHint = UIUtils.getFontHeight(portText) * 7;
portText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
portText.addModifyListener(textListener);
}
createDriverPanel(settingsGroup);
setControl(settingsGroup);
}
use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by dbeaver.
the class ConfigImportWizardPageNavicatSettings method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = new Composite(parent, SWT.NONE);
placeholder.setLayout(new GridLayout(1, true));
UIUtils.createControlLabel(placeholder, "Navicat Connection Export (NCX) file");
filePathText = new TextWithOpenFile(placeholder, "Navicat Connection Export (NCX) file", new String[] { "*.ncx" });
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);
setControl(placeholder);
}
use of org.jkiss.dbeaver.ui.controls.TextWithOpenFile in project dbeaver by serge-rider.
the class BigQueryConnectionPage 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, BigQueryMessages.label_connection, 2, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-2$
projectText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_project, "");
projectText.addModifyListener(textListener);
// $NON-NLS-2$
extraProjectsText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_additional_project, "");
// $NON-NLS-1$
extraProjectsText.setToolTipText("Coma-separated list of projects (optional)");
extraProjectsText.addModifyListener(textListener);
}
{
Composite addrGroup = UIUtils.createControlGroup(settingsGroup, BigQueryMessages.label_security, 4, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-2$
usernameText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_service_account, "");
// $NON-NLS-1$
usernameText.setToolTipText("Google account email address. Can be left empty if auth type is service based and key file contains all user info (JSON).");
usernameText.addModifyListener(textListener);
UIUtils.createControlLabel(addrGroup, BigQueryMessages.label_oauth_type);
authTypeCombo = new Combo(addrGroup, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
authTypeCombo.add(BigQueryMessages.label_service_based);
authTypeCombo.add(BigQueryMessages.label_user_based);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
authTypeCombo.setLayoutData(gd);
authTypeCombo.addModifyListener(textListener);
authTypeCombo.select(0);
UIUtils.createControlLabel(addrGroup, BigQueryMessages.label_key_path);
// $NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
authCertFile = new TextWithOpenFile(addrGroup, BigQueryMessages.label_private_key_path, new String[] { "*", "*.p12", "*.json" });
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
authCertFile.setLayoutData(gd);
}
{
// Def host/port
Composite addrGroup = UIUtils.createControlGroup(settingsGroup, BigQueryMessages.label_server_info, 4, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
hostText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_host, BigQueryConstants.DEFAULT_HOST_NAME);
hostText.addModifyListener(textListener);
portText = UIUtils.createLabelText(addrGroup, BigQueryMessages.label_port, String.valueOf(BigQueryConstants.DEFAULT_PORT));
GridData gd = (GridData) portText.getLayoutData();
gd.widthHint = UIUtils.getFontHeight(portText) * 7;
portText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
portText.addModifyListener(textListener);
}
createDriverPanel(settingsGroup);
setControl(settingsGroup);
}
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, 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();
}
});
}
Aggregations