use of org.jkiss.dbeaver.ui.controls.ProgressLoaderVisualizer in project dbeaver by dbeaver.
the class ResultSetJobDataRead method run.
@Override
protected IStatus run(DBRProgressMonitor monitor) {
error = null;
final ProgressLoaderVisualizer<Object> visualizer = new ProgressLoaderVisualizer<>(this, progressControl);
DBRProgressMonitor progressMonitor = visualizer.overwriteMonitor(monitor);
DBCExecutionPurpose purpose = dataFilter != null && dataFilter.hasFilters() ? DBCExecutionPurpose.USER_FILTERED : DBCExecutionPurpose.USER;
new PumpVisualizer(visualizer).schedule(PROGRESS_VISUALIZE_PERIOD * 2);
try (DBCSession session = getExecutionContext().openSession(progressMonitor, purpose, NLS.bind(CoreMessages.controls_rs_pump_job_context_name, dataContainer.toString()))) {
DBUtils.tryExecuteRecover(monitor, getDataContainer().getDataSource(), monitor1 -> {
try {
statistics = dataContainer.readData(ResultSetJobDataRead.this, session, controller.getDataReceiver(), dataFilter, offset, maxRows, DBSDataContainer.FLAG_READ_PSEUDO);
} catch (Throwable e) {
throw new InvocationTargetException(e);
}
});
} catch (DBException e) {
error = e;
} finally {
visualizer.completeLoading(null);
}
return Status.OK_STATUS;
}
use of org.jkiss.dbeaver.ui.controls.ProgressLoaderVisualizer in project dbeaver by serge-rider.
the class ResultSetJobDataRead method run.
@Override
protected IStatus run(DBRProgressMonitor monitor) {
error = null;
final ProgressLoaderVisualizer<Object> visualizer = new ProgressLoaderVisualizer<>(this, progressControl);
DBRProgressMonitor progressMonitor = visualizer.overwriteMonitor(monitor);
new PumpVisualizer(visualizer).schedule(PROGRESS_VISUALIZE_PERIOD * 2);
long fetchFlags = DBSDataContainer.FLAG_READ_PSEUDO;
if (offset > 0) {
fetchFlags |= DBSDataContainer.FLAG_FETCH_SEGMENT;
}
if (offset > 0 && getExecutionContext().getDataSource().getContainer().getPreferenceStore().getBoolean(ModelPreferences.RESULT_SET_REREAD_ON_SCROLLING)) {
if (maxRows > 0) {
maxRows += offset;
}
offset = 0;
}
if (refresh) {
fetchFlags |= DBSDataContainer.FLAG_REFRESH;
}
long finalFlags = fetchFlags;
DBCExecutionPurpose purpose = dataFilter != null && dataFilter.hasFilters() ? DBCExecutionPurpose.USER_FILTERED : DBCExecutionPurpose.USER;
progressMonitor.beginTask("Read data", 1);
try (DBCSession session = getExecutionContext().openSession(progressMonitor, purpose, NLS.bind(ResultSetMessages.controls_rs_pump_job_context_name, dataContainer.toString()))) {
progressMonitor.subTask("Read data from container");
DBExecUtils.tryExecuteRecover(monitor, session.getDataSource(), monitor1 -> {
try {
statistics = dataContainer.readData(ResultSetJobDataRead.this, session, controller.getDataReceiver(), dataFilter, offset, maxRows, finalFlags, 0);
} catch (Throwable e) {
throw new InvocationTargetException(e);
}
});
} catch (Throwable e) {
error = e;
} finally {
visualizer.completeLoading(null);
progressMonitor.done();
}
return Status.OK_STATUS;
}
use of org.jkiss.dbeaver.ui.controls.ProgressLoaderVisualizer in project dbeaver by serge-rider.
the class SessionManagerViewer method loadPlainTextDetails.
private void loadPlainTextDetails(DBAServerSessionDetails data, StyledText styledText) {
SessionDetailsLoadService loadingService = new SessionDetailsLoadService(data);
LoadingJob.createService(loadingService, new ProgressLoaderVisualizer<Collection<DBPObject>>(loadingService, styledText) {
@Override
public void completeLoading(Collection<DBPObject> dbpObjects) {
StringBuilder text = new StringBuilder();
for (DBPObject item : dbpObjects) {
if (item instanceof DBPObjectWithDescription) {
text.append(((DBPObjectWithDescription) item).getDescription());
text.append(GeneralUtils.getDefaultLineSeparator());
}
}
styledText.setText(text.toString());
}
}).schedule();
}
Aggregations