use of org.eclipse.linuxtools.docker.core.IDockerConnectionInfo in project linuxtools by eclipse.
the class DockerConnection method getInfo.
@Override
public IDockerConnectionInfo getInfo() throws DockerException {
if (this.client == null) {
return null;
}
try {
final Info info = this.client.info();
final Version version = this.client.version();
return new DockerConnectionInfo(info, version);
} catch (com.spotify.docker.client.exceptions.DockerRequestException e) {
throw new DockerException(e.message());
} catch (com.spotify.docker.client.exceptions.DockerException | InterruptedException e) {
throw new DockerException(Messages.Docker_General_Info_Failure, e);
}
}
use of org.eclipse.linuxtools.docker.core.IDockerConnectionInfo in project linuxtools by eclipse.
the class ConnectionInfoPropertySection method updateConnectionInfo.
private void updateConnectionInfo(final IDockerConnection connection) {
// Set the tree empty while we wait for the real data
if (getTreeViewer() != null) {
getTreeViewer().setInput(null);
getTreeViewer().expandAll();
}
final Job loadConnectionInfoJob = new Job(DVMessages.getString(LoadingConnectionInfo)) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
monitor.beginTask(DVMessages.getString(LoadingConnectionInfo), 1);
if (connection.getState() != EnumDockerConnectionState.ESTABLISHED) {
return Status.OK_STATUS;
}
try {
final IDockerConnectionInfo info = connection.getInfo();
Display.getDefault().asyncExec(() -> {
if (info != null && getTreeViewer() != null) {
getTreeViewer().setInput(info);
getTreeViewer().expandAll();
}
});
} catch (DockerException e) {
Activator.log(e);
}
monitor.done();
return Status.OK_STATUS;
}
};
loadConnectionInfoJob.schedule();
}
Aggregations