Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2016-09-05 07:06:13 +0000
committerJeff Johnston2016-09-06 18:32:38 +0000
commitf9275928a1410a62e396059ed199962f219b5d9f (patch)
treec88ae715dd650cb8dab3956b180d5c3257f12cc9
parent6b8123316fc864e4845ca97867468a5a1ed50938 (diff)
downloadorg.eclipse.linuxtools-f9275928a1410a62e396059ed199962f219b5d9f.tar.gz
org.eclipse.linuxtools-f9275928a1410a62e396059ed199962f219b5d9f.tar.xz
org.eclipse.linuxtools-f9275928a1410a62e396059ed199962f219b5d9f.zip
Bug 500737 - NullPointerException in DockerConnection.pullImage
Disable the 'Pull Image...' command handler when the connection is not established. Change-Id: I3e9a2d85000ebd865bf42f43a778418449308b1d Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/80315 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit 3c0aec37ce80a0e7ca2790d6e8bd5510ae551000) Reviewed-on: https://git.eclipse.org/r/80512
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerConnectionFactory.java22
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/EditDockerConnectionSWTBotTest.java2
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullSWTBotTest.java64
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionSWTBotTest.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/plugin.xml4
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java33
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerContentProvider.java79
7 files changed, 190 insertions, 17 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerConnectionFactory.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerConnectionFactory.java
index d954528553..38df183c3f 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerConnectionFactory.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerConnectionFactory.java
@@ -11,6 +11,7 @@
package org.eclipse.linuxtools.internal.docker.ui.testutils;
+import org.eclipse.linuxtools.docker.core.EnumDockerConnectionState;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.docker.core.IDockerImageInfo;
import org.eclipse.linuxtools.internal.docker.core.DockerClientFactory;
@@ -46,24 +47,33 @@ public class MockDockerConnectionFactory {
public DockerConnection withUnixSocketConnectionSettings(final String pathToSocket) {
final DockerConnection connection = Mockito.spy(connectionBuilder.unixSocketConnection(new UnixSocketConnectionSettings(pathToSocket)));
configureDockerClientFactory(connection, this.dockerClient);
- configureMockBehaviour(connection);
+ configureMockBehaviour(connection, EnumDockerConnectionState.ESTABLISHED);
return connection;
}
public DockerConnection withDefaultTCPConnectionSettings() {
- return withTCPConnectionSettings(null, null);
+ return withTCPConnectionSettings(null, null, EnumDockerConnectionState.ESTABLISHED);
}
- public DockerConnection withTCPConnectionSettings(final String host, final String pathToCerts) {
+ public DockerConnection withTCPConnectionSettings(final String host, final String pathToCerts,
+ final EnumDockerConnectionState state) {
final DockerConnection connection = Mockito.spy(connectionBuilder.tcpConnection(new TCPConnectionSettings(host, pathToCerts)));
configureDockerClientFactory(connection, this.dockerClient);
- configureMockBehaviour(connection);
+ configureMockBehaviour(connection, state);
return connection;
}
- private static void configureMockBehaviour(DockerConnection connection) {
- IDockerImageInfo imageInfo = Mockito.mock(IDockerImageInfo.class, Mockito.RETURNS_DEEP_STUBS);
+ public DockerConnection withState(final EnumDockerConnectionState state) {
+ final DockerConnection connection = withDefaultTCPConnectionSettings();
+ Mockito.when(connection.getState()).thenReturn(state);
+ return connection;
+ }
+
+ private static void configureMockBehaviour(final DockerConnection connection,
+ final EnumDockerConnectionState state) {
+ final IDockerImageInfo imageInfo = Mockito.mock(IDockerImageInfo.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(connection.getImageInfo(Matchers.anyString())).thenReturn(imageInfo);
+ Mockito.when(connection.getState()).thenReturn(state);
}
private static void configureDockerClientFactory(final DockerConnection connection, final DockerClient dockerClient) {
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/EditDockerConnectionSWTBotTest.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/EditDockerConnectionSWTBotTest.java
index 225f958524..e0b2a6e1d8 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/EditDockerConnectionSWTBotTest.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/EditDockerConnectionSWTBotTest.java
@@ -124,7 +124,7 @@ public class EditDockerConnectionSWTBotTest {
private IDockerConnection configureTCPConnection(final String connectionName) {
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from(connectionName, client)
- .withTCPConnectionSettings("https://foo:1234", PATH_TO_CERTS);
+ .withTCPConnectionSettings("https://foo:1234", PATH_TO_CERTS, EnumDockerConnectionState.ESTABLISHED);
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
return dockerConnection;
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullSWTBotTest.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullSWTBotTest.java
index 1d525542cf..dad8450522 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullSWTBotTest.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullSWTBotTest.java
@@ -11,7 +11,10 @@
package org.eclipse.linuxtools.internal.docker.ui.wizards;
+import static org.assertj.core.api.Assertions.assertThat;
+
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.linuxtools.docker.core.EnumDockerConnectionState;
import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
import org.eclipse.linuxtools.internal.docker.core.DockerProgressHandler;
import org.eclipse.linuxtools.internal.docker.core.RegistryAccountInfo;
@@ -26,6 +29,7 @@ import org.eclipse.linuxtools.internal.docker.ui.testutils.swt.ClearConnectionMa
import org.eclipse.linuxtools.internal.docker.ui.testutils.swt.CloseShellRule;
import org.eclipse.linuxtools.internal.docker.ui.testutils.swt.CloseWelcomePageRule;
import org.eclipse.linuxtools.internal.docker.ui.testutils.swt.DockerConnectionManagerUtils;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.swt.MenuAssertion;
import org.eclipse.linuxtools.internal.docker.ui.testutils.swt.SWTUtils;
import org.eclipse.linuxtools.internal.docker.ui.views.DockerExplorerView;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
@@ -153,4 +157,64 @@ public class ImagePullSWTBotTest {
Mockito.verify(client, Mockito.times(1)).pull(Matchers.eq("foo.com/jboss/wildfly:latest"),
Matchers.any(DockerProgressHandler.class));
}
+
+ @Test
+ public void shouldDisablePullCommandWhenConnectionStateIsUnknown() {
+ // given
+ this.client = MockDockerClientFactory.build();
+ final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client)
+ .withState(EnumDockerConnectionState.UNKNOWN);
+ assertThat(dockerConnection.getState()).isEqualTo(EnumDockerConnectionState.UNKNOWN);
+ DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
+ // when
+ // when opening the "Push Image..." wizard
+ SWTUtils.getTreeItem(dockerExplorerViewBot, "Test").select();
+ // then
+ MenuAssertion.assertThat(dockerExplorerViewBot.bot().tree().contextMenu("Pull...")).isNotEnabled();
+ }
+
+ @Test
+ public void shouldDisablePullCommandWhenConnectionIsClosed() {
+ // given
+ this.client = MockDockerClientFactory.build();
+ final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client)
+ .withState(EnumDockerConnectionState.CLOSED);
+ assertThat(dockerConnection.getState()).isEqualTo(EnumDockerConnectionState.CLOSED);
+ DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
+ // when
+ // when opening the "Push Image..." wizard
+ SWTUtils.getTreeItem(dockerExplorerViewBot, "Test").select();
+ // then
+ MenuAssertion.assertThat(dockerExplorerViewBot.bot().tree().contextMenu("Pull...")).isNotEnabled();
+ }
+
+ @Test
+ public void shouldEnablePullCommandWhenConnectionIsEstablished() {
+ // given
+ this.client = MockDockerClientFactory.build();
+ final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client)
+ .withDefaultTCPConnectionSettings();
+ assertThat(dockerConnection.getState()).isEqualTo(EnumDockerConnectionState.ESTABLISHED);
+ DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
+ // when
+ // when opening the "Push Image..." wizard
+ SWTUtils.getTreeItem(dockerExplorerViewBot, "Test").select();
+ // then
+ MenuAssertion.assertThat(dockerExplorerViewBot.bot().tree().contextMenu("Pull...")).isEnabled();
+ }
+
+ @Test
+ public void shouldEnablePullCommandWhenConnectionIsEstablishedAndExpanded() {
+ // given
+ this.client = MockDockerClientFactory.build();
+ final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client)
+ .withDefaultTCPConnectionSettings();
+ assertThat(dockerConnection.getState()).isEqualTo(EnumDockerConnectionState.ESTABLISHED);
+ DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
+ // when
+ // when opening the "Push Image..." wizard
+ SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images").select();
+ // then
+ MenuAssertion.assertThat(dockerExplorerViewBot.bot().tree().contextMenu("Pull...")).isEnabled();
+ }
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionSWTBotTest.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionSWTBotTest.java
index e55e736f20..5cc2f67776 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionSWTBotTest.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionSWTBotTest.java
@@ -16,6 +16,7 @@ import java.io.IOException;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.linuxtools.docker.core.EnumDockerConnectionState;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
import org.eclipse.linuxtools.internal.docker.core.SystemUtils;
@@ -102,7 +103,7 @@ public class NewDockerConnectionSWTBotTest {
private IDockerConnection configureTCPConnection(final String connectionName, final String host) {
final DockerClient client = MockDockerClientFactory.build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from(connectionName, client)
- .withTCPConnectionSettings(host, null);
+ .withTCPConnectionSettings(host, null, EnumDockerConnectionState.ESTABLISHED);
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
return dockerConnection;
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/plugin.xml b/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
index ab92d943cd..242afc3e4a 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
+++ b/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
@@ -674,7 +674,7 @@
<enabledWhen>
<test
forcePluginActivation="true"
- property="org.eclipse.linuxtools.docker.propertytesters.connection.existsActiveConnection"
+ property="org.eclipse.linuxtools.docker.propertytesters.connection.connectionIsEstablished"
value="true">
</test>
</enabledWhen>
@@ -915,7 +915,7 @@
class="org.eclipse.linuxtools.internal.docker.ui.propertytesters.ConnectionPropertyTester"
id="org.eclipse.linuxtools.docker.activeconnectionPropertyTester"
namespace="org.eclipse.linuxtools.docker.propertytesters.connection"
- properties="existsActiveConnection,existsAnyConnection"
+ properties="existsActiveConnection,existsAnyConnection,connectionIsEstablished"
type="java.lang.Object">
</propertyTester>
</extension>
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java
index 538615c1b3..68996524a3 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java
@@ -10,8 +10,12 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.docker.ui.propertytesters;
+import java.util.List;
+
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.linuxtools.docker.core.DockerConnectionManager;
+import org.eclipse.linuxtools.docker.core.EnumDockerConnectionState;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.internal.docker.ui.DockerConnectionWatcher;
import org.eclipse.ui.PlatformUI;
@@ -21,7 +25,11 @@ public class ConnectionPropertyTester extends PropertyTester {
/** Property name to check if an active {@link IDockerConnection} exists. */
public static final String EXISTS_ACTIVE_CONNECTION = "existsActiveConnection"; //$NON-NLS-1$
+ /** Property name to check if the selected (parent) {@link IDockerConnection} is open. */
+ public static final String CONNECTION_ESTABLISHED = "connectionIsEstablished"; //$NON-NLS-1$
+
/** Property name to check if any {@link IDockerConnection} exists. */
+ @Deprecated
public static final String EXISTS_ANY_CONNECTION = "existsAnyConnection"; //$NON-NLS-1$
@Override
@@ -36,6 +44,31 @@ public class ConnectionPropertyTester extends PropertyTester {
case EXISTS_ANY_CONNECTION:
return expectedValue.equals(
DockerConnectionManager.getInstance().hasConnections());
+ case CONNECTION_ESTABLISHED:
+ return isConnectionEstablished(receiver, property, args,
+ expectedValue);
+ }
+ return false;
+ }
+
+ private boolean isConnectionEstablished(Object receiver, String property,
+ Object[] args, Object expectedValue) {
+ if (receiver instanceof List && !((List<?>) receiver).isEmpty()) {
+ return isConnectionEstablished(((List<?>) receiver).get(0),
+ property, args,
+ expectedValue);
+ }
+ if (receiver instanceof IAdaptable) {
+ final IDockerConnection connection = ((IAdaptable) receiver)
+ .getAdapter(IDockerConnection.class);
+ if (connection != null) {
+ return isConnectionEstablished(connection, property, args,
+ expectedValue);
+ }
+ }
+ if (receiver instanceof IDockerConnection) {
+ return expectedValue.equals(((IDockerConnection) receiver)
+ .getState() == EnumDockerConnectionState.ESTABLISHED);
}
return false;
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerContentProvider.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerContentProvider.java
index 7764554c89..21f35c0f2f 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerContentProvider.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerContentProvider.java
@@ -18,6 +18,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -286,7 +287,7 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
* Wrapper node to display {@link IDockerImage} of a given
* {@link IDockerConnection}
*/
- public static class DockerImagesCategory {
+ public static class DockerImagesCategory implements IAdaptable {
private final IDockerConnection connection;
@@ -298,6 +299,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
this.connection = connection;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getConnection();
+ }
+ return null;
+ }
+
public IDockerConnection getConnection() {
return connection;
}
@@ -334,7 +344,7 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
* Wrapper node to display {@link IDockerContainer} of a given
* {@link IDockerConnection}
*/
- public static class DockerContainersCategory {
+ public static class DockerContainersCategory implements IAdaptable {
private final IDockerConnection connection;
@@ -346,6 +356,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
this.connection = connection;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getConnection();
+ }
+ return null;
+ }
+
public IDockerConnection getConnection() {
return connection;
}
@@ -381,7 +400,8 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
* Wrapper node to display {@link IDockerPortMapping} of a given
* {@link IDockerContainer}
*/
- public static class DockerContainerPortMappingsCategory {
+ public static class DockerContainerPortMappingsCategory
+ implements IAdaptable {
private final IDockerContainer container;
@@ -419,6 +439,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
- otherPortMapping.getPrivatePort());
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getContainer().getConnection();
+ }
+ return null;
+ }
+
public IDockerContainer getContainer() {
return container;
}
@@ -463,7 +492,7 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
* Wrapper node to display the {@link DockerContainerLink} of a given
* {@link IDockerContainer}
*/
- public static class DockerContainerLinksCategory {
+ public static class DockerContainerLinksCategory implements IAdaptable {
private final IDockerContainer container;
@@ -488,6 +517,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
}
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getContainer().getConnection();
+ }
+ return null;
+ }
+
public IDockerContainer getContainer() {
return container;
}
@@ -532,7 +570,7 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
}
- public static class DockerContainerLink {
+ public static class DockerContainerLink implements IAdaptable {
private final IDockerContainer container;
@@ -556,6 +594,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
? getDisplayableContainerAlias(args[1]) : null;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getContainer().getConnection();
+ }
+ return null;
+ }
+
public IDockerContainer getContainer() {
return container;
}
@@ -633,7 +680,7 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
* Wrapper node to display {@link DockerContainerVolume} of a given
* {@link IDockerContainer}
*/
- public static class DockerContainerVolumesCategory {
+ public static class DockerContainerVolumesCategory implements IAdaptable {
private final IDockerContainer container;
@@ -659,6 +706,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
}
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getContainer().getConnection();
+ }
+ return null;
+ }
+
public IDockerContainer getContainer() {
return container;
}
@@ -703,7 +759,7 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
}
- public static class DockerContainerVolume {
+ public static class DockerContainerVolume implements IAdaptable {
private final IDockerContainer container;
@@ -739,6 +795,15 @@ public class DockerExplorerContentProvider implements ITreeContentProvider {
this.flags = args.length > 2 ? args[2] : null;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(final Class<T> adapter) {
+ if (adapter.equals(IDockerConnection.class)) {
+ return (T) getContainer().getConnection();
+ }
+ return null;
+ }
+
public IDockerContainer getContainer() {
return container;
}

Back to the top