use of org.eclipse.linuxtools.docker.core.IDockerConnection in project linuxtools by eclipse.
the class ContainerInspectPropertySection method setInput.
@Override
public void setInput(final IWorkbenchPart part, final ISelection selection) {
super.setInput(part, selection);
final Object input = getSelection(selection);
final IDockerConnection parentConnection = getConnection(part, selection);
final IDockerContainerInfo containerInfo = getContainerInfo(parentConnection, input);
if (getTreeViewer() != null && containerInfo != null) {
getTreeViewer().setInput(containerInfo);
getTreeViewer().expandAll();
}
}
use of org.eclipse.linuxtools.docker.core.IDockerConnection in project linuxtools by eclipse.
the class DockerContainersContentProvider method getElements.
@Override
public Object[] getElements(final Object inputElement) {
if (inputElement instanceof IDockerConnection) {
final IDockerConnection connection = (IDockerConnection) inputElement;
if (connection.isContainersLoaded()) {
return connection.getContainers().toArray();
}
loadContainers(connection);
return EMPTY;
}
return EMPTY;
}
use of org.eclipse.linuxtools.docker.core.IDockerConnection in project linuxtools by eclipse.
the class DockerContainersView method selectionChanged.
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
final ITreeSelection treeSelection = (ITreeSelection) selection;
if (treeSelection.isEmpty()) {
setConnection(null);
return;
}
final Object firstSegment = treeSelection.getPaths()[0].getFirstSegment();
if (firstSegment instanceof IDockerConnection) {
final IDockerConnection connection = (IDockerConnection) firstSegment;
setConnection(connection);
setLabelFilterIds();
}
}
use of org.eclipse.linuxtools.docker.core.IDockerConnection in project linuxtools by eclipse.
the class DockerExplorerLabelProvider method getImage.
@Override
public Image getImage(final Object element) {
if (element instanceof IDockerConnection) {
if (((IDockerConnection) element).isOpen()) {
return OPEN_CONNECTION_IMAGE;
} else {
return UNOPEN_CONNECTION_IMAGE;
}
} else if (element instanceof DockerImagesCategory) {
return CATEGORY_IMAGE;
} else if (element instanceof DockerContainersCategory) {
return CATEGORY_IMAGE;
} else if (element instanceof IDockerImage) {
return IMAGE_IMAGE;
} else if (element instanceof IDockerContainer) {
final IDockerContainer container = (IDockerContainer) element;
final EnumDockerStatus containerStatus = EnumDockerStatus.fromStatusMessage(container.status());
if (containerStatus == EnumDockerStatus.RUNNING) {
return STARTED_CONTAINER_IMAGE;
} else if (containerStatus == EnumDockerStatus.PAUSED) {
return PAUSED_CONTAINER_IMAGE;
} else {
return STOPPED_CONTAINER_IMAGE;
}
} else if (element instanceof DockerContainerLinksCategory || element instanceof DockerContainerLink) {
return CONTAINER_LINK_IMAGE;
} else if (element instanceof DockerContainerVolumesCategory || element instanceof DockerContainerVolume) {
return CONTAINER_VOLUME_IMAGE;
} else if (element instanceof DockerContainerPortMappingsCategory || element instanceof IDockerPortMapping) {
return CONTAINER_PORT_IMAGE;
} else if (element instanceof LoadingStub) {
return LOADING_IMAGE;
}
return null;
}
use of org.eclipse.linuxtools.docker.core.IDockerConnection in project linuxtools by eclipse.
the class DockerExplorerView method createPartControl.
@Override
public void createPartControl(final Composite parent) {
final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
this.pageBook = new PageBook(parent, SWT.NONE);
this.connectionsPane = createConnectionsPane(pageBook, toolkit);
this.explanationsPane = createExplanationPane(pageBook, toolkit);
showConnectionsOrExplanations();
this.containersAndImagesSearchFilter = getContainersAndImagesSearchFilter();
getCommonViewer().addFilter(containersAndImagesSearchFilter);
DockerConnectionManager.getInstance().addConnectionManagerListener(this);
if (DockerConnectionManager.getInstance().getConnections().length > 0) {
IDockerConnection conn = DockerConnectionManager.getInstance().getConnections()[0];
getCommonViewer().setSelection(new StructuredSelection(conn));
}
}
Aggregations