Search in sources :

Example 1 with VariablesHintLabel

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

the class EditShellCommandsDialogPage method createControl.

@Override
public void createControl(Composite parent) {
    Composite group = UIUtils.createPlaceholder(parent, 2);
    group.setLayoutData(new GridData(GridData.FILL_BOTH));
    {
        Composite eventGroup = new Composite(group, SWT.NONE);
        eventGroup.setLayout(new GridLayout(1, false));
        eventGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
        UIUtils.createControlLabel(eventGroup, CoreMessages.dialog_connection_events_label_event);
        eventTypeTable = new Table(eventGroup, SWT.BORDER | SWT.CHECK | SWT.SINGLE | SWT.FULL_SELECTION);
        eventTypeTable.setLayoutData(new GridData(GridData.FILL_VERTICAL));
        eventTypeTable.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event event) {
                if (event.detail == SWT.CHECK) {
                    eventTypeTable.select(eventTypeTable.indexOf((TableItem) event.item));
                }
            }
        });
        for (DBPConnectionEventType eventType : DBPConnectionEventType.values()) {
            DBRShellCommand command = eventsCache.get(eventType);
            TableItem item = new TableItem(eventTypeTable, SWT.NONE);
            item.setData(eventType);
            item.setText(eventType.getTitle());
            item.setImage(DBeaverIcons.getImage(UIIcon.EVENT));
            item.setChecked(command != null && command.isEnabled());
        }
        eventTypeTable.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                DBPConnectionEventType eventType = getSelectedEventType();
                selectEventType(eventType);
                DBRShellCommand command = eventType == null ? null : eventsCache.get(eventType);
                boolean enabled = ((TableItem) e.item).getChecked();
                if (enabled || (command != null && enabled != command.isEnabled())) {
                    updateEvent(false);
                }
            }
        });
    }
    {
        Composite detailsGroup = new Composite(group, SWT.NONE);
        detailsGroup.setLayout(new GridLayout(1, false));
        detailsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
        // UIUtils.createControlGroup(group, "Event", 1, GridData.FILL_BOTH | GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
        UIUtils.createControlLabel(detailsGroup, CoreMessages.dialog_connection_events_label_command);
        commandText = new Text(detailsGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
        commandText.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                updateEvent(true);
            }
        });
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.heightHint = 60;
        gd.widthHint = 300;
        commandText.setLayoutData(gd);
        SelectionAdapter eventEditAdapter = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                updateEvent(false);
            }
        };
        showProcessCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_show_process, false);
        showProcessCheck.addSelectionListener(eventEditAdapter);
        waitFinishCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_wait_finish, false);
        waitFinishCheck.addSelectionListener(eventEditAdapter);
        waitFinishTimeoutMs = createWaitFinishTimeout(detailsGroup);
        waitFinishTimeoutMs.addSelectionListener(eventEditAdapter);
        terminateCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_terminate_at_disconnect, false);
        terminateCheck.addSelectionListener(eventEditAdapter);
        {
            Composite pauseComposite = UIUtils.createPlaceholder(detailsGroup, 2, 5);
            pauseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            pauseAfterExecute = UIUtils.createLabelSpinner(pauseComposite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_pause_label, CoreMessages.dialog_connection_edit_wizard_shell_cmd_pause_tooltip, 0, 0, Integer.MAX_VALUE);
            pauseAfterExecute.addSelectionListener(eventEditAdapter);
            UIUtils.createControlLabel(pauseComposite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_directory_label);
            workingDirectory = new TextWithOpenFolder(pauseComposite, CoreMessagesdialog_connection_edit_wizard_shell_cmd_directory_title);
            workingDirectory.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            workingDirectory.getTextControl().addModifyListener(new ModifyListener() {

                @Override
                public void modifyText(ModifyEvent e) {
                    DBRShellCommand command = getActiveCommand();
                    if (command != null) {
                        command.setWorkingDirectory(workingDirectory.getText());
                    }
                }
            });
        }
        new VariablesHintLabel(detailsGroup, DataSourceDescriptor.CONNECT_VARIABLES);
    }
    selectEventType(null);
    setControl(group);
}
Also used : DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextWithOpenFolder(org.jkiss.dbeaver.ui.controls.TextWithOpenFolder)

Example 2 with VariablesHintLabel

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

the class EditBootstrapQueriesDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(CoreMessages.dialog_connection_edit_wizard_general_bootstrap_query_title);
    Composite composite = (Composite) super.createDialogArea(parent);
    Group group = UIUtils.createControlGroup(composite, CoreMessages.dialog_connection_edit_wizard_general_bootstrap_query_sql_label, 2, GridData.FILL_BOTH, 0);
    queriesTable = new Table(group, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    final GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    gd.heightHint = 100;
    queriesTable.setLayoutData(gd);
    queriesTable.setLinesVisible(true);
    final TableColumn valueColumn = UIUtils.createTableColumn(queriesTable, SWT.LEFT, "SQL");
    valueColumn.setWidth(300);
    for (String value : queries) {
        new TableItem(queriesTable, SWT.LEFT).setText(value);
    }
    final CustomTableEditor tableEditor = new CustomTableEditor(queriesTable) {

        @Override
        protected Control createEditor(Table table, int index, TableItem item) {
            Text editor = new Text(table, SWT.BORDER);
            editor.setText(item.getText());
            return editor;
        }

        @Override
        protected void saveEditorValue(Control control, int index, TableItem item) {
            item.setText(((Text) control).getText());
        }
    };
    Composite buttonsGroup = UIUtils.createPlaceholder(group, 1, 5);
    buttonsGroup.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    final Button addButton = new Button(buttonsGroup, SWT.PUSH);
    addButton.setText(UIMessages.button_add);
    addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    addButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            tableEditor.closeEditor();
            String sql = EditTextDialog.editText(getShell(), CoreMessages.dialog_connection_edit_wizard_general_bootstrap_query_sql_title, "");
            if (sql != null) {
                TableItem newItem = new TableItem(queriesTable, SWT.LEFT);
                newItem.setText(sql);
                queriesTable.setSelection(newItem);
                UIUtils.packColumns(queriesTable, true);
            }
        }
    });
    final Button removeButton = new Button(buttonsGroup, SWT.PUSH);
    removeButton.setText(UIMessages.button_remove);
    removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    removeButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            int selectionIndex = queriesTable.getSelectionIndex();
            if (selectionIndex >= 0) {
                tableEditor.closeEditor();
                queriesTable.remove(selectionIndex);
                removeButton.setEnabled(queriesTable.getSelectionIndex() >= 0);
            }
        }
    });
    removeButton.setEnabled(false);
    queriesTable.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            int selectionIndex = queriesTable.getSelectionIndex();
            removeButton.setEnabled(selectionIndex >= 0);
        }
    });
    queriesTable.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            int sbWidth = 0;
            if (queriesTable.getVerticalBar() != null) {
                sbWidth = queriesTable.getVerticalBar().getSize().x;
            }
            queriesTable.getColumn(0).setWidth(queriesTable.getSize().x - queriesTable.getBorderWidth() * 2 - sbWidth);
        }
    });
    ignoreErrorButton = UIUtils.createCheckbox(composite, CoreMessages.dialog_connection_edit_wizard_general_bootstrap_query_ignore_error_lable, ignoreErrors);
    VariablesHintLabel variablesHintLabel = new VariablesHintLabel(composite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_variables_hint_label, CoreMessages.dialog_connection_edit_wizard_shell_cmd_variables_hint_title, DataSourceDescriptor.CONNECT_VARIABLES);
    if (dataSourceDescriptor != null) {
        variablesHintLabel.setResolver(new DataSourceVariableResolver(dataSourceDescriptor, dataSourceDescriptor.getConnectionConfiguration()));
    }
    UIUtils.asyncExec(() -> UIUtils.packColumns(queriesTable, true));
    return composite;
}
Also used : ControlAdapter(org.eclipse.swt.events.ControlAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) CustomTableEditor(org.jkiss.dbeaver.ui.controls.CustomTableEditor) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) DataSourceVariableResolver(org.jkiss.dbeaver.model.connection.DataSourceVariableResolver)

Example 3 with VariablesHintLabel

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

the class ConnectionPageAbstract method createDriverPanel.

protected void createDriverPanel(Composite parent) {
    Composite panel = UIUtils.createComposite(parent, 4);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END);
    gd.horizontalSpan = ((GridLayout) parent.getLayout()).numColumns;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    panel.setLayoutData(gd);
    if (DBWorkbench.getPlatform().getPreferenceStore().getBoolean(ModelPreferences.CONNECT_USE_ENV_VARS)) {
        variablesHintLabel = new VariablesHintLabel(panel, UIConnectionMessages.dialog_connection_edit_connection_settings_variables_hint_label, UIConnectionMessages.dialog_connection_edit_connection_settings_variables_hint_label, DataSourceDescriptor.CONNECT_VARIABLES, false);
        ((GridData) variablesHintLabel.getInfoLabel().getLayoutData()).horizontalSpan = site.isNew() ? 3 : 4;
    } else {
        UIUtils.createEmptyLabel(panel, 3, 1);
    }
    if (site.isNew()) {
        Button advSettingsButton = UIUtils.createDialogButton(panel, UIConnectionMessages.dialog_connection_edit_wizard_conn_conf_general_link, new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                site.openSettingsPage("ConnectionPageGeneral");
            }
        });
        advSettingsButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    }
    Label divLabel = new Label(panel, SWT.SEPARATOR | SWT.HORIZONTAL);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 4;
    divLabel.setLayoutData(gd);
    Label driverLabel = new Label(panel, SWT.NONE);
    driverLabel.setText(UIConnectionMessages.dialog_connection_driver);
    driverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    driverText = new Text(panel, SWT.READ_ONLY);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    // gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    // gd.widthHint = 200;
    driverText.setLayoutData(gd);
    Button driverButton = UIUtils.createDialogButton(panel, UIConnectionMessages.dialog_connection_edit_driver_button, new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (site.openDriverEditor()) {
                updateDriverInfo(site.getDriver());
            }
        }
    });
    driverButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
}
Also used : 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) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel)

Example 4 with VariablesHintLabel

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

the class ConnectionPageShellCommands method createControl.

@Override
public void createControl(Composite parent) {
    Composite group = UIUtils.createPlaceholder(parent, 2, 5);
    group.setLayoutData(new GridData(GridData.FILL_BOTH));
    {
        Composite eventGroup = UIUtils.createPlaceholder(group, 1);
        eventGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
        UIUtils.createControlLabel(eventGroup, CoreMessages.dialog_connection_events_label_event);
        eventTypeTable = new Table(eventGroup, SWT.BORDER | SWT.CHECK | SWT.SINGLE | SWT.FULL_SELECTION);
        eventTypeTable.setLayoutData(new GridData(GridData.FILL_VERTICAL));
        eventTypeTable.addListener(SWT.Selection, event -> {
            if (event.detail == SWT.CHECK) {
                eventTypeTable.select(eventTypeTable.indexOf((TableItem) event.item));
            }
        });
        for (DBPConnectionEventType eventType : DBPConnectionEventType.values()) {
            DBRShellCommand command = eventsCache.get(eventType);
            TableItem item = new TableItem(eventTypeTable, SWT.NONE);
            item.setData(eventType);
            item.setText(eventType.getTitle());
            item.setImage(DBeaverIcons.getImage(UIIcon.EVENT));
            item.setChecked(command != null && command.isEnabled());
        }
        eventTypeTable.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                DBPConnectionEventType eventType = getSelectedEventType();
                selectEventType(eventType);
                DBRShellCommand command = eventType == null ? null : eventsCache.get(eventType);
                boolean enabled = ((TableItem) e.item).getChecked();
                if (enabled || (command != null && enabled != command.isEnabled())) {
                    updateEvent(false);
                }
            }
        });
    }
    {
        Composite detailsGroup = UIUtils.createPlaceholder(group, 1, 5);
        detailsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
        UIUtils.createControlLabel(detailsGroup, CoreMessages.dialog_connection_events_label_command);
        commandText = new Text(detailsGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
        commandText.addModifyListener(e -> updateEvent(true));
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.heightHint = 60;
        gd.widthHint = 300;
        commandText.setLayoutData(gd);
        SelectionAdapter eventEditAdapter = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                updateEvent(false);
            }
        };
        showProcessCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_show_process, false);
        showProcessCheck.addSelectionListener(eventEditAdapter);
        waitFinishCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_wait_finish, false);
        waitFinishCheck.addSelectionListener(eventEditAdapter);
        waitFinishTimeoutMs = createWaitFinishTimeout(detailsGroup);
        waitFinishTimeoutMs.addSelectionListener(eventEditAdapter);
        terminateCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_terminate_at_disconnect, false);
        terminateCheck.addSelectionListener(eventEditAdapter);
        {
            Composite pauseComposite = UIUtils.createPlaceholder(detailsGroup, 2, 5);
            pauseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            pauseAfterExecute = UIUtils.createLabelSpinner(pauseComposite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_pause_label, CoreMessages.dialog_connection_edit_wizard_shell_cmd_pause_tooltip, 0, 0, Integer.MAX_VALUE);
            pauseAfterExecute.addSelectionListener(eventEditAdapter);
            UIUtils.createControlLabel(pauseComposite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_directory_label);
            workingDirectory = new TextWithOpenFolder(pauseComposite, CoreMessagesdialog_connection_edit_wizard_shell_cmd_directory_title);
            workingDirectory.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            workingDirectory.getTextControl().addModifyListener(e -> {
                DBRShellCommand command = getActiveCommand();
                if (command != null) {
                    command.setWorkingDirectory(workingDirectory.getText());
                }
            });
        }
        VariablesHintLabel variablesHintLabel = new VariablesHintLabel(detailsGroup, CoreMessages.dialog_connection_edit_wizard_shell_cmd_variables_hint_label, CoreMessages.dialog_connection_edit_wizard_shell_cmd_variables_hint_title, DataSourceDescriptor.CONNECT_VARIABLES);
        variablesHintLabel.setResolver(new DataSourceVariableResolver(dataSource, dataSource.getConnectionConfiguration()));
    }
    selectEventType(null);
    setControl(group);
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) CommonUtils(org.jkiss.utils.CommonUtils) DataSourceVariableResolver(org.jkiss.dbeaver.model.connection.DataSourceVariableResolver) org.eclipse.swt.widgets(org.eclipse.swt.widgets) HashMap(java.util.HashMap) ArrayUtils(org.jkiss.utils.ArrayUtils) CoreMessages(org.jkiss.dbeaver.core.CoreMessages) DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) DBeaverIcons(org.jkiss.dbeaver.ui.DBeaverIcons) UIUtils(org.jkiss.dbeaver.ui.UIUtils) SWT(org.eclipse.swt.SWT) Map(java.util.Map) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) UIIcon(org.jkiss.dbeaver.ui.UIIcon) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor) TextWithOpenFolder(org.jkiss.dbeaver.ui.controls.TextWithOpenFolder) GridLayout(org.eclipse.swt.layout.GridLayout) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand) DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DataSourceVariableResolver(org.jkiss.dbeaver.model.connection.DataSourceVariableResolver) TextWithOpenFolder(org.jkiss.dbeaver.ui.controls.TextWithOpenFolder)

Example 5 with VariablesHintLabel

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

the class ConnectionPageShellCommands method createControl.

@Override
public void createControl(Composite parent) {
    Composite group = UIUtils.createPlaceholder(parent, 2, 5);
    group.setLayoutData(new GridData(GridData.FILL_BOTH));
    {
        Composite eventGroup = UIUtils.createPlaceholder(group, 1);
        eventGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
        UIUtils.createControlLabel(eventGroup, CoreMessages.dialog_connection_events_label_event);
        eventTypeTable = new Table(eventGroup, SWT.BORDER | SWT.CHECK | SWT.SINGLE | SWT.FULL_SELECTION);
        eventTypeTable.setLayoutData(new GridData(GridData.FILL_VERTICAL));
        eventTypeTable.addListener(SWT.Selection, event -> {
            if (event.detail == SWT.CHECK) {
                eventTypeTable.select(eventTypeTable.indexOf((TableItem) event.item));
            }
        });
        for (DBPConnectionEventType eventType : DBPConnectionEventType.values()) {
            DBRShellCommand command = eventsCache.get(eventType);
            TableItem item = new TableItem(eventTypeTable, SWT.NONE);
            item.setData(eventType);
            item.setText(eventType.getTitle());
            item.setImage(DBeaverIcons.getImage(UIIcon.EVENT));
            item.setChecked(command != null && command.isEnabled());
        }
        eventTypeTable.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                DBPConnectionEventType eventType = getSelectedEventType();
                selectEventType(eventType);
                DBRShellCommand command = eventType == null ? null : eventsCache.get(eventType);
                boolean enabled = ((TableItem) e.item).getChecked();
                if (enabled || (command != null && enabled != command.isEnabled())) {
                    updateEvent(false);
                }
            }
        });
    }
    {
        Composite detailsGroup = UIUtils.createPlaceholder(group, 1, 5);
        detailsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
        UIUtils.createControlLabel(detailsGroup, CoreMessages.dialog_connection_events_label_command);
        commandText = new Text(detailsGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
        commandText.addModifyListener(e -> updateEvent(true));
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.heightHint = 60;
        gd.widthHint = 300;
        commandText.setLayoutData(gd);
        SelectionAdapter eventEditAdapter = new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                updateEvent(false);
            }
        };
        showProcessCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_show_process, false);
        showProcessCheck.addSelectionListener(eventEditAdapter);
        waitFinishCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_wait_finish, false);
        waitFinishCheck.addSelectionListener(eventEditAdapter);
        waitFinishTimeoutMs = createWaitFinishTimeout(detailsGroup);
        waitFinishTimeoutMs.addSelectionListener(eventEditAdapter);
        terminateCheck = UIUtils.createCheckbox(detailsGroup, CoreMessages.dialog_connection_events_checkbox_terminate_at_disconnect, false);
        terminateCheck.addSelectionListener(eventEditAdapter);
        {
            Composite pauseComposite = UIUtils.createPlaceholder(detailsGroup, 2, 5);
            pauseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            pauseAfterExecute = UIUtils.createLabelSpinner(pauseComposite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_pause_label, CoreMessages.dialog_connection_edit_wizard_shell_cmd_pause_tooltip, 0, 0, Integer.MAX_VALUE);
            pauseAfterExecute.addSelectionListener(eventEditAdapter);
            UIUtils.createControlLabel(pauseComposite, CoreMessages.dialog_connection_edit_wizard_shell_cmd_directory_label);
            workingDirectory = new TextWithOpenFolder(pauseComposite, CoreMessagesdialog_connection_edit_wizard_shell_cmd_directory_title);
            workingDirectory.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            workingDirectory.getTextControl().addModifyListener(e -> {
                DBRShellCommand command = getActiveCommand();
                if (command != null) {
                    command.setWorkingDirectory(workingDirectory.getText());
                }
            });
        }
        VariablesHintLabel variablesHintLabel = new VariablesHintLabel(detailsGroup, CoreMessages.dialog_connection_edit_wizard_shell_cmd_variables_hint_label, CoreMessages.dialog_connection_edit_wizard_shell_cmd_variables_hint_title, DataSourceDescriptor.CONNECT_VARIABLES);
        variablesHintLabel.setResolver(new DataSourceVariableResolver(dataSource, dataSource.getConnectionConfiguration()));
    }
    selectEventType(null);
    setControl(group);
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) CommonUtils(org.jkiss.utils.CommonUtils) DataSourceVariableResolver(org.jkiss.dbeaver.model.connection.DataSourceVariableResolver) org.eclipse.swt.widgets(org.eclipse.swt.widgets) HashMap(java.util.HashMap) ArrayUtils(org.jkiss.utils.ArrayUtils) CoreMessages(org.jkiss.dbeaver.core.CoreMessages) DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) DBeaverIcons(org.jkiss.dbeaver.ui.DBeaverIcons) UIUtils(org.jkiss.dbeaver.ui.UIUtils) SWT(org.eclipse.swt.SWT) Map(java.util.Map) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) UIIcon(org.jkiss.dbeaver.ui.UIIcon) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor) TextWithOpenFolder(org.jkiss.dbeaver.ui.controls.TextWithOpenFolder) GridLayout(org.eclipse.swt.layout.GridLayout) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand) DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand) VariablesHintLabel(org.jkiss.dbeaver.ui.controls.VariablesHintLabel) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DataSourceVariableResolver(org.jkiss.dbeaver.model.connection.DataSourceVariableResolver) TextWithOpenFolder(org.jkiss.dbeaver.ui.controls.TextWithOpenFolder)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 GridData (org.eclipse.swt.layout.GridData)9 VariablesHintLabel (org.jkiss.dbeaver.ui.controls.VariablesHintLabel)9 GridLayout (org.eclipse.swt.layout.GridLayout)5 DataSourceVariableResolver (org.jkiss.dbeaver.model.connection.DataSourceVariableResolver)4 DBPConnectionEventType (org.jkiss.dbeaver.model.connection.DBPConnectionEventType)3 DBRShellCommand (org.jkiss.dbeaver.model.runtime.DBRShellCommand)3 TextWithOpenFolder (org.jkiss.dbeaver.ui.controls.TextWithOpenFolder)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 SWT (org.eclipse.swt.SWT)2 ControlAdapter (org.eclipse.swt.events.ControlAdapter)2 ControlEvent (org.eclipse.swt.events.ControlEvent)2 org.eclipse.swt.widgets (org.eclipse.swt.widgets)2 CoreMessages (org.jkiss.dbeaver.core.CoreMessages)2 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 SSHImplementationDescriptor (org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationDescriptor)2 DataSourceDescriptor (org.jkiss.dbeaver.registry.DataSourceDescriptor)2 DBeaverIcons (org.jkiss.dbeaver.ui.DBeaverIcons)2