use of org.jkiss.dbeaver.model.runtime.DBRShellCommand in project dbeaver by dbeaver.
the class EditShellCommandsDialogPage method selectEventType.
private void selectEventType(DBPConnectionEventType eventType) {
DBRShellCommand command = eventType == null ? null : eventsCache.get(eventType);
commandText.setEnabled(command != null && command.isEnabled());
showProcessCheck.setEnabled(command != null && command.isEnabled());
waitFinishCheck.setEnabled(command != null && command.isEnabled());
waitFinishTimeoutMs.setEnabled(waitFinishCheck.isEnabled());
terminateCheck.setEnabled(command != null && command.isEnabled());
pauseAfterExecute.setEnabled(command != null && command.isEnabled());
workingDirectory.setEnabled(command != null && command.isEnabled());
workingDirectory.getTextControl().setEnabled(command != null && command.isEnabled());
if (command != null) {
commandText.setText(CommonUtils.toString(command.getCommand()));
showProcessCheck.setSelection(command.isShowProcessPanel());
waitFinishCheck.setSelection(command.isWaitProcessFinish());
waitFinishTimeoutMs.setSelection(command.getWaitProcessTimeoutMs());
terminateCheck.setSelection(command.isTerminateAtDisconnect());
pauseAfterExecute.setSelection(command.getPauseAfterExecute());
workingDirectory.setText(CommonUtils.notEmpty(command.getWorkingDirectory()));
} else {
// $NON-NLS-1$
commandText.setText("");
showProcessCheck.setSelection(false);
waitFinishCheck.setSelection(false);
waitFinishTimeoutMs.setSelection(DBRShellCommand.WAIT_PROCESS_TIMEOUT_FOREVER);
terminateCheck.setSelection(false);
pauseAfterExecute.setSelection(0);
workingDirectory.setText("");
}
}
use of org.jkiss.dbeaver.model.runtime.DBRShellCommand 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;
}
use of org.jkiss.dbeaver.model.runtime.DBRShellCommand in project dbeaver by dbeaver.
the class ConnectionPageShellCommands method selectEventType.
private void selectEventType(DBPConnectionEventType eventType) {
DBRShellCommand command = eventType == null ? null : eventsCache.get(eventType);
commandText.setEnabled(command != null && command.isEnabled());
showProcessCheck.setEnabled(command != null && command.isEnabled());
waitFinishCheck.setEnabled(command != null && command.isEnabled());
waitFinishTimeoutMs.setEnabled(waitFinishCheck.isEnabled());
terminateCheck.setEnabled(command != null && command.isEnabled());
pauseAfterExecute.setEnabled(command != null && command.isEnabled());
workingDirectory.setEnabled(command != null && command.isEnabled());
workingDirectory.getTextControl().setEnabled(command != null && command.isEnabled());
if (command != null) {
commandText.setText(CommonUtils.toString(command.getCommand()));
showProcessCheck.setSelection(command.isShowProcessPanel());
waitFinishCheck.setSelection(command.isWaitProcessFinish());
waitFinishTimeoutMs.setSelection(command.getWaitProcessTimeoutMs());
terminateCheck.setSelection(command.isTerminateAtDisconnect());
pauseAfterExecute.setSelection(command.getPauseAfterExecute());
workingDirectory.setText(CommonUtils.notEmpty(command.getWorkingDirectory()));
} else {
// $NON-NLS-1$
commandText.setText("");
showProcessCheck.setSelection(false);
waitFinishCheck.setSelection(false);
waitFinishTimeoutMs.setSelection(DBRShellCommand.WAIT_PROCESS_TIMEOUT_FOREVER);
terminateCheck.setSelection(false);
pauseAfterExecute.setSelection(0);
workingDirectory.setText("");
}
}
use of org.jkiss.dbeaver.model.runtime.DBRShellCommand 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);
}
}
use of org.jkiss.dbeaver.model.runtime.DBRShellCommand in project dbeaver by dbeaver.
the class StreamTransferConsumer method executeFinishCommand.
private void executeFinishCommand() {
String commandLine = translatePattern(settings.getFinishProcessCommand(), outputFile);
DBRShellCommand command = new DBRShellCommand(commandLine);
DBRProcessDescriptor processDescriptor = new DBRProcessDescriptor(command);
try {
processDescriptor.execute();
} catch (DBException e) {
DBWorkbench.getPlatformUI().showError(DTMessages.stream_transfer_consumer_title_run_process, NLS.bind(DTMessages.stream_transfer_consumer_message_error_running_process, commandLine), e);
}
}
Aggregations