use of org.jkiss.dbeaver.model.impl.DefaultServerOutputReader in project dbeaver by serge-rider.
the class SQLEditor method runPostExecuteActions.
private void runPostExecuteActions(@Nullable SQLQueryResult result) {
final DBCExecutionContext executionContext = getExecutionContext();
if (executionContext != null) {
final DBPDataSource dataSource = executionContext.getDataSource();
// Dump server output
DBCServerOutputReader outputReader = DBUtils.getAdapter(DBCServerOutputReader.class, dataSource);
if (outputReader == null && result != null) {
outputReader = new DefaultServerOutputReader(result);
}
if (outputReader != null && outputReader.isServerOutputEnabled()) {
dumpServerOutput(executionContext, outputReader);
}
// Refresh active object
if (result == null || !result.hasError() && getActivePreferenceStore().getBoolean(SQLPreferenceConstants.REFRESH_DEFAULTS_AFTER_EXECUTE)) {
final DBSObjectSelector objectSelector = DBUtils.getAdapter(DBSObjectSelector.class, dataSource);
if (objectSelector != null) {
new AbstractJob("Refresh default object") {
@Override
protected IStatus run(DBRProgressMonitor monitor) {
try (DBCSession session = executionContext.openSession(monitor, DBCExecutionPurpose.UTIL, "Refresh default object")) {
objectSelector.refreshDefaultObject(session);
} catch (Exception e) {
log.error(e);
}
return Status.OK_STATUS;
}
}.schedule();
}
}
}
}
Aggregations