use of org.jkiss.dbeaver.model.DBPRefreshableObject in project dbeaver by serge-rider.
the class ERDEditorEmbedded method loadDiagram.
@Override
protected synchronized void loadDiagram(final boolean refreshMetadata) {
final DBSObject object = getRootObject();
if (object == null) {
return;
}
if (diagramLoadingJob != null) {
// Do not start new one while old is running
return;
}
diagramLoadingJob = LoadingJob.createService(new DatabaseLoadService<EntityDiagram>("Load diagram '" + object.getName() + "'", object.getDataSource()) {
@Override
public EntityDiagram evaluate(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (refreshMetadata && object instanceof DBPRefreshableObject) {
try {
getEditorInput().getNavigatorNode().refreshNode(monitor, ERDEditorEmbedded.this);
} catch (DBException e) {
log.warn("Error refreshing database metadata", e);
}
}
try {
return loadFromDatabase(monitor);
} catch (DBException e) {
log.error("Error loading ER diagram", e);
}
return null;
}
}, progressControl.createLoadVisualizer());
diagramLoadingJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
diagramLoadingJob = null;
}
});
diagramLoadingJob.schedule();
}
Aggregations