use of org.jkiss.dbeaver.model.runtime.load.AbstractLoadService in project dbeaver by serge-rider.
the class ERDEditorStandalone method loadDiagram.
/*
protected void createActions()
{
super.createActions();
//addEditorAction(new SaveAction(this));
}
*/
@Override
protected synchronized void loadDiagram(boolean refreshMetadata) {
if (diagramLoadingJob != null) {
// Do not start new one while old is running
return;
}
diagramLoadingJob = LoadingJob.createService(new AbstractLoadService<EntityDiagram>("Load diagram '" + getEditorInput().getName() + "'") {
@Override
public EntityDiagram evaluate(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
return loadContentFromFile(monitor);
} catch (DBException e) {
log.error(e);
}
return null;
}
@Override
public Object getFamily() {
return ERDEditorStandalone.this;
}
}, progressControl.createLoadVisualizer());
diagramLoadingJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
diagramLoadingJob = null;
}
});
diagramLoadingJob.schedule();
setPartName(getEditorInput().getName());
}
use of org.jkiss.dbeaver.model.runtime.load.AbstractLoadService in project dbeaver by dbeaver.
the class LoadingJob method run.
private IStatus run(DBRProgressMonitor monitor, boolean lazy) {
monitor = visualizer.overwriteMonitor(monitor);
if (this.loadingService instanceof AbstractLoadService) {
((AbstractLoadService) this.loadingService).initService(monitor, this);
}
LoadingUIJob<RESULT> updateUIJob = new LoadingUIJob<>(this);
updateUIJob.schedule();
Throwable error = null;
RESULT result = null;
try {
result = this.loadingService.evaluate(monitor);
} catch (InvocationTargetException e) {
error = e.getTargetException();
} catch (InterruptedException e) {
return new Status(Status.CANCEL, DBeaverCore.PLUGIN_ID, "Loading interrupted");
} finally {
loadFinished = true;
DBeaverUI.asyncExec(new LoadFinisher(result, error));
}
return Status.OK_STATUS;
}
use of org.jkiss.dbeaver.model.runtime.load.AbstractLoadService in project dbeaver by serge-rider.
the class ERDEditorStandalone method loadDiagram.
/*
protected void createActions()
{
super.createActions();
//addEditorAction(new SaveAction(this));
}
*/
@Override
protected synchronized void loadDiagram(boolean refreshMetadata) {
if (diagramLoadingJob != null) {
// Do not start new one while old is running
return;
}
diagramLoadingJob = LoadingJob.createService(new AbstractLoadService<EntityDiagram>("Load diagram '" + getEditorInput().getName() + "'") {
@Override
public EntityDiagram evaluate(DBRProgressMonitor monitor) {
try {
return loadContentFromFile(monitor);
} catch (DBException e) {
log.error(e);
}
return null;
}
@Override
public Object getFamily() {
return ERDEditorStandalone.this;
}
}, progressControl.createLoadVisualizer());
diagramLoadingJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
diagramLoadingJob = null;
}
});
diagramLoadingJob.schedule();
setPartName(getEditorInput().getName());
}
use of org.jkiss.dbeaver.model.runtime.load.AbstractLoadService in project dbeaver by dbeaver.
the class ERDEditorStandalone method loadDiagram.
/*
protected void createActions()
{
super.createActions();
//addEditorAction(new SaveAction(this));
}
*/
@Override
protected synchronized void loadDiagram(boolean refreshMetadata) {
if (diagramLoadingJob != null) {
// Do not start new one while old is running
return;
}
diagramLoadingJob = LoadingJob.createService(new AbstractLoadService<EntityDiagram>("Load diagram '" + getEditorInput().getName() + "'") {
@Override
public EntityDiagram evaluate(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
return loadContentFromFile(monitor);
} catch (DBException e) {
log.error(e);
}
return null;
}
@Override
public Object getFamily() {
return ERDEditorStandalone.this;
}
}, progressControl.createLoadVisualizer());
diagramLoadingJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
diagramLoadingJob = null;
}
});
diagramLoadingJob.schedule();
setPartName(getEditorInput().getName());
}
use of org.jkiss.dbeaver.model.runtime.load.AbstractLoadService in project dbeaver by serge-rider.
the class LoadingJob method run.
private IStatus run(DBRProgressMonitor monitor, boolean lazy) {
monitor = visualizer.overwriteMonitor(monitor);
if (this.loadingService instanceof AbstractLoadService) {
((AbstractLoadService) this.loadingService).initService(monitor, this);
}
LoadingUIJob<RESULT> updateUIJob = new LoadingUIJob<>(this);
updateUIJob.schedule();
Throwable error = null;
RESULT result = null;
monitor.beginTask("Run service " + getName(), 1);
try {
result = this.loadingService.evaluate(monitor);
} catch (InvocationTargetException e) {
log.debug(e.getTargetException());
error = e.getTargetException();
} catch (InterruptedException e) {
return new Status(Status.CANCEL, UIActivator.PLUGIN_ID, "Loading interrupted");
} finally {
loadFinished = true;
UIUtils.asyncExec(new LoadFinisher(result, error));
monitor.done();
}
return Status.OK_STATUS;
}
Aggregations