Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-01-29 21:13:38 +0000
committerJeff Johnston2018-01-29 21:14:18 +0000
commit55fb64151bd85b1766dd92875a28f25117c4e631 (patch)
tree68d0885b14ebc5dba8cc0ee1b4ab17b0df3d3d86 /launch/org.eclipse.cdt.docker.launcher
parent1d9e549ae71109f97df38ded70dd548312b96023 (diff)
downloadorg.eclipse.cdt-55fb64151bd85b1766dd92875a28f25117c4e631.tar.gz
org.eclipse.cdt-55fb64151bd85b1766dd92875a28f25117c4e631.tar.xz
org.eclipse.cdt-55fb64151bd85b1766dd92875a28f25117c4e631.zip
Bug 530468 - Support passing CBuildConfiguration to Cmd Launcher Factory
- add new ICBuildCommandLauncher interface - add new defaulted method to ICommandLauncherFactory interface - add code to look at Build Configuration properties in ContainerCommandLauncherFactory - add new methods to CommandLauncherManager and ContainerCommandLauncher - add an update dialog call in ContainerTab - add calls to set and get CBuildConfiguration to ContainerCommandLauncher Change-Id: If95fafe592c7ea4580bae1a15d168d1163e132fd
Diffstat (limited to 'launch/org.eclipse.cdt.docker.launcher')
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncher.java49
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java22
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java1
3 files changed, 58 insertions, 14 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncher.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncher.java
index 43a906fd8a2..003ae70cbda 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncher.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncher.java
@@ -11,6 +11,8 @@ import java.util.Map;
import java.util.Properties;
import org.eclipse.cdt.core.ICommandLauncher;
+import org.eclipse.cdt.core.build.ICBuildCommandLauncher;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.internal.core.ProcessClosure;
@@ -35,7 +37,8 @@ import org.osgi.service.prefs.Preferences;
@SuppressWarnings("restriction")
public class ContainerCommandLauncher
- implements ICommandLauncher, IErrorMessageHolder {
+ implements ICommandLauncher, ICBuildCommandLauncher,
+ IErrorMessageHolder {
public final static String CONTAINER_BUILD_ENABLED = DockerLaunchUIPlugin.PLUGIN_ID
+ ".containerbuild.property.enablement"; //$NON-NLS-1$
@@ -55,6 +58,7 @@ public class ContainerCommandLauncher
private boolean fShowCommand;
private String fErrorMessage;
private Properties fEnvironment;
+ private ICBuildConfiguration fBuildConfig;
private String[] commandArgs;
private String fImageName = ""; //$NON-NLS-1$
@@ -81,6 +85,16 @@ public class ContainerCommandLauncher
return fProject;
}
+ @Override
+ public void setBuildConfiguration(ICBuildConfiguration config) {
+ this.fBuildConfig = config;
+ }
+
+ @Override
+ public ICBuildConfiguration getBuildConfiguration() {
+ return fBuildConfig;
+ }
+
@SuppressWarnings("unused")
private String getImageName() {
return fImageName;
@@ -236,17 +250,30 @@ public class ContainerCommandLauncher
boolean keepContainer = prefs.getBoolean(
PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(fProject).getActiveConfiguration();
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
- if (cfg == null) {
- return null;
+ ICBuildConfiguration buildCfg = getBuildConfiguration();
+ String selectedVolumeString = null;
+ String connectionName = null;
+ String imageName = null;
+ if (buildCfg != null) {
+ selectedVolumeString = buildCfg.getProperty(SELECTED_VOLUMES_ID);
+ connectionName = buildCfg.getProperty(CONNECTION_ID);
+ imageName = buildCfg.getProperty(IMAGE_ID);
+ } else {
+ ICConfigurationDescription cfgd = CoreModel.getDefault()
+ .getProjectDescription(fProject).getActiveConfiguration();
+ IConfiguration cfg = ManagedBuildManager
+ .getConfigurationForDescription(cfgd);
+ if (cfg == null) {
+ return null;
+ }
+ IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
+ selectedVolumeString = props.getProperty(SELECTED_VOLUMES_ID);
+ connectionName = props
+ .getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ imageName = props.getProperty(ContainerCommandLauncher.IMAGE_ID);
}
- IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
// Add any specified volumes to additional dir list
- String selectedVolumeString = props.getProperty(SELECTED_VOLUMES_ID);
if (selectedVolumeString != null && !selectedVolumeString.isEmpty()) {
String[] selectedVolumes = selectedVolumeString
.split(VOLUME_SEPARATOR_REGEX);
@@ -264,13 +291,9 @@ public class ContainerCommandLauncher
}
}
- String connectionName = props
- .getProperty(ContainerCommandLauncher.CONNECTION_ID);
if (connectionName == null) {
return null;
}
- String imageName = props
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
if (imageName == null) {
return null;
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java
index fa1bae38e19..4c0d8079b45 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java
@@ -16,10 +16,12 @@ import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.ICommandLauncherFactory;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
@@ -94,6 +96,26 @@ public class ContainerCommandLauncherFactory
}
@Override
+ public ICommandLauncher getCommandLauncher(ICBuildConfiguration cfgd) {
+ // check if container build enablement has been checked
+ Map<String, String> props = cfgd.getProperties();
+ if (props != null) {
+ String enablementProperty = props
+ .get(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ if (enablementProperty != null) {
+ boolean enableContainer = Boolean
+ .parseBoolean(enablementProperty);
+ // enablement has occurred, we can return a
+ // ContainerCommandLauncher
+ if (enableContainer) {
+ return new ContainerCommandLauncher();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
public void registerLanguageSettingEntries(IProject project,
List<? extends ICLanguageSettingEntry> langEntries) {
@SuppressWarnings("unchecked")
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java
index 26b6915b331..ab76710de35 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java
@@ -82,7 +82,6 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
connectionUri = connection.getUri();
if (!connectionName.equals(connection.getName())) {
setErrorMessage(null);
- updateLaunchConfigurationDialog();
initializeImageCombo();
}
connectionName = connection.getName();

Back to the top