Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java11
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java7
2 files changed, 14 insertions, 4 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java
index 1dd304e434a..c9caba7a9b3 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java
@@ -5,7 +5,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
public class ConnectionListener implements ISelectionListener {
@@ -23,11 +25,16 @@ public class ConnectionListener implements ISelectionListener {
}
public void init() {
- DockerLaunchUIPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getSelectionService()
+ IWorkbench workbench = DockerLaunchUIPlugin.getDefault().getWorkbench();
+ if (workbench != null) {
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window != null) {
+ window.getSelectionService()
.addSelectionListener(
"org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
this);
+ }
+ }
}
public IDockerConnection getCurrentConnection() {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
index c12bc884d7e..a6b1b90f63a 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
@@ -85,8 +85,11 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
public String getIpAddress() {
- IDockerNetworkSettings networkSettings = info.networkSettings();
- return networkSettings.ipAddress();
+ if (info != null) {
+ IDockerNetworkSettings networkSettings = info.networkSettings();
+ return networkSettings.ipAddress();
+ }
+ return null;
}
public IDockerContainerInfo getContainerInfo() {

Back to the top