Search in sources :

Example 1 with IDockerConnectionInfo

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);
    }
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IDockerVersion(org.eclipse.linuxtools.docker.core.IDockerVersion) Version(com.spotify.docker.client.messages.Version) Info(com.spotify.docker.client.messages.Info) IDockerConnectionInfo(org.eclipse.linuxtools.docker.core.IDockerConnectionInfo) IDockerImageInfo(org.eclipse.linuxtools.docker.core.IDockerImageInfo) ContainerInfo(com.spotify.docker.client.messages.ContainerInfo) IDockerContainerInfo(org.eclipse.linuxtools.docker.core.IDockerContainerInfo) ImageInfo(com.spotify.docker.client.messages.ImageInfo) IDockerConnectionInfo(org.eclipse.linuxtools.docker.core.IDockerConnectionInfo)

Example 2 with IDockerConnectionInfo

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();
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IDockerConnectionInfo(org.eclipse.linuxtools.docker.core.IDockerConnectionInfo) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

DockerException (org.eclipse.linuxtools.docker.core.DockerException)2 IDockerConnectionInfo (org.eclipse.linuxtools.docker.core.IDockerConnectionInfo)2 ContainerInfo (com.spotify.docker.client.messages.ContainerInfo)1 ImageInfo (com.spotify.docker.client.messages.ImageInfo)1 Info (com.spotify.docker.client.messages.Info)1 Version (com.spotify.docker.client.messages.Version)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 IDockerContainerInfo (org.eclipse.linuxtools.docker.core.IDockerContainerInfo)1 IDockerImageInfo (org.eclipse.linuxtools.docker.core.IDockerImageInfo)1 IDockerVersion (org.eclipse.linuxtools.docker.core.IDockerVersion)1