Search in sources :

Example 11 with DBPConnectionEventType

use of org.jkiss.dbeaver.model.connection.DBPConnectionEventType in project dbeaver by dbeaver.

the class ConnectionPageShellCommands method getActiveCommand.

private DBRShellCommand getActiveCommand() {
    DBPConnectionEventType eventType = getSelectedEventType();
    if (eventType != null) {
        DBRShellCommand command = eventsCache.get(eventType);
        if (command == null) {
            // $NON-NLS-1$
            command = new DBRShellCommand("");
            eventsCache.put(eventType, command);
        }
        return command;
    }
    return null;
}
Also used : DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand)

Example 12 with DBPConnectionEventType

use of org.jkiss.dbeaver.model.connection.DBPConnectionEventType in project dbeaver by serge-rider.

the class ConnectionPageGeneral method configureEvents.

private void configureEvents() {
    DataSourceDescriptor dataSource = getActiveDataSource();
    EditShellCommandsDialog dialog = new EditShellCommandsDialog(getShell(), dataSource);
    if (dialog.open() == IDialogConstants.OK_ID) {
        eventsButton.setFont(getFont());
        for (DBPConnectionEventType eventType : dataSource.getConnectionConfiguration().getDeclaredEvents()) {
            if (dataSource.getConnectionConfiguration().getEvent(eventType).isEnabled()) {
                eventsButton.setFont(boldFont);
                break;
            }
        }
    }
}
Also used : DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor)

Example 13 with DBPConnectionEventType

use of org.jkiss.dbeaver.model.connection.DBPConnectionEventType in project dbeaver by dbeaver.

the class EditShellCommandsDialogPage method getActiveCommand.

private DBRShellCommand getActiveCommand() {
    DBPConnectionEventType eventType = getSelectedEventType();
    if (eventType != null) {
        DBRShellCommand command = eventsCache.get(eventType);
        if (command == null) {
            // $NON-NLS-1$
            command = new DBRShellCommand("");
            eventsCache.put(eventType, command);
        }
        return command;
    }
    return null;
}
Also used : DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand)

Example 14 with DBPConnectionEventType

use of org.jkiss.dbeaver.model.connection.DBPConnectionEventType in project dbeaver by dbeaver.

the class ConnectionPageShellCommands method updateEvent.

private void updateEvent(boolean commandChange) {
    DBPConnectionEventType eventType = getSelectedEventType();
    DBRShellCommand command = getActiveCommand();
    if (command != null) {
        boolean prevEnabled = command.isEnabled();
        if (commandChange) {
            command.setCommand(commandText.getText());
        } else {
            TableItem item = getEventItem(eventType);
            if (item != null) {
                command.setEnabled(item.getChecked());
            }
            command.setShowProcessPanel(showProcessCheck.getSelection());
            command.setWaitProcessFinish(waitFinishCheck.getSelection());
            waitFinishTimeoutMs.setEnabled(waitFinishCheck.getSelection());
            command.setWaitProcessTimeoutMs(waitFinishTimeoutMs.getSelection());
            command.setTerminateAtDisconnect(terminateCheck.getSelection());
            command.setPauseAfterExecute(pauseAfterExecute.getSelection());
            command.setWorkingDirectory(workingDirectory.getText());
            if (prevEnabled != command.isEnabled()) {
                selectEventType(eventType);
            }
        }
    } else if (!commandChange) {
        selectEventType(null);
    }
}
Also used : DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand)

Example 15 with DBPConnectionEventType

use of org.jkiss.dbeaver.model.connection.DBPConnectionEventType in project dbeaver by serge-rider.

the class ConnectionPageShellCommands method updateEvent.

private void updateEvent(boolean commandChange) {
    DBPConnectionEventType eventType = getSelectedEventType();
    DBRShellCommand command = getActiveCommand();
    if (command != null) {
        boolean prevEnabled = command.isEnabled();
        if (commandChange) {
            command.setCommand(commandText.getText());
        } else {
            TableItem item = getEventItem(eventType);
            if (item != null) {
                command.setEnabled(item.getChecked());
            }
            command.setShowProcessPanel(showProcessCheck.getSelection());
            command.setWaitProcessFinish(waitFinishCheck.getSelection());
            waitFinishTimeoutMs.setEnabled(waitFinishCheck.getSelection());
            command.setWaitProcessTimeoutMs(waitFinishTimeoutMs.getSelection());
            command.setTerminateAtDisconnect(terminateCheck.getSelection());
            command.setPauseAfterExecute(pauseAfterExecute.getSelection());
            command.setWorkingDirectory(workingDirectory.getText());
            if (prevEnabled != command.isEnabled()) {
                selectEventType(eventType);
            }
        }
    } else if (!commandChange) {
        selectEventType(null);
    }
}
Also used : DBPConnectionEventType(org.jkiss.dbeaver.model.connection.DBPConnectionEventType) DBRShellCommand(org.jkiss.dbeaver.model.runtime.DBRShellCommand)

Aggregations

DBPConnectionEventType (org.jkiss.dbeaver.model.connection.DBPConnectionEventType)15 DBRShellCommand (org.jkiss.dbeaver.model.runtime.DBRShellCommand)13 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 DataSourceDescriptor (org.jkiss.dbeaver.registry.DataSourceDescriptor)4 TextWithOpenFolder (org.jkiss.dbeaver.ui.controls.TextWithOpenFolder)3 VariablesHintLabel (org.jkiss.dbeaver.ui.controls.VariablesHintLabel)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 SWT (org.eclipse.swt.SWT)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 org.eclipse.swt.widgets (org.eclipse.swt.widgets)2 CoreMessages (org.jkiss.dbeaver.core.CoreMessages)2 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 DBPConnectionBootstrap (org.jkiss.dbeaver.model.connection.DBPConnectionBootstrap)2 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)2 DataSourceVariableResolver (org.jkiss.dbeaver.model.connection.DataSourceVariableResolver)2