Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:20:42 +0000
committerJonah Graham2018-11-22 21:47:02 +0000
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /launch/org.eclipse.cdt.docker.launcher
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
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.java98
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java165
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java93
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/DockerLaunchUIPlugin.java20
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/IContainerLaunchTarget.java2
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/BaseDatabindingModel.java2
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java7
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerDataVolumeDialog.java249
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java329
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationTabGroup.java3
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPortDialog.java107
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java389
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyVolumesModel.java29
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTab.java249
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTabModel.java6
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/DataVolumeModel.java52
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ExposedPortModel.java79
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java179
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ILaunchConstants.java31
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java232
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java6
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java70
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerTab.java5
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/SWTImagesFactory.java41
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java87
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java74
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchConfigProvider.java62
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchDescriptorType.java2
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/Messages.java6
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizard.java20
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizardPage.java24
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerHeaderPreferencePage.java44
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerLaunchPreferencePage.java12
33 files changed, 963 insertions, 1811 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 3a9d9d1f1f2..3b65d0fb914 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
@@ -37,18 +37,13 @@ import org.eclipse.osgi.util.NLS;
import org.osgi.service.prefs.Preferences;
@SuppressWarnings("restriction")
-public class ContainerCommandLauncher
- implements ICommandLauncher, ICBuildCommandLauncher,
- IErrorMessageHolder {
+public class ContainerCommandLauncher implements ICommandLauncher, ICBuildCommandLauncher, IErrorMessageHolder {
public final static String CONTAINER_BUILD_ENABLED = DockerLaunchUIPlugin.PLUGIN_ID
+ ".containerbuild.property.enablement"; //$NON-NLS-1$
- public final static String CONNECTION_ID = DockerLaunchUIPlugin.PLUGIN_ID
- + ".containerbuild.property.connection"; //$NON-NLS-1$
- public final static String IMAGE_ID = DockerLaunchUIPlugin.PLUGIN_ID
- + ".containerbuild.property.image"; //$NON-NLS-1$
- public final static String VOLUMES_ID = DockerLaunchUIPlugin.PLUGIN_ID
- + ".containerbuild.property.volumes"; //$NON-NLS-1$
+ public final static String CONNECTION_ID = DockerLaunchUIPlugin.PLUGIN_ID + ".containerbuild.property.connection"; //$NON-NLS-1$
+ public final static String IMAGE_ID = DockerLaunchUIPlugin.PLUGIN_ID + ".containerbuild.property.image"; //$NON-NLS-1$
+ public final static String VOLUMES_ID = DockerLaunchUIPlugin.PLUGIN_ID + ".containerbuild.property.volumes"; //$NON-NLS-1$
public final static String SELECTED_VOLUMES_ID = DockerLaunchUIPlugin.PLUGIN_ID
+ ".containerbuild.property.selectedvolumes"; //$NON-NLS-1$
@@ -154,9 +149,8 @@ public class ContainerCommandLauncher
}
@Override
- public Process execute(IPath commandPath, String[] args, String[] env,
- IPath workingDirectory, IProgressMonitor monitor)
- throws CoreException {
+ public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory,
+ IProgressMonitor monitor) throws CoreException {
HashMap<String, String> labels = new HashMap<>();
labels.put("org.eclipse.cdt.container-command", ""); //$NON-NLS-1$ //$NON-NLS-2$
@@ -184,8 +178,7 @@ public class ContainerCommandLauncher
cmdList.add(commandString);
commandSegments.add(commandString);
for (String arg : args) {
- String realArg = VariablesPlugin.getDefault()
- .getStringVariableManager().performStringSubstitution(arg);
+ String realArg = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(arg);
if (Platform.getOS().equals(Platform.OS_WIN32)) {
// check if file exists and if so, add an additional directory
IPath p = new Path(realArg);
@@ -201,8 +194,7 @@ public class ContainerCommandLauncher
p = p.removeLastSegments(1);
}
if (f != null && f.exists()) {
- additionalDirs.add(
- "/" + p.toPortableString().replace(':', '/')); //$NON-NLS-1$
+ additionalDirs.add("/" + p.toPortableString().replace(':', '/')); //$NON-NLS-1$
realArg = modifiedArg;
}
}
@@ -223,19 +215,17 @@ public class ContainerCommandLauncher
cmdList.add(realArg);
commandSegments.add(realArg);
}
-
+
commandArgs = commandSegments.toArray(new String[0]);
IProject[] referencedProjects = fProject.getReferencedProjects();
for (IProject referencedProject : referencedProjects) {
- String referencedProjectPath = referencedProject.getLocation()
- .toPortableString();
+ String referencedProjectPath = referencedProject.getLocation().toPortableString();
if (referencedProject.getLocation().getDevice() != null) {
referencedProjectPath = "/" //$NON-NLS-1$
+ referencedProjectPath.replace(':', '/');
}
- additionalDirs
- .add(referencedProjectPath);
+ additionalDirs.add(referencedProjectPath);
}
String workingDir = workingDirectory.makeAbsolute().toPortableString();
@@ -253,11 +243,9 @@ public class ContainerCommandLauncher
ContainerLauncher launcher = new ContainerLauncher();
- Preferences prefs = InstanceScope.INSTANCE
- .getNode(DockerLaunchUIPlugin.PLUGIN_ID);
+ Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
- boolean keepContainer = prefs.getBoolean(
- PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
+ boolean keepContainer = prefs.getBoolean(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
ICBuildConfiguration buildCfg = getBuildConfiguration();
String selectedVolumeString = null;
@@ -266,29 +254,24 @@ public class ContainerCommandLauncher
if (buildCfg != null) {
IToolChain toolChain = buildCfg.getToolChain();
selectedVolumeString = toolChain.getProperty(SELECTED_VOLUMES_ID);
- connectionName = toolChain
- .getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
- imageName = toolChain
- .getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
+ connectionName = toolChain.getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
+ imageName = toolChain.getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
} else {
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(fProject).getActiveConfiguration();
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ 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);
+ connectionName = props.getProperty(ContainerCommandLauncher.CONNECTION_ID);
imageName = props.getProperty(ContainerCommandLauncher.IMAGE_ID);
}
// Add any specified volumes to additional dir list
if (selectedVolumeString != null && !selectedVolumeString.isEmpty()) {
- String[] selectedVolumes = selectedVolumeString
- .split(VOLUME_SEPARATOR_REGEX);
+ String[] selectedVolumes = selectedVolumeString.split(VOLUME_SEPARATOR_REGEX);
if (Platform.getOS().equals(Platform.OS_WIN32)) {
for (String selectedVolume : selectedVolumes) {
IPath path = new Path(selectedVolume);
@@ -311,13 +294,8 @@ public class ContainerCommandLauncher
}
setImageName(imageName);
- fProcess = launcher.runCommand(connectionName, imageName, fProject,
- this,
- cmdList,
- workingDir,
- additionalDirs,
- origEnv, fEnvironment, supportStdin, privilegedMode,
- labels, keepContainer);
+ fProcess = launcher.runCommand(connectionName, imageName, fProject, this, cmdList, workingDir, additionalDirs,
+ origEnv, fEnvironment, supportStdin, privilegedMode, labels, keepContainer);
return fProcess;
}
@@ -333,13 +311,11 @@ public class ContainerCommandLauncher
} catch (CoreException e) {
return imageName;
}
- imageName = toolChain
- .getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
+ imageName = toolChain.getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
} else {
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(fProject).getActiveConfiguration();
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(fProject)
+ .getActiveConfiguration();
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
if (cfg == null) {
return imageName;
}
@@ -385,8 +361,7 @@ public class ContainerCommandLauncher
}
@Override
- public int waitAndRead(OutputStream output, OutputStream err,
- IProgressMonitor monitor) {
+ public int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor) {
printImageHeader(output);
if (fShowCommand) {
@@ -442,10 +417,8 @@ public class ContainerCommandLauncher
protected void printImageHeader(OutputStream os) {
if (os != null) {
try {
- os.write(NLS
- .bind(Messages.ContainerCommandLauncher_image_msg,
- ((ContainerCommandProcess) fProcess).getImage())
- .getBytes());
+ os.write(NLS.bind(Messages.ContainerCommandLauncher_image_msg,
+ ((ContainerCommandProcess) fProcess).getImage()).getBytes());
os.write(NEWLINE.getBytes());
os.flush();
} catch (IOException e) {
@@ -456,15 +429,13 @@ public class ContainerCommandLauncher
@Override
public String getConsoleHeader() {
- return NLS.bind(Messages.ContainerCommandLauncher_image_msg,
- calculateImageName()) + NEWLINE;
+ return NLS.bind(Messages.ContainerCommandLauncher_image_msg, calculateImageName()) + NEWLINE;
}
protected void printCommandLine(OutputStream os) {
if (os != null) {
try {
- os.write(getCommandLineQuoted(getCommandArgs(), true)
- .getBytes());
+ os.write(getCommandLineQuoted(getCommandArgs(), true).getBytes());
os.flush();
} catch (IOException e) {
// ignore;
@@ -477,11 +448,8 @@ public class ContainerCommandLauncher
StringBuilder buf = new StringBuilder();
if (commandArgs != null) {
for (String commandArg : commandArgs) {
- if (quote && (commandArg.contains(" ")
- || commandArg.contains("\"")
- || commandArg.contains("\\"))) {
- commandArg = '"' + commandArg.replaceAll("\\\\", "\\\\\\\\")
- .replaceAll("\"", "\\\\\"") + '"';
+ if (quote && (commandArg.contains(" ") || commandArg.contains("\"") || commandArg.contains("\\"))) {
+ commandArg = '"' + commandArg.replaceAll("\\\\", "\\\\\\\\").replaceAll("\"", "\\\\\"") + '"';
}
buf.append(commandArg);
buf.append(' ');
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 f2c5a88f1bc..3cfb3df4174 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
@@ -45,8 +45,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher;
@SuppressWarnings("restriction")
-public class ContainerCommandLauncherFactory
- implements ICommandLauncherFactory, ICommandLauncherFactory2 {
+public class ContainerCommandLauncherFactory implements ICommandLauncherFactory, ICommandLauncherFactory2 {
private IProject project;
@@ -55,16 +54,14 @@ public class ContainerCommandLauncherFactory
public ICommandLauncher getCommandLauncher(IProject project) {
this.project = project;
// check if container build enablement has been checked
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(project, false)
- .getActiveConfiguration();
+ ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project, false)
+ .getActiveConfiguration();
IConfiguration cfg = null;
try {
if (cfgd instanceof CConfigurationDescriptionCache) {
- CConfigurationData data = ((CConfigurationDescriptionCache) cfgd)
- .getConfigurationData();
+ CConfigurationData data = ((CConfigurationDescriptionCache) cfgd).getConfigurationData();
if (data instanceof BuildConfigurationData) {
cfg = ((BuildConfigurationData) data).getConfiguration();
}
@@ -83,11 +80,9 @@ public class ContainerCommandLauncherFactory
IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
if (props != null) {
- String enablementProperty = props.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String enablementProperty = props.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (enablementProperty != null) {
- boolean enableContainer = Boolean
- .parseBoolean(enablementProperty);
+ boolean enableContainer = Boolean.parseBoolean(enablementProperty);
// enablement has occurred, we can return a
// ContainerCommandLauncher
if (enableContainer) {
@@ -99,11 +94,9 @@ public class ContainerCommandLauncherFactory
}
@Override
- public ICommandLauncher getCommandLauncher(
- ICConfigurationDescription cfgd) {
+ public ICommandLauncher getCommandLauncher(ICConfigurationDescription cfgd) {
// check if container build enablement has been checked
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
// TODO: figure out why this occurs
if (cfg == null) {
return null;
@@ -111,11 +104,9 @@ public class ContainerCommandLauncherFactory
this.project = (IProject) cfg.getManagedProject().getOwner();
IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
if (props != null) {
- String enablementProperty = props.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String enablementProperty = props.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (enablementProperty != null) {
- boolean enableContainer = Boolean
- .parseBoolean(enablementProperty);
+ boolean enableContainer = Boolean.parseBoolean(enablementProperty);
// enablement has occurred, we can return a
// ContainerCommandLauncher
if (enableContainer) {
@@ -138,8 +129,7 @@ public class ContainerCommandLauncherFactory
try {
toolchain = cfgd.getToolChain();
if (toolchain != null) {
- if (ContainerTargetTypeProvider.CONTAINER_LINUX
- .equals(toolchain.getProperty(IToolChain.ATTR_OS))) {
+ if (ContainerTargetTypeProvider.CONTAINER_LINUX.equals(toolchain.getProperty(IToolChain.ATTR_OS))) {
return new ContainerCommandLauncher();
}
}
@@ -150,30 +140,23 @@ public class ContainerCommandLauncherFactory
}
@Override
- public void registerLanguageSettingEntries(IProject project,
- List<? extends ICLanguageSettingEntry> langEntries) {
+ public void registerLanguageSettingEntries(IProject project, List<? extends ICLanguageSettingEntry> langEntries) {
@SuppressWarnings("unchecked")
List<ICLanguageSettingEntry> entries = (List<ICLanguageSettingEntry>) langEntries;
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(project).getActiveConfiguration();
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
+ .getActiveConfiguration();
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
if (props != null) {
- String enablementProperty = props.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String enablementProperty = props.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (enablementProperty != null) {
- boolean enableContainer = Boolean
- .parseBoolean(enablementProperty);
+ boolean enableContainer = Boolean.parseBoolean(enablementProperty);
if (enableContainer) {
- String connectionName = props.getProperty(
- ContainerCommandLauncher.CONNECTION_ID);
- String imageName = props
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
- if (connectionName == null || connectionName.isEmpty()
- || imageName == null || imageName.isEmpty()) {
- DockerLaunchUIPlugin.logErrorMessage(
- Messages.ContainerCommandLauncher_invalid_values);
+ String connectionName = props.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ String imageName = props.getProperty(ContainerCommandLauncher.IMAGE_ID);
+ if (connectionName == null || connectionName.isEmpty() || imageName == null
+ || imageName.isEmpty()) {
+ DockerLaunchUIPlugin.logErrorMessage(Messages.ContainerCommandLauncher_invalid_values);
return;
}
ContainerLauncher launcher = new ContainerLauncher();
@@ -189,12 +172,10 @@ public class ContainerCommandLauncherFactory
// the directory name as the connection may be
// connected to a different repo using the same
// image name.
- IPath pluginPath = Platform.getStateLocation(Platform
- .getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
+ IPath pluginPath = Platform.getStateLocation(Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
.append("HEADERS"); //$NON-NLS-1$
pluginPath.toFile().mkdir();
- pluginPath = pluginPath
- .append(getCleanName(connectionName));
+ pluginPath = pluginPath.append(getCleanName(connectionName));
pluginPath.toFile().mkdir();
// To allow the user to later manage the headers, store
// the
@@ -204,16 +185,14 @@ public class ContainerCommandLauncherFactory
try {
f.createNewFile();
try (FileWriter writer = new FileWriter(f);
- BufferedWriter bufferedWriter = new BufferedWriter(
- writer);) {
+ BufferedWriter bufferedWriter = new BufferedWriter(writer);) {
bufferedWriter.write(connectionName);
bufferedWriter.newLine();
} catch (IOException e) {
DockerLaunchUIPlugin.log(e);
return;
}
- pluginPath = pluginPath
- .append(getCleanName(imageName));
+ pluginPath = pluginPath.append(getCleanName(imageName));
pluginPath.toFile().mkdir();
// To allow the user to later manage the headers,
// store the
@@ -222,8 +201,7 @@ public class ContainerCommandLauncherFactory
f = imageNamePath.toFile();
f.createNewFile();
try (FileWriter writer = new FileWriter(f);
- BufferedWriter bufferedWriter = new BufferedWriter(
- writer);) {
+ BufferedWriter bufferedWriter = new BufferedWriter(writer);) {
bufferedWriter.write(imageName);
bufferedWriter.newLine();
} catch (IOException e) {
@@ -238,9 +216,8 @@ public class ContainerCommandLauncherFactory
List<String> excludeList = new ArrayList<>();
excludeList.add(project.getLocation().toString());
@SuppressWarnings("unused")
- int status = launcher.fetchContainerDirs(connectionName,
- imageName,
- paths, excludeList, hostDir);
+ int status = launcher.fetchContainerDirs(connectionName, imageName, paths, excludeList,
+ hostDir);
}
}
}
@@ -258,8 +235,7 @@ public class ContainerCommandLauncherFactory
try {
toolchain = cfgd.getToolChain();
if (toolchain != null) {
- if (ContainerTargetTypeProvider.CONTAINER_LINUX
- .equals(toolchain.getProperty(IToolChain.ATTR_OS))) {
+ if (ContainerTargetTypeProvider.CONTAINER_LINUX.equals(toolchain.getProperty(IToolChain.ATTR_OS))) {
isContainerEnabled = true;
}
}
@@ -268,14 +244,10 @@ public class ContainerCommandLauncherFactory
}
if (isContainerEnabled) {
- String connectionName = toolchain
- .getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
- String imageName = toolchain
- .getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
- if (connectionName == null || connectionName.isEmpty()
- || imageName == null || imageName.isEmpty()) {
- DockerLaunchUIPlugin.logErrorMessage(
- Messages.ContainerCommandLauncher_invalid_values);
+ String connectionName = toolchain.getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
+ String imageName = toolchain.getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
+ if (connectionName == null || connectionName.isEmpty() || imageName == null || imageName.isEmpty()) {
+ DockerLaunchUIPlugin.logErrorMessage(Messages.ContainerCommandLauncher_invalid_values);
return includePaths;
}
if (includePaths.size() > 0) {
@@ -285,9 +257,7 @@ public class ContainerCommandLauncherFactory
// the directory name as the connection may be
// connected to a different repo using the same
// image name.
- IPath pluginPath = Platform
- .getStateLocation(Platform
- .getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
+ IPath pluginPath = Platform.getStateLocation(Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
.append("HEADERS"); //$NON-NLS-1$
pluginPath.toFile().mkdir();
pluginPath = pluginPath.append(getCleanName(connectionName));
@@ -300,8 +270,7 @@ public class ContainerCommandLauncherFactory
try {
f.createNewFile();
try (FileWriter writer = new FileWriter(f);
- BufferedWriter bufferedWriter = new BufferedWriter(
- writer);) {
+ BufferedWriter bufferedWriter = new BufferedWriter(writer);) {
bufferedWriter.write(connectionName);
bufferedWriter.newLine();
} catch (IOException e) {
@@ -317,8 +286,7 @@ public class ContainerCommandLauncherFactory
f = imageNamePath.toFile();
f.createNewFile();
try (FileWriter writer = new FileWriter(f);
- BufferedWriter bufferedWriter = new BufferedWriter(
- writer);) {
+ BufferedWriter bufferedWriter = new BufferedWriter(writer);) {
bufferedWriter.write(imageName);
bufferedWriter.newLine();
} catch (IOException e) {
@@ -333,11 +301,10 @@ public class ContainerCommandLauncherFactory
// exclude project directories from any copying operation
List<String> excludeList = new ArrayList<>();
excludeList.add(project.getLocation().toString());
- int status = launcher.fetchContainerDirsSync(connectionName,
- imageName, includePaths, excludeList, hostDir);
+ int status = launcher.fetchContainerDirsSync(connectionName, imageName, includePaths, excludeList,
+ hostDir);
if (status == 0) {
- Set<String> copiedVolumes = launcher
- .getCopiedVolumes(connectionName, imageName);
+ Set<String> copiedVolumes = launcher.getCopiedVolumes(connectionName, imageName);
List<String> newEntries = new ArrayList<>();
for (String path : includePaths) {
@@ -359,9 +326,7 @@ public class ContainerCommandLauncherFactory
// the headers will be recopied)
// TODO: fix this in a minor release to be an additional method
// that can be registered by the removal of the header files
- IPath pluginPath = Platform
- .getStateLocation(Platform
- .getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
+ IPath pluginPath = Platform.getStateLocation(Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
.append("HEADERS").append(getCleanName(connectionName)) //$NON-NLS-1$
.append(getCleanName(imageName));
toolchain.setProperty("cdt.needScannerRefresh", //$NON-NLS-1$
@@ -372,53 +337,41 @@ public class ContainerCommandLauncherFactory
}
@Override
- public List<ICLanguageSettingEntry> verifyLanguageSettingEntries(
- IProject project, List<ICLanguageSettingEntry> entries) {
+ public List<ICLanguageSettingEntry> verifyLanguageSettingEntries(IProject project,
+ List<ICLanguageSettingEntry> entries) {
if (entries == null) {
return null;
}
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(project).getActiveConfiguration();
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
+ .getActiveConfiguration();
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
if (props != null) {
- String enablementProperty = props.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String enablementProperty = props.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (enablementProperty != null) {
- boolean enableContainer = Boolean
- .parseBoolean(enablementProperty);
+ boolean enableContainer = Boolean.parseBoolean(enablementProperty);
if (enableContainer) {
- String connectionName = props.getProperty(
- ContainerCommandLauncher.CONNECTION_ID);
- String imageName = props
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
- if (connectionName == null || connectionName.isEmpty()
- || imageName == null || imageName.isEmpty()) {
- DockerLaunchUIPlugin.logErrorMessage(
- Messages.ContainerCommandLauncher_invalid_values);
+ String connectionName = props.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ String imageName = props.getProperty(ContainerCommandLauncher.IMAGE_ID);
+ if (connectionName == null || connectionName.isEmpty() || imageName == null
+ || imageName.isEmpty()) {
+ DockerLaunchUIPlugin.logErrorMessage(Messages.ContainerCommandLauncher_invalid_values);
return entries;
}
ContainerLauncher launcher = new ContainerLauncher();
- Set<String> copiedVolumes = launcher
- .getCopiedVolumes(connectionName, imageName);
+ Set<String> copiedVolumes = launcher.getCopiedVolumes(connectionName, imageName);
List<ICLanguageSettingEntry> newEntries = new ArrayList<>();
- IPath pluginPath = Platform.getStateLocation(
- Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID));
+ IPath pluginPath = Platform.getStateLocation(Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID));
IPath hostDir = pluginPath.append("HEADERS") //$NON-NLS-1$
- .append(getCleanName(connectionName))
- .append(getCleanName(imageName));
+ .append(getCleanName(connectionName)).append(getCleanName(imageName));
for (ICLanguageSettingEntry entry : entries) {
if (entry instanceof ICIncludePathEntry) {
- if (copiedVolumes
- .contains(((ICIncludePathEntry) entry)
- .getName().toString())) {
- // //$NON-NLS-2$
+ if (copiedVolumes.contains(((ICIncludePathEntry) entry).getName().toString())) {
+ // //$NON-NLS-2$
IPath newPath = hostDir.append(entry.getName());
- CIncludePathEntry newEntry = new CIncludePathEntry(
- newPath.toString(),
+ CIncludePathEntry newEntry = new CIncludePathEntry(newPath.toString(),
entry.getFlags());
newEntries.add(newEntry);
continue;
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
index 24de64e4128..1b20e3ca293 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Red Hat Inc. - modified for use with Docker Container launching
*******************************************************************************/
@@ -46,8 +46,7 @@ import org.eclipse.linuxtools.docker.core.IDockerImage;
* @author jjohnstn
*
*/
-public class ContainerTargetTypeProvider
- implements ILaunchTargetProvider, IDockerConnectionManagerListener {
+public class ContainerTargetTypeProvider implements ILaunchTargetProvider, IDockerConnectionManagerListener {
public static final String TYPE_ID = "org.eclipse.cdt.docker.launcher.launchTargetType.container"; //$NON-NLS-1$
public static final String CONTAINER_LINUX = "linux-container"; //$NON-NLS-1$
@@ -57,24 +56,21 @@ public class ContainerTargetTypeProvider
@Override
public synchronized void init(ILaunchTargetManager targetManager) {
this.targetManager = targetManager;
- ILaunchBarManager launchbarManager = CDebugCorePlugin
- .getService(ILaunchBarManager.class);
+ ILaunchBarManager launchbarManager = CDebugCorePlugin.getService(ILaunchBarManager.class);
ILaunchTarget defaultTarget = null;
try {
defaultTarget = launchbarManager.getActiveLaunchTarget();
} catch (CoreException e) {
// ignore
}
- IDockerConnection[] connections = DockerConnectionManager.getInstance()
- .getConnections();
+ IDockerConnection[] connections = DockerConnectionManager.getInstance().getConnections();
Map<String, IDockerConnection> establishedConnectionMap = new HashMap<>();
Set<String> imageNames = new HashSet<>();
for (IDockerConnection connection : connections) {
// Get Images before checking state as the state may be
// unknown until a request is made
List<IDockerImage> images = connection.getImages();
- if (connection
- .getState() == EnumDockerConnectionState.ESTABLISHED) {
+ if (connection.getState() == EnumDockerConnectionState.ESTABLISHED) {
establishedConnectionMap.put(connection.getUri(), connection);
}
for (IDockerImage image : images) {
@@ -87,20 +83,15 @@ public class ContainerTargetTypeProvider
imageName += "[" + connection.getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
imageNames.add(imageName);
- ILaunchTarget target = targetManager
- .getLaunchTarget(TYPE_ID, imageName);
+ ILaunchTarget target = targetManager.getLaunchTarget(TYPE_ID, imageName);
if (target == null) {
- target = targetManager.addLaunchTarget(TYPE_ID,
- imageName);
+ target = targetManager.addLaunchTarget(TYPE_ID, imageName);
}
ILaunchTargetWorkingCopy wc = target.getWorkingCopy();
wc.setAttribute(ILaunchTarget.ATTR_OS, CONTAINER_LINUX);
- wc.setAttribute(ILaunchTarget.ATTR_ARCH,
- Platform.getOSArch());
- wc.setAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI,
- connection.getUri());
- wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID,
- image.repoTags().get(0));
+ wc.setAttribute(ILaunchTarget.ATTR_ARCH, Platform.getOSArch());
+ wc.setAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, connection.getUri());
+ wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, image.repoTags().get(0));
wc.save();
}
@@ -111,8 +102,7 @@ public class ContainerTargetTypeProvider
ILaunchTarget[] targets = targetManager.getLaunchTargetsOfType(TYPE_ID);
for (ILaunchTarget target : targets) {
try {
- String uri = target.getAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
+ String uri = target.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
if (!establishedConnectionMap.containsKey(uri)) {
targetManager.removeLaunchTarget(target);
}
@@ -123,8 +113,7 @@ public class ContainerTargetTypeProvider
// add a Docker Connection listener to handle enablement/disablement of
// Connections
- DockerConnectionManager.getInstance()
- .addConnectionManagerListener(this);
+ DockerConnectionManager.getInstance().addConnectionManagerListener(this);
// re-check configs in case an enabled Connection has made old configs
// valid again do this in a separate job to prevent a possible
@@ -136,8 +125,7 @@ public class ContainerTargetTypeProvider
// call the recheckConfigs method in case any disabled targets
// are now
// ok
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager mgr = CCorePlugin.getService(ICBuildConfigurationManager.class);
ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
cbuildmanager.recheckConfigs();
return Status.OK_STATUS;
@@ -161,32 +149,27 @@ public class ContainerTargetTypeProvider
}
@Override
- public synchronized void changeEvent(final IDockerConnection connection,
- final int type) {
+ public synchronized void changeEvent(final IDockerConnection connection, final int type) {
Job checkConfigs = new Job("Check configs") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager mgr = CCorePlugin.getService(ICBuildConfigurationManager.class);
ICBuildConfigurationManager2 manager = (ICBuildConfigurationManager2) mgr;
if (type == IDockerConnectionManagerListener.ADD_EVENT
|| type == IDockerConnectionManagerListener.ENABLE_EVENT) {
- ILaunchBarManager launchbarManager = CDebugCorePlugin
- .getService(ILaunchBarManager.class);
+ ILaunchBarManager launchbarManager = CDebugCorePlugin.getService(ILaunchBarManager.class);
ILaunchTarget defaultTarget = null;
try {
- defaultTarget = launchbarManager
- .getActiveLaunchTarget();
+ defaultTarget = launchbarManager.getActiveLaunchTarget();
} catch (CoreException e) {
// ignore
}
List<IDockerImage> images = connection.getImages();
for (IDockerImage image : images) {
- if (!image.isDangling()
- && !image.isIntermediateImage()) {
+ if (!image.isDangling() && !image.isIntermediateImage()) {
String imageName = "[" //$NON-NLS-1$
+ image.repoTags().get(0).replace(':', '_')
@@ -194,35 +177,24 @@ public class ContainerTargetTypeProvider
+ "]"; //$NON-NLS-1$
String imageName2 = imageName + "[" //$NON-NLS-1$
+ connection.getName() + "]"; //$NON-NLS-1$
- ILaunchTarget target = targetManager
- .getLaunchTarget(TYPE_ID, imageName2);
+ ILaunchTarget target = targetManager.getLaunchTarget(TYPE_ID, imageName2);
if (target != null) {
continue;
}
- target = targetManager.getLaunchTarget(TYPE_ID,
- imageName);
+ target = targetManager.getLaunchTarget(TYPE_ID, imageName);
if (target != null) {
- if (target.getAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI,
- "").equals(connection.getUri())) {
+ if (target.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, "")
+ .equals(connection.getUri())) {
continue;
}
imageName = imageName2;
}
- target = targetManager.addLaunchTarget(TYPE_ID,
- imageName);
- ILaunchTargetWorkingCopy wc = target
- .getWorkingCopy();
- wc.setAttribute(ILaunchTarget.ATTR_OS,
- CONTAINER_LINUX);
- wc.setAttribute(ILaunchTarget.ATTR_ARCH,
- Platform.getOSArch());
- wc.setAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI,
- connection.getUri());
- wc.setAttribute(
- IContainerLaunchTarget.ATTR_IMAGE_ID,
- image.repoTags().get(0));
+ target = targetManager.addLaunchTarget(TYPE_ID, imageName);
+ ILaunchTargetWorkingCopy wc = target.getWorkingCopy();
+ wc.setAttribute(ILaunchTarget.ATTR_OS, CONTAINER_LINUX);
+ wc.setAttribute(ILaunchTarget.ATTR_ARCH, Platform.getOSArch());
+ wc.setAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, connection.getUri());
+ wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, image.repoTags().get(0));
wc.save();
}
@@ -231,8 +203,7 @@ public class ContainerTargetTypeProvider
// reset the default target back again
if (defaultTarget != null) {
try {
- launchbarManager
- .setActiveLaunchTarget(defaultTarget);
+ launchbarManager.setActiveLaunchTarget(defaultTarget);
} catch (CoreException e) {
DockerLaunchUIPlugin.log(e);
}
@@ -245,11 +216,9 @@ public class ContainerTargetTypeProvider
} else if (type == IDockerConnectionManagerListener.REMOVE_EVENT
|| type == IDockerConnectionManagerListener.DISABLE_EVENT) {
String connectionURI = connection.getUri();
- ILaunchTarget[] targets = targetManager
- .getLaunchTargetsOfType(TYPE_ID);
+ ILaunchTarget[] targets = targetManager.getLaunchTargetsOfType(TYPE_ID);
for (ILaunchTarget target : targets) {
- String uri = target.getAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
+ String uri = target.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
if (connectionURI.equals(uri)) {
targetManager.removeLaunchTarget(target);
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/DockerLaunchUIPlugin.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/DockerLaunchUIPlugin.java
index 3af7500fdfd..85ab18f8bb9 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/DockerLaunchUIPlugin.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/DockerLaunchUIPlugin.java
@@ -24,7 +24,7 @@ import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
- *
+ *
* @noextend This class is not intended to be subclassed by Clients
*/
public class DockerLaunchUIPlugin extends AbstractUIPlugin {
@@ -43,7 +43,7 @@ public class DockerLaunchUIPlugin extends AbstractUIPlugin {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
@@ -56,7 +56,7 @@ public class DockerLaunchUIPlugin extends AbstractUIPlugin {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
@@ -76,8 +76,7 @@ public class DockerLaunchUIPlugin extends AbstractUIPlugin {
}
public static Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window = getDefault().getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
return window.getShell();
}
@@ -88,14 +87,13 @@ public class DockerLaunchUIPlugin extends AbstractUIPlugin {
if (getActiveWorkbenchShell() != null) {
return getActiveWorkbenchShell();
}
- IWorkbenchWindow[] windows = getDefault().getWorkbench()
- .getWorkbenchWindows();
+ IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
return windows[0].getShell();
}
/**
* Convenience method which returns the unique identifier of this plugin.
- *
+ *
* @return The identifier.
*/
public static String getUniqueIdentifier() {
@@ -127,8 +125,7 @@ public class DockerLaunchUIPlugin extends AbstractUIPlugin {
* @since 1.1
*/
public static void logErrorMessage(String message) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR,
- message, null));
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
}
/**
@@ -138,8 +135,7 @@ public class DockerLaunchUIPlugin extends AbstractUIPlugin {
* the exception to be logged
*/
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR,
- e.getMessage(), e));
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
}
public static void log(int status, String msg, Throwable e) {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/IContainerLaunchTarget.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/IContainerLaunchTarget.java
index 3b430d9d1ee..01a2c921347 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/IContainerLaunchTarget.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/IContainerLaunchTarget.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Red Hat Inc. - initial contribution
*******************************************************************************/
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/BaseDatabindingModel.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/BaseDatabindingModel.java
index 7e68e586491..1049a27549d 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/BaseDatabindingModel.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/BaseDatabindingModel.java
@@ -19,7 +19,7 @@ import java.beans.PropertyChangeSupport;
/**
* Base class for all model classes that need Databinding support
- *
+ *
*/
public abstract class BaseDatabindingModel {
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 aec3d7eb687..d5ba9bd686d 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
@@ -39,9 +39,7 @@ public class ConnectionListener implements ISelectionListener {
if (workbench != null) {
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
if (window != null) {
- window.getSelectionService()
- .addSelectionListener(
- "org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
+ window.getSelectionService().addSelectionListener("org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
this);
}
}
@@ -57,8 +55,7 @@ public class ConnectionListener implements ISelectionListener {
if (treeSelection.isEmpty()) {
return;
}
- final Object firstSegment = treeSelection.getPaths()[0]
- .getFirstSegment();
+ final Object firstSegment = treeSelection.getPaths()[0].getFirstSegment();
if (firstSegment instanceof IDockerConnection) {
currentConnection = (IDockerConnection) firstSegment;
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerDataVolumeDialog.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerDataVolumeDialog.java
index 890fca8fb92..75f4626aa43 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerDataVolumeDialog.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerDataVolumeDialog.java
@@ -75,8 +75,7 @@ public class ContainerDataVolumeDialog extends Dialog {
private final IDockerConnection connection;
- public ContainerDataVolumeDialog(final Shell parentShell,
- final IDockerConnection connection,
+ public ContainerDataVolumeDialog(final Shell parentShell, final IDockerConnection connection,
final DataVolumeModel selectedDataVolume) {
super(parentShell);
this.connection = connection;
@@ -84,8 +83,7 @@ public class ContainerDataVolumeDialog extends Dialog {
this.containerNames = WizardUtils.getContainerNames(connection);
}
- public ContainerDataVolumeDialog(final Shell parentShell,
- final IDockerConnection connection) {
+ public ContainerDataVolumeDialog(final Shell parentShell, final IDockerConnection connection) {
super(parentShell);
this.connection = connection;
this.model = new DataVolumeModel();
@@ -100,18 +98,15 @@ public class ContainerDataVolumeDialog extends Dialog {
protected void configureShell(final Shell shell) {
super.configureShell(shell);
setShellStyle(getShellStyle() | SWT.RESIZE);
- shell.setText(
- WizardMessages.getString("ContainerDataVolumeDialog.title")); //$NON-NLS-1$
+ shell.setText(WizardMessages.getString("ContainerDataVolumeDialog.title")); //$NON-NLS-1$
}
/**
* Disable the 'OK' button by default
*/
@Override
- protected Button createButton(Composite parent, int id, String label,
- boolean defaultButton) {
- final Button button = super.createButton(parent, id, label,
- defaultButton);
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ final Button button = super.createButton(parent, id, label, defaultButton);
if (id == IDialogConstants.OK_ID) {
button.setEnabled(false);
}
@@ -127,172 +122,121 @@ public class ContainerDataVolumeDialog extends Dialog {
protected Control createDialogArea(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
final int COLUMNS = 3;
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1)
- .grab(true, true).applyTo(container);
- GridLayoutFactory.fillDefaults().margins(10, 10).numColumns(COLUMNS)
- .applyTo(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, true).applyTo(container);
+ GridLayoutFactory.fillDefaults().margins(10, 10).numColumns(COLUMNS).applyTo(container);
// Container path
final Label containerPathLabel = new Label(container, SWT.NONE);
- containerPathLabel.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.containerPathLabel")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(containerPathLabel);
+ containerPathLabel.setText(WizardMessages.getString("ContainerDataVolumeDialog.containerPathLabel")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(containerPathLabel);
final Text containerPathText = new Text(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).applyTo(containerPathText);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(containerPathText);
final IObservableValue containerPathObservable = BeanProperties
- .value(DataVolumeModel.class, DataVolumeModel.CONTAINER_PATH)
- .observe(model);
- dbc.bindValue(
- WidgetProperties.text(SWT.Modify).observe(containerPathText),
- containerPathObservable);
+ .value(DataVolumeModel.class, DataVolumeModel.CONTAINER_PATH).observe(model);
+ dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(containerPathText), containerPathObservable);
// mount type
final Label explanationLabel = new Label(container, SWT.NONE);
- explanationLabel.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.explanationLabel")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .span(COLUMNS, 1).grab(true, false).applyTo(explanationLabel);
+ explanationLabel.setText(WizardMessages.getString("ContainerDataVolumeDialog.explanationLabel")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).grab(true, false)
+ .applyTo(explanationLabel);
final int INDENT = 20;
// No mount
final Button noMountButton = new Button(container, SWT.RADIO);
- noMountButton.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.noMountButton")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .indent(INDENT, 0).span(COLUMNS, 1).grab(true, false)
+ noMountButton.setText(WizardMessages.getString("ContainerDataVolumeDialog.noMountButton")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).span(COLUMNS, 1).grab(true, false)
.applyTo(noMountButton);
bindButton(noMountButton, MountType.NONE);
// File System mount
final Button fileSystemMountButton = new Button(container, SWT.RADIO);
- fileSystemMountButton.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.fileSystemMountButton")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .indent(INDENT, 0).span(COLUMNS, 1).grab(true, false)
+ fileSystemMountButton.setText(WizardMessages.getString("ContainerDataVolumeDialog.fileSystemMountButton")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).span(COLUMNS, 1).grab(true, false)
.applyTo(fileSystemMountButton);
final Label hostPathLabel = new Label(container, SWT.NONE);
- hostPathLabel.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.hostPathLabel")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .indent(2 * INDENT, SWT.DEFAULT).grab(false, false)
+ hostPathLabel.setText(WizardMessages.getString("ContainerDataVolumeDialog.hostPathLabel")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(2 * INDENT, SWT.DEFAULT).grab(false, false)
.applyTo(hostPathLabel);
final Text hostPathText = new Text(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).applyTo(hostPathText);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(hostPathText);
final IObservableValue hostPathObservable = BeanProperties
- .value(DataVolumeModel.class, DataVolumeModel.HOST_PATH_MOUNT)
- .observe(model);
- dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(hostPathText),
- hostPathObservable);
+ .value(DataVolumeModel.class, DataVolumeModel.HOST_PATH_MOUNT).observe(model);
+ dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(hostPathText), hostPathObservable);
// browse for directory
final Button hostPathDirectoryButton = new Button(container, SWT.NONE);
- hostPathDirectoryButton.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.directoryButton")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(hostPathDirectoryButton);
+ hostPathDirectoryButton.setText(WizardMessages.getString("ContainerDataVolumeDialog.directoryButton")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(hostPathDirectoryButton);
hostPathDirectoryButton.addSelectionListener(onHostDirectoryPath());
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(new Label(container, SWT.NONE));
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false)
+ .applyTo(new Label(container, SWT.NONE));
// optional read-only access
final Button readOnlyButton = new Button(container, SWT.CHECK);
- readOnlyButton.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.readOnlyButton")); //$NON-NLS-1$
- readOnlyButton.setToolTipText(WizardMessages
- .getString("ContainerDataVolumeDialog.readOnlyButtonTooltip")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .span(COLUMNS - 2, 1).grab(true, false).applyTo(readOnlyButton);
- final ISWTObservableValue readOnlyButtonObservable = WidgetProperties
- .selection().observe(readOnlyButton);
+ readOnlyButton.setText(WizardMessages.getString("ContainerDataVolumeDialog.readOnlyButton")); //$NON-NLS-1$
+ readOnlyButton.setToolTipText(WizardMessages.getString("ContainerDataVolumeDialog.readOnlyButtonTooltip")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS - 2, 1).grab(true, false)
+ .applyTo(readOnlyButton);
+ final ISWTObservableValue readOnlyButtonObservable = WidgetProperties.selection().observe(readOnlyButton);
dbc.bindValue(readOnlyButtonObservable,
- BeanProperties
- .value(DataVolumeModel.class,
- DataVolumeModel.READ_ONLY_VOLUME)
- .observe(model));
+ BeanProperties.value(DataVolumeModel.class, DataVolumeModel.READ_ONLY_VOLUME).observe(model));
// browse for file
final Button hostPathFileButton = new Button(container, SWT.NONE);
- hostPathFileButton.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.fileButton")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(hostPathFileButton);
+ hostPathFileButton.setText(WizardMessages.getString("ContainerDataVolumeDialog.fileButton")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(hostPathFileButton);
hostPathFileButton.addSelectionListener(onHostFilePath());
- bindButton(fileSystemMountButton, MountType.HOST_FILE_SYSTEM,
- hostPathText, hostPathDirectoryButton, hostPathFileButton,
- readOnlyButton);
+ bindButton(fileSystemMountButton, MountType.HOST_FILE_SYSTEM, hostPathText, hostPathDirectoryButton,
+ hostPathFileButton, readOnlyButton);
// Container mount
final Button containerMountButton = new Button(container, SWT.RADIO);
- containerMountButton.setText(WizardMessages
- .getString("ContainerDataVolumeDialog.containerMountButton")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .indent(INDENT, 0).span(COLUMNS, 1).grab(true, false)
+ containerMountButton.setText(WizardMessages.getString("ContainerDataVolumeDialog.containerMountButton")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).span(COLUMNS, 1).grab(true, false)
.applyTo(containerMountButton);
final Label containerSelectionLabel = new Label(container, SWT.NONE);
- containerSelectionLabel.setText(WizardMessages.getString(
- "ContainerDataVolumeDialog.containerSelectionLabel")); //$NON-NLS-1$
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .indent(2 * INDENT, SWT.DEFAULT)
+ containerSelectionLabel.setText(WizardMessages.getString("ContainerDataVolumeDialog.containerSelectionLabel")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(2 * INDENT, SWT.DEFAULT)
.applyTo(containerSelectionLabel);
final Combo containerSelectionCombo = new Combo(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).span(1, 1).applyTo(containerSelectionCombo);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1)
+ .applyTo(containerSelectionCombo);
new ControlDecoration(containerSelectionCombo, SWT.TOP | SWT.LEFT);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(new Label(container, SWT.NONE));
- bindButton(containerMountButton, MountType.CONTAINER,
- containerSelectionCombo);
- final ComboViewer containerSelectionComboViewer = new ComboViewer(
- containerSelectionCombo);
- containerSelectionComboViewer
- .setContentProvider(new ArrayContentProvider());
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false)
+ .applyTo(new Label(container, SWT.NONE));
+ bindButton(containerMountButton, MountType.CONTAINER, containerSelectionCombo);
+ final ComboViewer containerSelectionComboViewer = new ComboViewer(containerSelectionCombo);
+ containerSelectionComboViewer.setContentProvider(new ArrayContentProvider());
containerSelectionComboViewer.setInput(this.containerNames);
final IObservableValue selectedContainerObservable = BeanProperties
- .value(DataVolumeModel.class, DataVolumeModel.CONTAINER_MOUNT)
- .observe(model);
- dbc.bindValue(
- WidgetProperties.selection().observe(containerSelectionCombo),
- selectedContainerObservable);
- new ContentProposalAdapter(containerSelectionCombo,
- new ComboContentAdapter() {
- @Override
- public void insertControlContents(Control control,
- String text, int cursorPosition) {
- final Combo combo = (Combo) control;
- final Point selection = combo.getSelection();
- combo.setText(text);
- selection.x = text.length();
- selection.y = selection.x;
- combo.setSelection(selection);
- }
- }, getContainerNameContentProposalProvider(
- containerSelectionCombo),
- null, null);
+ .value(DataVolumeModel.class, DataVolumeModel.CONTAINER_MOUNT).observe(model);
+ dbc.bindValue(WidgetProperties.selection().observe(containerSelectionCombo), selectedContainerObservable);
+ new ContentProposalAdapter(containerSelectionCombo, new ComboContentAdapter() {
+ @Override
+ public void insertControlContents(Control control, String text, int cursorPosition) {
+ final Combo combo = (Combo) control;
+ final Point selection = combo.getSelection();
+ combo.setText(text);
+ selection.x = text.length();
+ selection.y = selection.x;
+ combo.setSelection(selection);
+ }
+ }, getContainerNameContentProposalProvider(containerSelectionCombo), null, null);
// error message
final Composite errorContainer = new Composite(container, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
- .span(COLUMNS, 1).grab(true, true).applyTo(errorContainer);
- GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2)
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(COLUMNS, 1).grab(true, true)
.applyTo(errorContainer);
+ GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(errorContainer);
final Label errorMessageIcon = new Label(errorContainer, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .hint(20, SWT.DEFAULT)
- .applyTo(errorMessageIcon);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).hint(20, SWT.DEFAULT).applyTo(errorMessageIcon);
final Label errorMessageLabel = new Label(errorContainer, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false)
- .applyTo(errorMessageLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(errorMessageLabel);
setupValidationSupport(errorMessageIcon, errorMessageLabel);
return container;
}
- private void setupValidationSupport(final Label errorMessageIcon,
- final Label errorMessageLabel) {
+ private void setupValidationSupport(final Label errorMessageIcon, final Label errorMessageLabel) {
for (@SuppressWarnings("unchecked")
- Iterator<Binding> iterator = dbc.getBindings().iterator(); iterator
- .hasNext();) {
+ Iterator<Binding> iterator = dbc.getBindings().iterator(); iterator.hasNext();) {
final Binding binding = iterator.next();
- binding.getModel().addChangeListener(onDataVolumeSettingsChanged(
- errorMessageIcon, errorMessageLabel));
+ binding.getModel().addChangeListener(onDataVolumeSettingsChanged(errorMessageIcon, errorMessageLabel));
}
}
@@ -301,7 +245,7 @@ public class ContainerDataVolumeDialog extends Dialog {
* selected, and set the enablement of the associated {@link Control} at the
* same time (ie: the {@link Control} are only enabled when the given
* {@link Button} is selected.
- *
+ *
* @param button
* the {@link Button} to bind
* @param mountType
@@ -311,11 +255,9 @@ public class ContainerDataVolumeDialog extends Dialog {
* selected/unselected.
* @return
*/
- private Binding bindButton(final Button button, final MountType mountType,
- final Control... controls) {
+ private Binding bindButton(final Button button, final MountType mountType, final Control... controls) {
return dbc.bindValue(WidgetProperties.selection().observe(button),
- BeanProperties.value(DataVolumeModel.class,
- DataVolumeModel.MOUNT_TYPE).observe(model),
+ BeanProperties.value(DataVolumeModel.class, DataVolumeModel.MOUNT_TYPE).observe(model),
new UpdateValueStrategy() {
@Override
public Object convert(Object value) {
@@ -327,8 +269,7 @@ public class ContainerDataVolumeDialog extends Dialog {
return null;
}
- private void setEnabled(final Control[] controls,
- final boolean enabled) {
+ private void setEnabled(final Control[] controls, final boolean enabled) {
for (Control control : controls) {
control.setEnabled(enabled);
}
@@ -346,8 +287,7 @@ public class ContainerDataVolumeDialog extends Dialog {
private SelectionListener onHostDirectoryPath() {
return SelectionListener.widgetSelectedAdapter(e -> {
- final DirectoryDialog directoryDialog = new DirectoryDialog(
- getShell());
+ final DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
final String selectedPath = directoryDialog.open();
if (selectedPath != null) {
model.setHostPathMount(selectedPath);
@@ -368,26 +308,23 @@ public class ContainerDataVolumeDialog extends Dialog {
/**
* Creates an {@link IContentProposalProvider} to propose
* {@link IDockerContainer} names based on the current text.
- *
+ *
* @param items
* @return
*/
- private IContentProposalProvider getContainerNameContentProposalProvider(
- final Combo containerSelectionCombo) {
+ private IContentProposalProvider getContainerNameContentProposalProvider(final Combo containerSelectionCombo) {
return (contents, position) -> {
final List<IContentProposal> proposals = new ArrayList<>();
for (String containerName : containerSelectionCombo.getItems()) {
if (containerName.contains(contents)) {
- proposals.add(new ContentProposal(containerName,
- containerName, containerName, position));
+ proposals.add(new ContentProposal(containerName, containerName, containerName, position));
}
}
return proposals.toArray(new IContentProposal[0]);
};
}
- private IChangeListener onDataVolumeSettingsChanged(
- final Label errorMessageIcon, final Label errorMessageLabel) {
+ private IChangeListener onDataVolumeSettingsChanged(final Label errorMessageIcon, final Label errorMessageLabel) {
return event -> {
// skip if dialog has been closed
@@ -402,17 +339,14 @@ public class ContainerDataVolumeDialog extends Dialog {
setOkButtonEnabled(true);
} else if (status.matches(IStatus.WARNING)) {
errorMessageIcon.setVisible(true);
- errorMessageIcon.setImage(
- SWTImagesFactory.DESC_WARNING.createImage());
+ errorMessageIcon.setImage(SWTImagesFactory.DESC_WARNING.createImage());
errorMessageLabel.setVisible(true);
errorMessageLabel.setText(status.getMessage());
setOkButtonEnabled(true);
} else if (status.matches(IStatus.ERROR)) {
- if (status.getMessage() != null
- && !status.getMessage().isEmpty()) {
+ if (status.getMessage() != null && !status.getMessage().isEmpty()) {
errorMessageIcon.setVisible(true);
- errorMessageIcon.setImage(
- SWTImagesFactory.DESC_ERROR.createImage());
+ errorMessageIcon.setImage(SWTImagesFactory.DESC_ERROR.createImage());
errorMessageLabel.setVisible(true);
errorMessageLabel.setText(status.getMessage());
}
@@ -430,28 +364,21 @@ public class ContainerDataVolumeDialog extends Dialog {
return ValidationStatus.error(null);
} else if (mountType == null) {
return ValidationStatus.error(null);
- } else if (mountType == MountType.HOST_FILE_SYSTEM
- && (hostPath == null || hostPath.isEmpty())) {
+ } else if (mountType == MountType.HOST_FILE_SYSTEM && (hostPath == null || hostPath.isEmpty())) {
return ValidationStatus.error(null);
- } else if (mountType == MountType.HOST_FILE_SYSTEM
- && !new File(hostPath).exists()) {
- return ValidationStatus
- .warning("The specified path does not exist on the host."); //$NON-NLS-1$
+ } else if (mountType == MountType.HOST_FILE_SYSTEM && !new File(hostPath).exists()) {
+ return ValidationStatus.warning("The specified path does not exist on the host."); //$NON-NLS-1$
} else if (mountType == MountType.CONTAINER) {
- final IDockerContainer container = WizardUtils
- .getContainer(connection, model.getContainerMount());
+ final IDockerContainer container = WizardUtils.getContainer(connection, model.getContainerMount());
if (container == null) {
// just make sure that the dialog cannot complete
return ValidationStatus.error(null);
}
final IDockerContainerInfo selectedContainerInfo = container.info();
- if (selectedContainerInfo != null
- && selectedContainerInfo.volumes() != null
- && !selectedContainerInfo.volumes()
- .containsKey(model.getContainerPath())) {
+ if (selectedContainerInfo != null && selectedContainerInfo.volumes() != null
+ && !selectedContainerInfo.volumes().containsKey(model.getContainerPath())) {
return ValidationStatus
- .warning(WizardMessages.getFormattedString(
- "ContainerDataVolumeDialog.volumeWarning", //$NON-NLS-1$
+ .warning(WizardMessages.getFormattedString("ContainerDataVolumeDialog.volumeWarning", //$NON-NLS-1$
model.getContainerPath()));
}
}
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 6c196229f9c..0aedb2981c8 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
@@ -65,13 +65,11 @@ import org.eclipse.linuxtools.docker.core.IDockerPortBinding;
import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher;
import org.eclipse.linuxtools.docker.ui.launch.IContainerLaunchListener;
-public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
- implements ILaunchConfigurationDelegate {
+public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate implements ILaunchConfigurationDelegate {
private ContainerLauncher launcher;
- private class StartGdbServerJob extends Job implements
- IContainerLaunchListener {
+ private class StartGdbServerJob extends Job implements IContainerLaunchListener {
private boolean started;
private boolean done;
@@ -104,8 +102,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
@Override
public void newOutput(String output) {
- if (output.contains(Messages.Gdbserver_up)
- || output.contains("gdbserver:")) { //$NON-NLS-1$
+ if (output.contains(Messages.Gdbserver_up) || output.contains("gdbserver:")) { //$NON-NLS-1$
started = true;
}
@@ -148,8 +145,8 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
@Override
- public void launch(ILaunchConfiguration configuration, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
IPath commandPath = getCommandPath(configuration);
if (commandPath != null) {
@@ -157,12 +154,10 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
// kept
HashMap<String, String> labels = new HashMap<>();
labels.put("org.eclipse.cdt.container-launch", ""); //$NON-NLS-1$ //$NON-NLS-2$
- String projectName = configuration.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
+ String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
labels.put("org.eclipse.cdt.project-name", projectName); //$NON-NLS-1$
if (mode.equals(ILaunchManager.RUN_MODE)) {
- String commandDir = commandPath.removeLastSegments(1)
- .toPortableString();
+ String commandDir = commandPath.removeLastSegments(1).toPortableString();
String commandString = commandPath.toPortableString();
if (commandPath.getDevice() != null) {
@@ -181,15 +176,12 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
String command = b.toString();
- String workingDir = configuration
- .getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- (String) null);
+ String workingDir = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ (String) null);
// if we don't have a working directory, the default is to use
// the project
if (workingDir == null && projectName != null) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
workingDir = project.getLocation().toOSString();
}
@@ -200,19 +192,14 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
.replace(':', '/');
}
}
- Map<String, String> envMap = configuration.getAttribute(
- ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
+ Map<String, String> envMap = configuration.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
(Map<String, String>) null);
Map<String, String> origEnv = null;
- boolean appendEnv = configuration
- .getAttribute(
- ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
- false);
+ boolean appendEnv = configuration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
if (appendEnv) {
origEnv = System.getenv();
}
- List<String> additionalDirs = configuration.getAttribute(
- ILaunchConstants.ATTR_ADDITIONAL_DIRS,
+ List<String> additionalDirs = configuration.getAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(List<String>) null);
if (additionalDirs != null) {
List<String> dirs = new ArrayList<>();
@@ -228,21 +215,17 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
List<String> ports = new ArrayList<>();
- List<String> portInfos = configuration.getAttribute(
- ILaunchConstants.ATTR_EXPOSED_PORTS,
+ List<String> portInfos = configuration.getAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS,
Collections.emptyList());
for (String portInfo : portInfos) {
- ExposedPortModel m = ExposedPortModel
- .createPortModel(portInfo);
+ ExposedPortModel m = ExposedPortModel.createPortModel(portInfo);
if (m.getSelected()) {
StringBuilder b1 = new StringBuilder();
- if (m.getHostAddress() != null
- && !m.getHostAddress().isEmpty()) {
+ if (m.getHostAddress() != null && !m.getHostAddress().isEmpty()) {
b1.append(m.getHostAddress());
b1.append(":"); //$NON-NLS-1$
}
- if (m.getHostPort() != null
- && !m.getHostPort().isEmpty()) {
+ if (m.getHostPort() != null && !m.getHostPort().isEmpty()) {
b1.append(m.getHostPort());
}
// regardless if we have a host port or not,
@@ -259,34 +242,24 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
}
- String image = configuration.getAttribute(
- ILaunchConstants.ATTR_IMAGE, (String) null);
- String connectionUri = configuration.getAttribute(
- ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
- boolean keepContainer = configuration.getAttribute(
- ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
-
- boolean supportStdin = configuration.getAttribute(
- ILaunchConstants.ATTR_STDIN_SUPPORT, false);
-
- boolean privilegedMode = configuration.getAttribute(
- ILaunchConstants.ATTR_PRIVILEGED_MODE, false);
-
- launcher.launch(DockerLaunchUIPlugin.PLUGIN_ID, null,
- connectionUri,
- image, command,
- commandDir, workingDir, additionalDirs, origEnv,
- envMap, ports.isEmpty() ? null : ports, keepContainer,
- supportStdin,
- privilegedMode, labels);
+ String image = configuration.getAttribute(ILaunchConstants.ATTR_IMAGE, (String) null);
+ String connectionUri = configuration.getAttribute(ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
+ boolean keepContainer = configuration.getAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
+
+ boolean supportStdin = configuration.getAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false);
+
+ boolean privilegedMode = configuration.getAttribute(ILaunchConstants.ATTR_PRIVILEGED_MODE, false);
+
+ launcher.launch(DockerLaunchUIPlugin.PLUGIN_ID, null, connectionUri, image, command, commandDir,
+ workingDir, additionalDirs, origEnv, envMap, ports.isEmpty() ? null : ports, keepContainer,
+ supportStdin, privilegedMode, labels);
} else if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- String gdbserverPortNumber = configuration.getAttribute(
- ILaunchConstants.ATTR_GDBSERVER_PORT,
+ String gdbserverPortNumber = configuration.getAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT,
ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
-
+
List<String> ports = new ArrayList<>();
- List<String> portInfos = configuration.getAttribute(
- ILaunchConstants.ATTR_EXPOSED_PORTS, Collections.emptyList());
+ List<String> portInfos = configuration.getAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS,
+ Collections.emptyList());
String gdbserverPort = gdbserverPortNumber + "/tcp"; //$NON-NLS-1$
boolean gdbserverPortSpecified = false;
for (String portInfo : portInfos) {
@@ -317,15 +290,13 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
// if user hasn't already specified gdbserver port, we need to add it by default
if (!gdbserverPortSpecified) {
- ports.add(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
+ ports.add(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
}
- String gdbserverCommand = configuration.getAttribute(
- ILaunchConstants.ATTR_GDBSERVER_COMMAND,
+ String gdbserverCommand = configuration.getAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND,
ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
String commandString = commandPath.toPortableString();
- String commandDir = commandPath.removeLastSegments(1)
- .toPortableString();
+ String commandDir = commandPath.removeLastSegments(1).toPortableString();
if (commandPath.getDevice() != null) {
commandDir = "/" + commandDir.replace(':', '/'); //$NON-NLS-1$
@@ -346,15 +317,12 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
String command = b.toString();
- String workingDir = configuration
- .getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- (String) null);
+ String workingDir = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ (String) null);
// if we don't have a working directory, the default is to use
// the project
if (workingDir == null && projectName != null) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
workingDir = project.getLocation().toOSString();
}
if (workingDir != null) {
@@ -365,19 +333,14 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
}
- Map<String, String> envMap = configuration.getAttribute(
- ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
+ Map<String, String> envMap = configuration.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
(Map<String, String>) null);
Map<String, String> origEnv = null;
- boolean appendEnv = configuration
- .getAttribute(
- ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
- false);
+ boolean appendEnv = configuration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
if (appendEnv) {
origEnv = System.getenv();
}
- List<String> additionalDirs = configuration.getAttribute(
- ILaunchConstants.ATTR_ADDITIONAL_DIRS,
+ List<String> additionalDirs = configuration.getAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(List<String>) null);
if (additionalDirs != null) {
List<String> dirs = new ArrayList<>();
@@ -392,26 +355,21 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
additionalDirs = dirs;
}
- String image = configuration.getAttribute(
- ILaunchConstants.ATTR_IMAGE, (String) null);
- String connectionUri = configuration.getAttribute(
- ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
+ String image = configuration.getAttribute(ILaunchConstants.ATTR_IMAGE, (String) null);
+ String connectionUri = configuration.getAttribute(ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
boolean isLocalConnection = true;
try {
- Pattern ipaddrPattern = Pattern.compile(
- "[a-z]*://([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)[:]*[0-9]*");
+ Pattern ipaddrPattern = Pattern.compile("[a-z]*://([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)[:]*[0-9]*");
Matcher m = ipaddrPattern.matcher(connectionUri);
if (m.matches()) {
String ipaddr = m.group(1);
InetAddress addr = InetAddress.getByName(ipaddr);
- if (addr.isAnyLocalAddress()
- || addr.isLoopbackAddress()) {
+ if (addr.isAnyLocalAddress() || addr.isLoopbackAddress()) {
isLocalConnection = true;
} else {
// Check if the address is defined on any interface
try {
- isLocalConnection = NetworkInterface
- .getByInetAddress(addr) != null;
+ isLocalConnection = NetworkInterface.getByInetAddress(addr) != null;
} catch (SocketException e) {
isLocalConnection = false;
}
@@ -422,24 +380,17 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
Activator.log(e);
}
- boolean keepContainer = configuration.getAttribute(
- ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
+ boolean keepContainer = configuration.getAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
- boolean supportStdin = configuration.getAttribute(
- ILaunchConstants.ATTR_STDIN_SUPPORT, false);
+ boolean supportStdin = configuration.getAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false);
- boolean privilegedMode = configuration.getAttribute(
- ILaunchConstants.ATTR_PRIVILEGED_MODE, false);
+ boolean privilegedMode = configuration.getAttribute(ILaunchConstants.ATTR_PRIVILEGED_MODE, false);
- StartGdbServerJob job = new StartGdbServerJob(
- Messages.Gdbserver_start);
+ StartGdbServerJob job = new StartGdbServerJob(Messages.Gdbserver_start);
job.schedule();
- launcher.launch(DockerLaunchUIPlugin.PLUGIN_ID, job,
- connectionUri,
- image, command,
- commandDir, workingDir, additionalDirs, origEnv,
- envMap, ports, keepContainer, supportStdin,
- privilegedMode, labels, "seccomp:unconfined"); //$NON-NLS-1$
+ launcher.launch(DockerLaunchUIPlugin.PLUGIN_ID, job, connectionUri, image, command, commandDir,
+ workingDir, additionalDirs, origEnv, envMap, ports, keepContainer, supportStdin, privilegedMode,
+ labels, "seccomp:unconfined"); //$NON-NLS-1$
// wait until gdbserver is started successfully and we have its
// ip address or
@@ -452,39 +403,25 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
// if gdbserver started successfully and we have its ip address,
// launch the debugger
- if (job.getResult() == Status.OK_STATUS
- && job.getIpAddress() != null) {
+ if (job.getResult() == Status.OK_STATUS && job.getIpAddress() != null) {
// Let debugger know how gdbserver was started on the remote
// container
- ILaunchConfigurationWorkingCopy wc = configuration
- .getWorkingCopy();
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
- true);
- wc.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
Map<String, List<IDockerPortBinding>> hostPorts = new HashMap<>();
if (job.getPorts() != null && isLocalConnection) {
hostPorts = job.getPorts();
}
- List<IDockerPortBinding> bindingList = hostPorts
- .get(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
+ List<IDockerPortBinding> bindingList = hostPorts.get(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
if (bindingList != null && !bindingList.isEmpty()) {
IDockerPortBinding firstBinding = bindingList.get(0);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_HOST,
- "localhost"); //$NON-NLS-1$
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_PORT,
- firstBinding.hostPort());
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, "localhost"); //$NON-NLS-1$
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, firstBinding.hostPort());
} else {
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_HOST,
- job.getIpAddress());
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_PORT,
- gdbserverPortNumber);
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, job.getIpAddress());
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, gdbserverPortNumber);
}
wc.doSave();
try {
@@ -504,43 +441,35 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
/**
* Get the program arguments and perform substitution.
- *
+ *
* @param config
* launch configuration
* @return argument String
* @throws CoreException
*/
- private String getProgramArguments(ILaunchConfiguration config)
- throws CoreException {
- String args = config.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- (String) "");
+ private String getProgramArguments(ILaunchConfiguration config) throws CoreException {
+ String args = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) "");
if (args != null && args.length() > 0) {
- args = VariablesPlugin.getDefault().getStringVariableManager()
- .performStringSubstitution(args);
+ args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args);
}
return args;
}
/**
* Form command path using the project and program name.
- *
+ *
* @param configuration
* @return command path
* @throws CoreException
*/
- private IPath getCommandPath(ILaunchConfiguration configuration)
- throws CoreException {
- String projectName = configuration.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+ private IPath getCommandPath(ILaunchConfiguration configuration) throws CoreException {
+ String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
if (projectName.length() > 0) {
- IProject project = CCorePlugin.getWorkspace().getRoot()
- .getProject(projectName);
+ IProject project = CCorePlugin.getWorkspace().getRoot().getProject(projectName);
if (project == null)
return null;
- String name = configuration.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
+ String name = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
if (name.length() == 0)
return null;
@@ -590,8 +519,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
}
- public static IProject getProject(ILaunchConfiguration configuration)
- throws CoreException {
+ public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
// TODO - make sure this is really the correct project
return configuration.getMappedResources()[0].getProject();
}
@@ -604,37 +532,28 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
/**
* @since 1.2
*/
- protected IToolChainManager toolChainManager = CDebugCorePlugin
- .getService(IToolChainManager.class);
+ protected IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
/*
* @since 1.2
*/
- protected ICBuildConfiguration getBuildConfiguration(
- ILaunchConfiguration configuration, String mode,
- ILaunchTarget target, IProgressMonitor monitor)
- throws CoreException {
+ protected ICBuildConfiguration getBuildConfiguration(ILaunchConfiguration configuration, String mode,
+ ILaunchTarget target, IProgressMonitor monitor) throws CoreException {
IProject project = getProject(configuration);
- String toolchainId = configuration
- .getAttribute(ICBuildConfiguration.TOOLCHAIN_ID, (String) null);
+ String toolchainId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_ID, (String) null);
if (toolchainId != null) {
- String providerId = configuration
- .getAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
- IToolChain toolchain = toolChainManager.getToolChain(providerId,
- toolchainId);
+ String providerId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
+ IToolChain toolchain = toolChainManager.getToolChain(providerId, toolchainId);
if (toolchain != null) {
- return configManager.getBuildConfiguration(project, toolchain,
- mode, monitor);
+ return configManager.getBuildConfiguration(project, toolchain, mode, monitor);
}
}
// Pick the first one that matches
Map<String, String> properties = new HashMap<>();
properties.putAll(target.getAttributes());
- for (IToolChain toolChain : toolChainManager
- .getToolChainsMatching(properties)) {
- ICBuildConfiguration buildConfig = configManager
- .getBuildConfiguration(project, toolChain, mode, monitor);
+ for (IToolChain toolChain : toolChainManager.getToolChainsMatching(properties)) {
+ ICBuildConfiguration buildConfig = configManager.getBuildConfiguration(project, toolChain, mode, monitor);
if (buildConfig != null) {
return buildConfig;
}
@@ -644,32 +563,27 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
@Override
- public boolean buildForLaunch(ILaunchConfiguration configuration,
- String mode, IProgressMonitor monitor) throws CoreException {
+ public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
+ throws CoreException {
IProject project = getProject(configuration);
String name = configuration.getName();
Pattern p = Pattern.compile(".*?\\[([^\\]]+)\\](.*)"); //$NON-NLS-1$
Matcher m = p.matcher(name);
if (m.matches()) {
- ILaunchTargetManager targetManager = CCorePlugin
- .getService(ILaunchTargetManager.class);
+ ILaunchTargetManager targetManager = CCorePlugin.getService(ILaunchTargetManager.class);
ILaunchTarget target = null;
- ILaunchTarget[] targets = targetManager.getLaunchTargetsOfType(
- ContainerTargetTypeProvider.TYPE_ID);
+ ILaunchTarget[] targets = targetManager.getLaunchTargetsOfType(ContainerTargetTypeProvider.TYPE_ID);
for (ILaunchTarget t : targets) {
- if (t.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, "")
- .replaceAll(":", "_").equals(m.group(1))) {
+ if (t.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, "").replaceAll(":", "_").equals(m.group(1))) {
target = t;
break;
}
}
if (target != null) {
- ICBuildConfiguration cconfig = getBuildConfiguration(
- configuration, mode, target, monitor);
+ ICBuildConfiguration cconfig = getBuildConfiguration(configuration, mode, target, monitor);
if (cconfig != null) {
IProjectDescription desc = project.getDescription();
- desc.setActiveBuildConfig(
- cconfig.getBuildConfiguration().getName());
+ desc.setActiveBuildConfig(cconfig.getBuildConfiguration().getName());
project.setDescription(desc, monitor);
}
}
@@ -679,50 +593,34 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
@Override
- public boolean finalLaunchCheck(ILaunchConfiguration configuration,
- String mode, IProgressMonitor monitor) throws CoreException {
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
+ throws CoreException {
IProject project = getProject(configuration);
- ILaunchTargetManager targetManager = CCorePlugin
- .getService(ILaunchTargetManager.class);
+ ILaunchTargetManager targetManager = CCorePlugin.getService(ILaunchTargetManager.class);
ILaunchTarget target = null;
- ILaunchTarget[] targets = targetManager
- .getLaunchTargetsOfType(ContainerTargetTypeProvider.TYPE_ID);
- String image = configuration.getAttribute(
- IContainerLaunchTarget.ATTR_IMAGE_ID, (String) null);
- String connection = configuration.getAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI, (String) null);
+ ILaunchTarget[] targets = targetManager.getLaunchTargetsOfType(ContainerTargetTypeProvider.TYPE_ID);
+ String image = configuration.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, (String) null);
+ String connection = configuration.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, (String) null);
for (ILaunchTarget t : targets) {
- if (t.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, "")
- .equals(image)) {
+ if (t.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, "").equals(image)) {
target = t;
break;
}
}
- String program = configuration.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- (String) null);
+ String program = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
if (program == null) {
- ICBuildConfiguration cconfig = getBuildConfiguration(configuration,
- mode, target, monitor);
+ ICBuildConfiguration cconfig = getBuildConfiguration(configuration, mode, target, monitor);
if (cconfig != null) {
IBinary[] binaries = cconfig.getBuildOutput();
for (IBinary b : binaries) {
- if (b.isExecutable()
- && b.getElementName().contains(project.getName())) {
- ILaunchConfigurationWorkingCopy wc = configuration
- .getWorkingCopy();
- wc.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- b.getResource().getProjectRelativePath()
- .toString());
- wc.setMappedResources(new IResource[] { b.getResource(),
- b.getResource().getProject() });
- wc.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- (String) null); // default is the project
- // directory
- wc.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI,
- connection);
+ if (b.isExecutable() && b.getElementName().contains(project.getName())) {
+ ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
+ b.getResource().getProjectRelativePath().toString());
+ wc.setMappedResources(new IResource[] { b.getResource(), b.getResource().getProject() });
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null); // default is the project
+ // directory
+ wc.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, connection);
wc.setAttribute(ILaunchConstants.ATTR_IMAGE, image);
wc.doSave();
@@ -735,27 +633,22 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
@Override
- public boolean preLaunchCheck(ILaunchConfiguration config, String mode,
- IProgressMonitor monitor) throws CoreException {
- String projectName = config.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- (String) null);
+ public boolean preLaunchCheck(ILaunchConfiguration config, String mode, IProgressMonitor monitor)
+ throws CoreException {
+ String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
IProject project = null;
if (projectName == null) {
IResource[] resources = config.getMappedResources();
- if (resources != null && resources.length > 0
- && resources[0] instanceof IProject) {
+ if (resources != null && resources.length > 0 && resources[0] instanceof IProject) {
project = (IProject) resources[0];
}
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- project.getName());
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
wc.doSave();
} else {
projectName = projectName.trim();
if (!projectName.isEmpty()) {
- project = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationTabGroup.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationTabGroup.java
index 556afbbc293..87910037f32 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationTabGroup.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationTabGroup.java
@@ -26,8 +26,7 @@ import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
-public class ContainerLaunchConfigurationTabGroup extends
- AbstractLaunchConfigurationTabGroup {
+public class ContainerLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPortDialog.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPortDialog.java
index 8e17eb3c8d6..80e19808d68 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPortDialog.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPortDialog.java
@@ -49,13 +49,10 @@ public class ContainerPortDialog extends Dialog {
this.model = new ContainerPortDialogModel();
}
- public ContainerPortDialog(final Shell parentShell,
- final ExposedPortModel selectedContainerPort) {
+ public ContainerPortDialog(final Shell parentShell, final ExposedPortModel selectedContainerPort) {
super(parentShell);
- this.model = new ContainerPortDialogModel(
- selectedContainerPort.getContainerPort(),
- selectedContainerPort.getHostAddress(),
- selectedContainerPort.getHostPort());
+ this.model = new ContainerPortDialogModel(selectedContainerPort.getContainerPort(),
+ selectedContainerPort.getHostAddress(), selectedContainerPort.getHostPort());
}
@Override
@@ -69,10 +66,8 @@ public class ContainerPortDialog extends Dialog {
* Disable the 'OK' button by default
*/
@Override
- protected Button createButton(Composite parent, int id, String label,
- boolean defaultButton) {
- final Button button = super.createButton(parent, id, label,
- defaultButton);
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ final Button button = super.createButton(parent, id, label, defaultButton);
if (id == IDialogConstants.OK_ID) {
button.setEnabled(false);
}
@@ -89,70 +84,47 @@ public class ContainerPortDialog extends Dialog {
protected Control createDialogArea(Composite parent) {
final int COLUMNS = 2;
final Composite container = new Composite(parent, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
- .span(COLUMNS, 1).grab(true, true).applyTo(container);
- GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(10, 10)
- .applyTo(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(COLUMNS, 1).grab(true, true).applyTo(container);
+ GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(10, 10).applyTo(container);
final Label explanationLabel = new Label(container, SWT.NONE);
explanationLabel.setText(Messages.ContainerPortDialog_explanationLabel);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .span(COLUMNS, 1).grab(false, false).applyTo(explanationLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).grab(false, false)
+ .applyTo(explanationLabel);
final Label containerLabel = new Label(container, SWT.NONE);
containerLabel.setText(Messages.ContainerPortDialog_containerLabel);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(containerLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(containerLabel);
final Text containerPortText = new Text(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).applyTo(containerPortText);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(containerPortText);
final Label hostAddressLabel = new Label(container, SWT.NONE);
hostAddressLabel.setText(Messages.ContainerPortDialog_hostAddressLabel);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(hostAddressLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(hostAddressLabel);
final Text hostAddressText = new Text(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).applyTo(hostAddressText);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(hostAddressText);
final Label hostPortLabel = new Label(container, SWT.NONE);
- hostPortLabel.setText(
- Messages.ContainerPortDialog_hostPortLabel);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(false, false).applyTo(hostPortLabel);
+ hostPortLabel.setText(Messages.ContainerPortDialog_hostPortLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(hostPortLabel);
final Text hostPortText = new Text(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).applyTo(hostPortText);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(hostPortText);
// error message
final Label errorMessageLabel = new Label(container, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .span(COLUMNS, 1).grab(true, false).applyTo(errorMessageLabel);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).grab(true, false)
+ .applyTo(errorMessageLabel);
// listening to changes
- final ISWTObservableValue containerPortObservable = WidgetProperties
- .text(SWT.Modify).observe(containerPortText);
- dbc.bindValue(containerPortObservable,
- BeanProperties
- .value(ContainerPortDialogModel.class,
- ContainerPortDialogModel.CONTAINER_PORT)
- .observe(model));
- final ISWTObservableValue hostAddressObservable = WidgetProperties
- .text(SWT.Modify).observe(hostAddressText);
- dbc.bindValue(hostAddressObservable,
- BeanProperties
- .value(ContainerPortDialogModel.class,
- ContainerPortDialogModel.HOST_ADDRESS)
- .observe(model));
- final ISWTObservableValue hostPortObservable = WidgetProperties
- .text(SWT.Modify).observe(hostPortText);
- dbc.bindValue(hostPortObservable,
- BeanProperties
- .value(ContainerPortDialogModel.class,
- ContainerPortDialogModel.HOST_PORT)
- .observe(model));
-
- containerPortObservable.addValueChangeListener(
- onContainerPortSettingsChanged());
- hostPortObservable.addValueChangeListener(
- onContainerPortSettingsChanged());
- hostAddressObservable.addValueChangeListener(
- onContainerPortSettingsChanged());
+ final ISWTObservableValue containerPortObservable = WidgetProperties.text(SWT.Modify)
+ .observe(containerPortText);
+ dbc.bindValue(containerPortObservable, BeanProperties
+ .value(ContainerPortDialogModel.class, ContainerPortDialogModel.CONTAINER_PORT).observe(model));
+ final ISWTObservableValue hostAddressObservable = WidgetProperties.text(SWT.Modify).observe(hostAddressText);
+ dbc.bindValue(hostAddressObservable, BeanProperties
+ .value(ContainerPortDialogModel.class, ContainerPortDialogModel.HOST_ADDRESS).observe(model));
+ final ISWTObservableValue hostPortObservable = WidgetProperties.text(SWT.Modify).observe(hostPortText);
+ dbc.bindValue(hostPortObservable, BeanProperties
+ .value(ContainerPortDialogModel.class, ContainerPortDialogModel.HOST_PORT).observe(model));
+
+ containerPortObservable.addValueChangeListener(onContainerPortSettingsChanged());
+ hostPortObservable.addValueChangeListener(onContainerPortSettingsChanged());
+ hostAddressObservable.addValueChangeListener(onContainerPortSettingsChanged());
return container;
}
@@ -174,8 +146,7 @@ public class ContainerPortDialog extends Dialog {
}
public ExposedPortModel getPort() {
- return new ExposedPortModel(model.getContainerPort(), PORT_TYPE,
- model.getHostAddress(), model.getHostPort());
+ return new ExposedPortModel(model.getContainerPort(), PORT_TYPE, model.getHostAddress(), model.getHostPort());
}
class ContainerPortDialogModel extends BaseDatabindingModel {
@@ -195,8 +166,7 @@ public class ContainerPortDialog extends Dialog {
public ContainerPortDialogModel() {
}
- public ContainerPortDialogModel(final String containerPort,
- final String hostAddress, final String hostPort) {
+ public ContainerPortDialogModel(final String containerPort, final String hostAddress, final String hostPort) {
this.containerPort = containerPort;
this.hostAddress = hostAddress;
this.hostPort = hostPort;
@@ -207,8 +177,7 @@ public class ContainerPortDialog extends Dialog {
}
public void setContainerPort(final String containerPort) {
- firePropertyChange(CONTAINER_PORT, this.containerPort,
- this.containerPort = containerPort);
+ firePropertyChange(CONTAINER_PORT, this.containerPort, this.containerPort = containerPort);
}
public String getHostAddress() {
@@ -216,8 +185,7 @@ public class ContainerPortDialog extends Dialog {
}
public void setHostAddress(final String hostName) {
- firePropertyChange(HOST_ADDRESS, this.hostAddress,
- this.hostAddress = hostName);
+ firePropertyChange(HOST_ADDRESS, this.hostAddress, this.hostAddress = hostName);
}
public String getHostPort() {
@@ -225,8 +193,7 @@ public class ContainerPortDialog extends Dialog {
}
public void setHostPort(final String hostPort) {
- firePropertyChange(HOST_PORT, this.hostPort,
- this.hostPort = hostPort);
+ firePropertyChange(HOST_PORT, this.hostPort, this.hostPort = hostPort);
}
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java
index ff204c550dd..e1099aaeec8 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java
@@ -156,8 +156,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
public ContainerPropertyTab() {
this.containerTab = this;
- this.model = new ContainerPropertyVolumesModel(
- (IDockerConnection) null);
+ this.model = new ContainerPropertyVolumesModel((IDockerConnection) null);
}
@Override
@@ -182,8 +181,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
enableButton.setLayoutData(gd);
Label connectionSelectorLabel = new Label(usercomp, SWT.NULL);
- connectionSelectorLabel
- .setText(Messages.ContainerTab_Connection_Selector_Label);
+ connectionSelectorLabel.setText(Messages.ContainerTab_Connection_Selector_Label);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
gd.grabExcessHorizontalSpace = false;
@@ -236,8 +234,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
@Override
public void widgetSelected(SelectionEvent e) {
setImageId(imageCombo.getText());
- model.setSelectedImage(
- displayedImages.get(imageCombo.getSelectionIndex()));
+ model.setSelectedImage(displayedImages.get(imageCombo.getSelectionIndex()));
}
@Override
@@ -250,34 +247,28 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
try {
IProject project = iCfgd.getProjectDescription().getProject();
- IProjectNature nature = project.getNature(
- "org.eclipse.cdt.autotools.core.autotoolsNatureV2"); //$NON-NLS-1$
+ IProjectNature nature = project.getNature("org.eclipse.cdt.autotools.core.autotoolsNatureV2"); //$NON-NLS-1$
isAutotoolsProject = (nature != null);
if (isAutotoolsProject) {
launchAutotoolsButton = new Button(usercomp, SWT.CHECK);
- launchAutotoolsButton.setText(
- Messages.ContainerPropertyTab_Run_Autotools_In_Container_Msg);
- launchAutotoolsButton.setToolTipText(
- Messages.ContainerPropertyTab_Run_Autotools_In_Container_Tooltip);
+ launchAutotoolsButton.setText(Messages.ContainerPropertyTab_Run_Autotools_In_Container_Msg);
+ launchAutotoolsButton.setToolTipText(Messages.ContainerPropertyTab_Run_Autotools_In_Container_Tooltip);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 5;
launchAutotoolsButton.setLayoutData(gd);
initializeLaunchAutotoolsButton();
- launchAutotoolsButton
- .addSelectionListener(new SelectionListener() {
+ launchAutotoolsButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setLaunchAutotoolsEnablement(
- launchAutotoolsButton.getSelection());
- }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setLaunchAutotoolsEnablement(launchAutotoolsButton.getSelection());
+ }
- @Override
- public void widgetDefaultSelected(
- SelectionEvent e) {
- // ignore
- }
- });
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // ignore
+ }
+ });
}
} catch (CoreException e) {
DockerLaunchUIPlugin.log(e);
@@ -303,60 +294,40 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private void createVolumeSettingsContainer(final Composite container) {
final Label volumesLabel = new Label(container, SWT.NONE);
- volumesLabel.setText(WizardMessages
- .getString("ImageRunResourceVolVarPage.dataVolumesLabel")); //$NON-NLS-1$
+ volumesLabel.setText(WizardMessages.getString("ImageRunResourceVolVarPage.dataVolumesLabel")); //$NON-NLS-1$
GridDataFactory.fillDefaults().grab(false, false).applyTo(volumesLabel);
- final CheckboxTableViewer dataVolumesTableViewer = createVolumesTable(
- container);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).hint(400, 200)
+ final CheckboxTableViewer dataVolumesTableViewer = createVolumesTable(container);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).hint(400, 200)
.applyTo(dataVolumesTableViewer.getTable());
// buttons
final Composite buttonsContainers = new Composite(container, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(false, false).applyTo(buttonsContainers);
- GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0)
- .spacing(SWT.DEFAULT, 0).applyTo(buttonsContainers);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(false, false).applyTo(buttonsContainers);
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(SWT.DEFAULT, 0).applyTo(buttonsContainers);
addButton = new Button(buttonsContainers, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).applyTo(addButton);
- addButton.setText(WizardMessages
- .getString("ImageRunResourceVolVarPage.addButton")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(addButton);
+ addButton.setText(WizardMessages.getString("ImageRunResourceVolVarPage.addButton")); //$NON-NLS-1$
addButton.addSelectionListener(onAddDataVolume(dataVolumesTableViewer));
if (imageCombo.getText() != null && !imageCombo.getText().equals("")) {
setVolumeControlsEnabled(new Button[] { addButton }, true);
}
final Button editButton = new Button(buttonsContainers, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).applyTo(editButton);
- editButton.setText(WizardMessages
- .getString("ImageRunResourceVolVarPage.editButton")); //$NON-NLS-1$
- editButton
- .addSelectionListener(onEditDataVolume(dataVolumesTableViewer));
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(editButton);
+ editButton.setText(WizardMessages.getString("ImageRunResourceVolVarPage.editButton")); //$NON-NLS-1$
+ editButton.addSelectionListener(onEditDataVolume(dataVolumesTableViewer));
editButton.setEnabled(false);
final Button removeButton = new Button(buttonsContainers, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).applyTo(removeButton);
- removeButton.setText(WizardMessages
- .getString("ImageRunResourceVolVarPage.removeButton")); //$NON-NLS-1$
- removeButton.addSelectionListener(
- onRemoveDataVolumes(dataVolumesTableViewer));
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(removeButton);
+ removeButton.setText(WizardMessages.getString("ImageRunResourceVolVarPage.removeButton")); //$NON-NLS-1$
+ removeButton.addSelectionListener(onRemoveDataVolumes(dataVolumesTableViewer));
removeButton.setEnabled(false);
// update table content when selected image changes
- bind(dataVolumesTableViewer, model.getDataVolumes(),
- BeanProperties.values(DataVolumeModel.class,
- DataVolumeModel.CONTAINER_PATH, DataVolumeModel.MOUNT,
- DataVolumeModel.READ_ONLY_VOLUME));
- dbc.bindSet(
- ViewersObservables.observeCheckedElements(
- dataVolumesTableViewer, DataVolumeModel.class),
- BeanProperties.set(
- ContainerPropertyVolumesModel.SELECTED_DATA_VOLUMES)
- .observe(model));
+ bind(dataVolumesTableViewer, model.getDataVolumes(), BeanProperties.values(DataVolumeModel.class,
+ DataVolumeModel.CONTAINER_PATH, DataVolumeModel.MOUNT, DataVolumeModel.READ_ONLY_VOLUME));
+ dbc.bindSet(ViewersObservables.observeCheckedElements(dataVolumesTableViewer, DataVolumeModel.class),
+ BeanProperties.set(ContainerPropertyVolumesModel.SELECTED_DATA_VOLUMES).observe(model));
// disable the edit and removeButton if the table is empty
- dataVolumesTableViewer.addSelectionChangedListener(
- onSelectionChanged(editButton, removeButton));
+ dataVolumesTableViewer.addSelectionChangedListener(onSelectionChanged(editButton, removeButton));
initializeVolumesTable();
}
@@ -370,25 +341,22 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
* @param input
* @param labelProperties
*/
- private void bind(final StructuredViewer viewer,
- final IObservableList input,
+ private void bind(final StructuredViewer viewer, final IObservableList input,
final IBeanValueProperty[] labelProperties) {
final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
if (viewer.getInput() != null) {
viewer.setInput(null);
}
viewer.setContentProvider(contentProvider);
- viewer.setLabelProvider(
- new DataVolumesLabelProvider(Properties.observeEach(
- contentProvider.getKnownElements(), labelProperties)));
+ viewer.setLabelProvider(new DataVolumesLabelProvider(
+ Properties.observeEach(contentProvider.getKnownElements(), labelProperties)));
if (input != null) {
viewer.setInput(input);
}
}
- private ISelectionChangedListener onSelectionChanged(
- final Button... targetButtons) {
+ private ISelectionChangedListener onSelectionChanged(final Button... targetButtons) {
return e -> {
if (e.getSelection().isEmpty()) {
setVolumeControlsEnabled(targetButtons, false);
@@ -398,8 +366,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
};
}
- private static void setVolumeControlsEnabled(final Control[] controls,
- final boolean enabled) {
+ private static void setVolumeControlsEnabled(final Control[] controls, final boolean enabled) {
for (Control control : controls) {
if (control != null) {
control.setEnabled(enabled);
@@ -407,12 +374,10 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
}
- private SelectionListener onAddDataVolume(
- final CheckboxTableViewer dataVolumesTableViewer) {
+ private SelectionListener onAddDataVolume(final CheckboxTableViewer dataVolumesTableViewer) {
return SelectionListener.widgetSelectedAdapter(e -> {
final ContainerDataVolumeDialog dialog = new ContainerDataVolumeDialog(
- Display.getDefault().getActiveShell(),
- model.getConnection());
+ Display.getDefault().getActiveShell(), model.getConnection());
dialog.create();
if (dialog.open() == IDialogConstants.OK_ID) {
final DataVolumeModel dataVolume = dialog.getDataVolume();
@@ -425,30 +390,22 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
});
}
- private SelectionListener onEditDataVolume(
- final CheckboxTableViewer dataVolumesTableViewer) {
+ private SelectionListener onEditDataVolume(final CheckboxTableViewer dataVolumesTableViewer) {
return SelectionListener.widgetSelectedAdapter(e -> {
- final IStructuredSelection selection = (IStructuredSelection) dataVolumesTableViewer
- .getSelection();
+ final IStructuredSelection selection = (IStructuredSelection) dataVolumesTableViewer.getSelection();
if (selection.isEmpty()) {
return;
}
- final DataVolumeModel selectedDataVolume = (DataVolumeModel) selection
- .getFirstElement();
+ final DataVolumeModel selectedDataVolume = (DataVolumeModel) selection.getFirstElement();
final ContainerDataVolumeDialog dialog = new ContainerDataVolumeDialog(
- Display.getDefault().getActiveShell(),
- model.getConnection(), selectedDataVolume);
+ Display.getDefault().getActiveShell(), model.getConnection(), selectedDataVolume);
dialog.create();
if (dialog.open() == IDialogConstants.OK_ID) {
final DataVolumeModel dialogDataVolume = dialog.getDataVolume();
- selectedDataVolume.setContainerMount(
- dialogDataVolume.getContainerMount());
- selectedDataVolume
- .setMountType(dialogDataVolume.getMountType());
- selectedDataVolume
- .setHostPathMount(dialogDataVolume.getHostPathMount());
- selectedDataVolume.setContainerMount(
- dialogDataVolume.getContainerMount());
+ selectedDataVolume.setContainerMount(dialogDataVolume.getContainerMount());
+ selectedDataVolume.setMountType(dialogDataVolume.getMountType());
+ selectedDataVolume.setHostPathMount(dialogDataVolume.getHostPathMount());
+ selectedDataVolume.setContainerMount(dialogDataVolume.getContainerMount());
selectedDataVolume.setReadOnly(dialogDataVolume.isReadOnly());
model.getSelectedDataVolumes().add(selectedDataVolume);
dataVolumesTableViewer.setChecked(selectedDataVolume, true);
@@ -457,14 +414,11 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
});
}
- private SelectionListener onRemoveDataVolumes(
- final TableViewer dataVolumesTableViewer) {
+ private SelectionListener onRemoveDataVolumes(final TableViewer dataVolumesTableViewer) {
return SelectionListener.widgetSelectedAdapter(e -> {
- final IStructuredSelection selection = dataVolumesTableViewer
- .getStructuredSelection();
+ final IStructuredSelection selection = dataVolumesTableViewer.getStructuredSelection();
for (@SuppressWarnings("unchecked")
- Iterator<DataVolumeModel> iterator = selection.iterator(); iterator
- .hasNext();) {
+ Iterator<DataVolumeModel> iterator = selection.iterator(); iterator.hasNext();) {
final DataVolumeModel volume = iterator.next();
model.removeDataVolume(volume);
model.getSelectedDataVolumes().remove(volume);
@@ -474,37 +428,24 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
private CheckboxTableViewer createVolumesTable(final Composite container) {
- final Table table = new Table(container, SWT.CHECK | SWT.BORDER
- | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
+ final Table table = new Table(container,
+ SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
- dbc.bindSet(
- ViewersObservables.observeCheckedElements(tableViewer,
- DataVolumeModel.class),
- BeanProperties.set(
- ContainerPropertyVolumesModel.SELECTED_DATA_VOLUMES)
- .observe(model));
- addTableViewerColumn(tableViewer,
- WizardMessages.getString(
- "ImageRunResourceVolVarPage.containerPathColumn"), //$NON-NLS-1$
+ dbc.bindSet(ViewersObservables.observeCheckedElements(tableViewer, DataVolumeModel.class),
+ BeanProperties.set(ContainerPropertyVolumesModel.SELECTED_DATA_VOLUMES).observe(model));
+ addTableViewerColumn(tableViewer, WizardMessages.getString("ImageRunResourceVolVarPage.containerPathColumn"), //$NON-NLS-1$
180);
- addTableViewerColumn(tableViewer,
- WizardMessages
- .getString("ImageRunResourceVolVarPage.mountColumn"), //$NON-NLS-1$
+ addTableViewerColumn(tableViewer, WizardMessages.getString("ImageRunResourceVolVarPage.mountColumn"), //$NON-NLS-1$
180);
- addTableViewerColumn(tableViewer,
- WizardMessages
- .getString("ImageRunResourceVolVarPage.readonlyColumn"), //$NON-NLS-1$
+ addTableViewerColumn(tableViewer, WizardMessages.getString("ImageRunResourceVolVarPage.readonlyColumn"), //$NON-NLS-1$
60);
return tableViewer;
}
- private TableViewerColumn addTableViewerColumn(
- final TableViewer tableViewer,
- final String title, final int width) {
- final TableViewerColumn viewerColumn = new TableViewerColumn(
- tableViewer, SWT.NONE);
+ private TableViewerColumn addTableViewerColumn(final TableViewer tableViewer, final String title, final int width) {
+ final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
if (title != null) {
column.setText(title);
@@ -513,13 +454,10 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
return viewerColumn;
}
- private static final class DataVolumesLabelProvider
- extends ObservableMapLabelProvider {
+ private static final class DataVolumesLabelProvider extends ObservableMapLabelProvider {
- private Image CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER
- .createImage();
- private Image FOLDER_CLOSED_IMAGE = SWTImagesFactory.DESC_FOLDER_CLOSED
- .createImage();
+ private Image CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER.createImage();
+ private Image FOLDER_CLOSED_IMAGE = SWTImagesFactory.DESC_FOLDER_CLOSED.createImage();
private Image FILE_IMAGE = SWTImagesFactory.DESC_FILE.createImage();
public DataVolumesLabelProvider(final IObservableMap[] attributeMaps) {
@@ -567,11 +505,9 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
if (dataVolume.getMountType() != MountType.HOST_FILE_SYSTEM) {
return null;
} else if (dataVolume.isReadOnly()) {
- return WizardMessages
- .getString("ImageRunResourceVolVarPage.true"); //$NON-NLS-1$
+ return WizardMessages.getString("ImageRunResourceVolVarPage.true"); //$NON-NLS-1$
}
- return WizardMessages
- .getString("ImageRunResourceVolVarPage.false"); //$NON-NLS-1$
+ return WizardMessages.getString("ImageRunResourceVolVarPage.false"); //$NON-NLS-1$
default:
return null;
}
@@ -594,29 +530,23 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
separator = VOLUME_SEPARATOR;
}
if (iCfg instanceof IMultiConfiguration) {
- IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
- .getItems();
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg).getItems();
for (int i = 0; i < cfs.length; i++) {
IConfiguration cfg = cfs[i];
IOptionalBuildProperties p = cfg.getOptionalBuildProperties();
- p.setProperty(ContainerCommandLauncher.VOLUMES_ID,
- buffer.toString());
- p.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID,
- selectedBuffer.toString());
+ p.setProperty(ContainerCommandLauncher.VOLUMES_ID, buffer.toString());
+ p.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID, selectedBuffer.toString());
}
} else {
IOptionalBuildProperties p = iCfg.getOptionalBuildProperties();
- p.setProperty(ContainerCommandLauncher.VOLUMES_ID,
- buffer.toString());
- p.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID,
- selectedBuffer.toString());
+ p.setProperty(ContainerCommandLauncher.VOLUMES_ID, buffer.toString());
+ p.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID, selectedBuffer.toString());
}
}
private void setEnablement(boolean enabled) {
if (iCfg instanceof IMultiConfiguration) {
- IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
- .getItems();
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg).getItems();
for (int i = 0; i < cfs.length; i++) {
IConfiguration cfg = cfs[i];
IOptionalBuildProperties p = cfg.getOptionalBuildProperties();
@@ -630,8 +560,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
// if enabled, make sure we have ELF binary parsers specified
if (enabled) {
- String[] ids = CoreModelUtil
- .getBinaryParserIds(page.getCfgsEditable());
+ String[] ids = CoreModelUtil.getBinaryParserIds(page.getCfgsEditable());
List<String> idList = new ArrayList<>(Arrays.asList(ids));
if (!idList.contains(GNU_ELF_PARSER_ID)) {
idList.add(GNU_ELF_PARSER_ID);
@@ -639,32 +568,27 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
if (!idList.contains(ELF_PARSER_ID)) {
idList.add(ELF_PARSER_ID);
}
- CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(),
- idList.toArray(new String[0]));
+ CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), idList.toArray(new String[0]));
}
}
private void setLaunchAutotoolsEnablement(boolean enabled) {
if (iCfg instanceof IMultiConfiguration) {
- IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
- .getItems();
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg).getItems();
for (int i = 0; i < cfs.length; i++) {
IConfiguration cfg = cfs[i];
IOptionalBuildProperties p = cfg.getOptionalBuildProperties();
- p.setProperty(RUN_IN_CONFIGURE_LAUNCHER,
- Boolean.toString(launchAutotoolsButton.getSelection()));
+ p.setProperty(RUN_IN_CONFIGURE_LAUNCHER, Boolean.toString(launchAutotoolsButton.getSelection()));
}
} else {
IOptionalBuildProperties p = iCfg.getOptionalBuildProperties();
- p.setProperty(RUN_IN_CONFIGURE_LAUNCHER,
- Boolean.toString(launchAutotoolsButton.getSelection()));
+ p.setProperty(RUN_IN_CONFIGURE_LAUNCHER, Boolean.toString(launchAutotoolsButton.getSelection()));
}
}
private void setImageId(String imageId) {
if (iCfg instanceof IMultiConfiguration) {
- IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
- .getItems();
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg).getItems();
for (int i = 0; i < cfs.length; i++) {
IConfiguration cfg = cfs[i];
IOptionalBuildProperties p = cfg.getOptionalBuildProperties();
@@ -678,8 +602,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private void setConnection(String uri) {
if (iCfg instanceof IMultiConfiguration) {
- IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
- .getItems();
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg).getItems();
for (int i = 0; i < cfs.length; i++) {
IConfiguration cfg = cfs[i];
IOptionalBuildProperties p = cfg.getOptionalBuildProperties();
@@ -703,11 +626,9 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private void initializeEnablementButton() {
initialEnabled = false;
IOptionalBuildProperties properties = iCfg.getOptionalBuildProperties();
- String savedEnabled = properties
- .getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String savedEnabled = properties.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (savedEnabled != null) {
- initialEnabled = Boolean
- .parseBoolean(savedEnabled);
+ initialEnabled = Boolean.parseBoolean(savedEnabled);
}
enableButton.setSelection(initialEnabled);
setControlsEnabled(initialEnabled);
@@ -727,8 +648,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
int defaultIndex = -1;
initialConnection = null;
IOptionalBuildProperties properties = iCfg.getOptionalBuildProperties();
- String id = properties
- .getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ String id = properties.getProperty(ContainerCommandLauncher.CONNECTION_ID);
if (id != null) {
initialConnection = id;
}
@@ -807,19 +727,15 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private void initializeVolumesTable() {
model.clearDataVolumes();
int imageSelectionIndex = imageCombo.getSelectionIndex();
- if (imageSelectionIndex >= 0
- && imageSelectionIndex < displayedImages.size()) {
+ if (imageSelectionIndex >= 0 && imageSelectionIndex < displayedImages.size()) {
model.setSelectedImage(displayedImages.get(imageSelectionIndex));
}
IOptionalBuildProperties properties = iCfg.getOptionalBuildProperties();
- initialVolumes = properties
- .getProperty(ContainerCommandLauncher.VOLUMES_ID);
+ initialVolumes = properties.getProperty(ContainerCommandLauncher.VOLUMES_ID);
Map<String, DataVolumeModel> volumeMap = parseVolumes(initialVolumes);
- initialSelectedVolumes = properties
- .getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
- Map<String, DataVolumeModel> selectedVolumeMap = parseVolumes(
- initialSelectedVolumes);
+ initialSelectedVolumes = properties.getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
+ Map<String, DataVolumeModel> selectedVolumeMap = parseVolumes(initialSelectedVolumes);
Set<DataVolumeModel> selectedVolumes = new HashSet<>();
for (DataVolumeModel dvm : selectedVolumeMap.values()) {
// we need selected volumes to be volumes that are in the volumes
@@ -836,12 +752,10 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private Map<String, DataVolumeModel> parseVolumes(String volumesString) {
Map<String, DataVolumeModel> volumeMap = new HashMap<>();
if (volumesString != null && !volumesString.equals("")) { //$NON-NLS-1$
- String[] volumes = volumesString
- .split("[" + VOLUME_SEPARATOR + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ String[] volumes = volumesString.split("[" + VOLUME_SEPARATOR + "]"); //$NON-NLS-1$ //$NON-NLS-2$
for (String volume : volumes) {
if (volume != null && !volume.equals("")) { //$NON-NLS-1$
- DataVolumeModel dataVolume = DataVolumeModel
- .parseString(volume);
+ DataVolumeModel dataVolume = DataVolumeModel.parseString(volume);
volumeMap.put(dataVolume.getContainerPath(), dataVolume);
}
}
@@ -850,35 +764,28 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
@Override
- protected void performApply(ICResourceDescription src,
- ICResourceDescription dst) {
+ protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
setVolumes();
boolean needToRecalculate = false;
ICConfigurationDescription defaultCfg = null;
if (page.isMultiCfg()) {
- ICMultiConfigDescription mc1 = (ICMultiConfigDescription) src
- .getConfiguration();
- ICMultiConfigDescription mc2 = (ICMultiConfigDescription) dst
- .getConfiguration();
- ICConfigurationDescription[] cds1 = (ICConfigurationDescription[]) mc1
- .getItems();
- ICConfigurationDescription[] cds2 = (ICConfigurationDescription[]) mc2
- .getItems();
+ ICMultiConfigDescription mc1 = (ICMultiConfigDescription) src.getConfiguration();
+ ICMultiConfigDescription mc2 = (ICMultiConfigDescription) dst.getConfiguration();
+ ICConfigurationDescription[] cds1 = (ICConfigurationDescription[]) mc1.getItems();
+ ICConfigurationDescription[] cds2 = (ICConfigurationDescription[]) mc2.getItems();
defaultCfg = cds1[0];
for (int i = 0; i < cds1.length; i++)
needToRecalculate |= applyToCfg(cds1[i], cds2[i]);
} else {
defaultCfg = src.getConfiguration();
- needToRecalculate = applyToCfg(src.getConfiguration(),
- dst.getConfiguration());
+ needToRecalculate = applyToCfg(src.getConfiguration(), dst.getConfiguration());
}
if (needToRecalculate) {
recalculateSpecs(defaultCfg, true);
}
}
- private boolean applyToCfg(ICConfigurationDescription c1,
- ICConfigurationDescription c2) {
+ private boolean applyToCfg(ICConfigurationDescription c1, ICConfigurationDescription c2) {
Configuration cfg01 = (Configuration) getCfg(c1);
Configuration cfg02 = (Configuration) getCfg(c2);
IOptionalBuildProperties prop1 = cfg01.getOptionalBuildProperties();
@@ -890,66 +797,45 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
ICTargetPlatformSetting tps2 = c2.getTargetPlatformSetting();
tps2.setBinaryParserIds(pids);
- String enablementProperty = prop1
- .getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
- String enablementProperty2 = prop2
- .getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
- if (enablementProperty != null
- && !enablementProperty.equals(enablementProperty2)) {
+ String enablementProperty = prop1.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String enablementProperty2 = prop2.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ if (enablementProperty != null && !enablementProperty.equals(enablementProperty2)) {
needToRecalculate = true;
}
- prop2.setProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED,
- enablementProperty);
-
- String connectionProperty = prop1
- .getProperty(ContainerCommandLauncher.CONNECTION_ID);
- String connectionProperty2 = prop2
- .getProperty(ContainerCommandLauncher.CONNECTION_ID);
- if (connectionProperty != null
- && !connectionProperty.equals(connectionProperty2)) {
+ prop2.setProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED, enablementProperty);
+
+ String connectionProperty = prop1.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ String connectionProperty2 = prop2.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ if (connectionProperty != null && !connectionProperty.equals(connectionProperty2)) {
needToRecalculate = true;
}
- prop2.setProperty(ContainerCommandLauncher.CONNECTION_ID,
- connectionProperty);
+ prop2.setProperty(ContainerCommandLauncher.CONNECTION_ID, connectionProperty);
- String imageProperty = prop1
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
- String imageProperty2 = prop2
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
+ String imageProperty = prop1.getProperty(ContainerCommandLauncher.IMAGE_ID);
+ String imageProperty2 = prop2.getProperty(ContainerCommandLauncher.IMAGE_ID);
if (imageProperty != null && !imageProperty.equals(imageProperty2)) {
needToRecalculate = true;
}
prop2.setProperty(ContainerCommandLauncher.IMAGE_ID, imageProperty);
- String volumesProperty = prop1
- .getProperty(ContainerCommandLauncher.VOLUMES_ID);
+ String volumesProperty = prop1.getProperty(ContainerCommandLauncher.VOLUMES_ID);
prop2.setProperty(ContainerCommandLauncher.VOLUMES_ID, volumesProperty);
- String selectedVolumesProperty = prop1
- .getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
- prop2.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID,
- selectedVolumesProperty);
+ String selectedVolumesProperty = prop1.getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
+ prop2.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID, selectedVolumesProperty);
return needToRecalculate;
}
-
- protected void recalculateSpecs(ICConfigurationDescription cfgd,
- boolean performingApply) {
+ protected void recalculateSpecs(ICConfigurationDescription cfgd, boolean performingApply) {
IConfiguration cfg = getCfg(cfgd);
IOptionalBuildProperties properties = cfg.getOptionalBuildProperties();
- initialEnabled = Boolean.parseBoolean(properties
- .getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED));
- initialConnection = properties
- .getProperty(ContainerCommandLauncher.CONNECTION_ID);
- initialImageId = properties
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
- initialVolumes = properties
- .getProperty(ContainerCommandLauncher.VOLUMES_ID);
- initialSelectedVolumes = properties
- .getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
- initialAutotoolsLaunchEnabled = Boolean.parseBoolean(
- properties.getProperty(RUN_IN_CONFIGURE_LAUNCHER));
+ initialEnabled = Boolean.parseBoolean(properties.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED));
+ initialConnection = properties.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ initialImageId = properties.getProperty(ContainerCommandLauncher.IMAGE_ID);
+ initialVolumes = properties.getProperty(ContainerCommandLauncher.VOLUMES_ID);
+ initialSelectedVolumes = properties.getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
+ initialAutotoolsLaunchEnabled = Boolean.parseBoolean(properties.getProperty(RUN_IN_CONFIGURE_LAUNCHER));
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgd)
.getLanguageSettingProviders();
for (ILanguageSettingsProvider provider : providers) {
@@ -966,7 +852,6 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
}
-
@Override
protected void performOK() {
boolean needToRecalculate = false;
@@ -975,55 +860,42 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
needToRecalculate = multiChange;
} else {
IOptionalBuildProperties p = iCfg.getOptionalBuildProperties();
- if (initialEnabled != Boolean.parseBoolean(p.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED))) {
+ if (initialEnabled != Boolean
+ .parseBoolean(p.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED))) {
needToRecalculate = true;
} else if (initialEnabled == true) {
- if (!initialConnection.equals(
- p.getProperty(ContainerCommandLauncher.CONNECTION_ID))
- || !initialImageId.equals(p.getProperty(
- ContainerCommandLauncher.IMAGE_ID))) {
+ if (!initialConnection.equals(p.getProperty(ContainerCommandLauncher.CONNECTION_ID))
+ || !initialImageId.equals(p.getProperty(ContainerCommandLauncher.IMAGE_ID))) {
needToRecalculate = true;
}
}
}
if (needToRecalculate) {
- recalculateSpecs(
- ManagedBuildManager.getDescriptionForConfiguration(iCfg),
- false);
+ recalculateSpecs(ManagedBuildManager.getDescriptionForConfiguration(iCfg), false);
}
}
@Override
protected void performDefaults() {
if (iCfg instanceof IMultiConfiguration) {
- IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
- .getItems();
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg).getItems();
for (int i = 0; i < cfs.length; i++) {
- IOptionalBuildProperties props = cfs[i]
- .getOptionalBuildProperties();
- props.setProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED,
- Boolean.toString(false));
+ IOptionalBuildProperties props = cfs[i].getOptionalBuildProperties();
+ props.setProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED, Boolean.toString(false));
if (connections.length > 0) {
- props.setProperty(ContainerCommandLauncher.CONNECTION_ID,
- connections[0].getUri());
+ props.setProperty(ContainerCommandLauncher.CONNECTION_ID, connections[0].getUri());
} else {
- props.setProperty(ContainerCommandLauncher.CONNECTION_ID,
- null);
+ props.setProperty(ContainerCommandLauncher.CONNECTION_ID, null);
}
props.setProperty(ContainerCommandLauncher.IMAGE_ID, null);
props.setProperty(ContainerCommandLauncher.VOLUMES_ID, null);
- props.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID,
- null);
+ props.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID, null);
}
} else {
IOptionalBuildProperties props = iCfg.getOptionalBuildProperties();
- props.setProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED,
- Boolean.toString(false));
+ props.setProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED, Boolean.toString(false));
if (connections.length > 0) {
- props.setProperty(ContainerCommandLauncher.CONNECTION_ID,
- connections[0].getUri());
+ props.setProperty(ContainerCommandLauncher.CONNECTION_ID, connections[0].getUri());
} else {
props.setProperty(ContainerCommandLauncher.CONNECTION_ID, null);
}
@@ -1102,8 +974,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
@Override
- public void listChanged(IDockerConnection c,
- java.util.List<IDockerImage> list) {
+ public void listChanged(IDockerConnection c, java.util.List<IDockerImage> list) {
final IDockerImage[] finalList = list.toArray(new IDockerImage[0]);
if (c.getName().equals(connection.getName())) {
Display.getDefault().syncExec(new Runnable() {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyVolumesModel.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyVolumesModel.java
index 014abbefd58..bbcb6caf954 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyVolumesModel.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyVolumesModel.java
@@ -30,14 +30,12 @@ import org.eclipse.linuxtools.docker.core.IDockerImageInfo;
* Databinding model for the {@link ContainerPropertyTab}
*
*/
-public class ContainerPropertyVolumesModel
- extends BaseDatabindingModel {
+public class ContainerPropertyVolumesModel extends BaseDatabindingModel {
public enum MountType {
NONE, HOST_FILE_SYSTEM, CONTAINER;
}
-
public static final String DATA_VOLUMES = "dataVolumes"; //$NON-NLS-1$
public static final String SELECTED_DATA_VOLUMES = "selectedDataVolumes"; //$NON-NLS-1$
@@ -54,13 +52,11 @@ public class ContainerPropertyVolumesModel
private IDockerImage selectedImage;
- public ContainerPropertyVolumesModel(
- final IDockerConnection connection) {
+ public ContainerPropertyVolumesModel(final IDockerConnection connection) {
this.connection = connection;
}
- public ContainerPropertyVolumesModel(
- final IDockerImage selectedImage) throws DockerException {
+ public ContainerPropertyVolumesModel(final IDockerImage selectedImage) throws DockerException {
this(selectedImage.getConnection());
this.selectedImage = selectedImage;
}
@@ -76,32 +72,28 @@ public class ContainerPropertyVolumesModel
/**
* Refreshes the list of Volumes to display in the for the given
- *
+ *
* @param selectedImage
*/
public void setSelectedImage(final IDockerImage selectedImage) {
- if (this.selectedImage == null
- || !this.selectedImage.equals(selectedImage)) {
+ if (this.selectedImage == null || !this.selectedImage.equals(selectedImage)) {
this.selectedImage = selectedImage;
if (selectedImage != null) {
- this.imageInfo = selectedImage.getConnection()
- .getImageInfo(selectedImage.id());
- if (this.imageInfo.config() != null
- && this.imageInfo.config().volumes() != null) {
+ this.imageInfo = selectedImage.getConnection().getImageInfo(selectedImage.id());
+ if (this.imageInfo.config() != null && this.imageInfo.config().volumes() != null) {
for (DataVolumeModel dvm : previousVolumes) {
removeDataVolume(dvm);
selectedDataVolumes.remove(dvm);
}
final List<DataVolumeModel> volumes = new ArrayList<>();
- for (String volume : this.imageInfo.config().volumes()
- .keySet()) {
+ for (String volume : this.imageInfo.config().volumes().keySet()) {
volumes.add(new DataVolumeModel(volume));
}
setDataVolumes(volumes);
previousVolumes = volumes;
}
} else {
- setDataVolumes(Collections.<DataVolumeModel> emptyList());
+ setDataVolumes(Collections.<DataVolumeModel>emptyList());
}
}
@@ -137,8 +129,7 @@ public class ContainerPropertyVolumesModel
return selectedDataVolumes;
}
- public void setSelectedDataVolumes(
- final Set<DataVolumeModel> selectedDataVolumes) {
+ public void setSelectedDataVolumes(final Set<DataVolumeModel> selectedDataVolumes) {
firePropertyChange(SELECTED_DATA_VOLUMES, this.selectedDataVolumes,
this.selectedDataVolumes = selectedDataVolumes);
}
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 a1efd166146..da195573887 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
@@ -72,8 +72,8 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.osgi.service.prefs.Preferences;
-public class ContainerTab extends AbstractLaunchConfigurationTab implements
- IDockerConnectionManagerListener, IDockerImageListener {
+public class ContainerTab extends AbstractLaunchConfigurationTab
+ implements IDockerConnectionManagerListener, IDockerImageListener {
private List directoriesList;
private String imageName;
@@ -130,17 +130,14 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
@Override
public void createControl(Composite parent) {
Font font = parent.getFont();
- Composite mainComposite = createComposite(parent, 3, 1,
- GridData.FILL_HORIZONTAL);
+ Composite mainComposite = createComposite(parent, 3, 1, GridData.FILL_HORIZONTAL);
mainComposite.setFont(font);
setControl(mainComposite);
Label connectionSelectorLabel = new Label(mainComposite, SWT.NULL);
- connectionSelectorLabel
- .setText(Messages.ContainerTab_Connection_Selector_Label);
+ connectionSelectorLabel.setText(Messages.ContainerTab_Connection_Selector_Label);
- connectionSelector = new Combo(mainComposite, SWT.BORDER
- | SWT.READ_ONLY);
+ connectionSelector = new Combo(mainComposite, SWT.BORDER | SWT.READ_ONLY);
initializeConnectionSelector();
connectionSelector.addModifyListener(connectionModifyListener);
// Following is a kludge so that on Linux the Combo is read-only but
@@ -218,11 +215,9 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
private void createButtons(Composite parent) {
Font font = parent.getFont();
Composite composite = createComposite(parent, 1, 1,
- GridData.VERTICAL_ALIGN_BEGINNING
- | GridData.HORIZONTAL_ALIGN_END);
+ GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END);
composite.setFont(font);
- newButton = createPushButton(composite,
- Messages.ContainerTab_New_Button, null); //$NON-NLS-1$
+ newButton = createPushButton(composite, Messages.ContainerTab_New_Button, null); //$NON-NLS-1$
newButton.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gdb = new GridData(GridData.VERTICAL_ALIGN_CENTER);
gdb.grabExcessHorizontalSpace = false;
@@ -236,8 +231,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
}
});
- removeButton = createPushButton(composite,
- Messages.ContainerTab_Remove_Button, null); //$NON-NLS-1$
+ removeButton = createPushButton(composite, Messages.ContainerTab_Remove_Button, null); //$NON-NLS-1$
removeButton.setLayoutData(new GridData(GridData.FILL_BOTH));
removeButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -262,86 +256,63 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
group.setLayout(new GridLayout());
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(3, 1)
- .grab(true, false).applyTo(group);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(3, 1).grab(true, false).applyTo(group);
group.setLayout(new GridLayout());
// specify ports
final Label portSettingsLabel = new Label(group, SWT.NONE);
portSettingsLabel.setText(Messages.ContainerTab_Specify_Ports_Label);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
- .grab(true, false).span(3, 1)
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(3, 1)
.applyTo(portSettingsLabel);
- final CheckboxTableViewer exposedPortsTableViewer = createPortSettingsTable(
- group);
+ final CheckboxTableViewer exposedPortsTableViewer = createPortSettingsTable(group);
tableViewer = exposedPortsTableViewer;
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).span(3 - 1, 1).indent(INDENT, 0)
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(3 - 1, 1).indent(INDENT, 0)
.hint(200, 70).applyTo(exposedPortsTableViewer.getTable());
// buttons
final Composite buttonsContainers = new Composite(parent, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(false, false).applyTo(buttonsContainers);
- GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0)
- .spacing(SWT.DEFAULT, 0).applyTo(buttonsContainers);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(false, false).applyTo(buttonsContainers);
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(SWT.DEFAULT, 0).applyTo(buttonsContainers);
final Button addButton = new Button(buttonsContainers, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).applyTo(addButton);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(addButton);
addButton.setText(Messages.ContainerTab_Add_Button);
addButton.addSelectionListener(onAddPort(exposedPortsTableViewer));
final Button editButton = new Button(buttonsContainers, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).applyTo(editButton);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(editButton);
editButton.setText(Messages.ContainerTab_Edit_Button);
editButton.setEnabled(false);
editButton.addSelectionListener(onEditPort(exposedPortsTableViewer));
final Button removeButton = new Button(buttonsContainers, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
- .grab(true, false).applyTo(removeButton);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(removeButton);
removeButton.setText(Messages.ContainerTab_Remove_Button);
- removeButton
- .addSelectionListener(onRemovePorts(exposedPortsTableViewer));
+ removeButton.addSelectionListener(onRemovePorts(exposedPortsTableViewer));
ViewerSupport.bind(exposedPortsTableViewer, model.getExposedPorts(),
- BeanProperties.values(ExposedPortModel.class,
- ExposedPortModel.CONTAINER_PORT,
- ExposedPortModel.PORT_TYPE,
- ExposedPortModel.HOST_ADDRESS,
- ExposedPortModel.HOST_PORT));
- dbc.bindSet(
- ViewersObservables.observeCheckedElements(
- exposedPortsTableViewer, ExposedPortModel.class),
- BeanProperties.set(ContainerTabModel.SELECTED_PORTS)
- .observe(model));
+ BeanProperties.values(ExposedPortModel.class, ExposedPortModel.CONTAINER_PORT,
+ ExposedPortModel.PORT_TYPE, ExposedPortModel.HOST_ADDRESS, ExposedPortModel.HOST_PORT));
+ dbc.bindSet(ViewersObservables.observeCheckedElements(exposedPortsTableViewer, ExposedPortModel.class),
+ BeanProperties.set(ContainerTabModel.SELECTED_PORTS).observe(model));
checkAllElements(exposedPortsTableViewer);
// disable the edit and removeButton if the table is empty
- exposedPortsTableViewer.addSelectionChangedListener(
- onSelectionChanged(editButton, removeButton));
- exposedPortsTableViewer
- .addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(
- CheckStateChangedEvent event) {
- ExposedPortModel e = (ExposedPortModel) event
- .getElement();
- e.setSelected(event.getChecked());
- updateLaunchConfigurationDialog();
- }
- });
+ exposedPortsTableViewer.addSelectionChangedListener(onSelectionChanged(editButton, removeButton));
+ exposedPortsTableViewer.addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ ExposedPortModel e = (ExposedPortModel) event.getElement();
+ e.setSelected(event.getChecked());
+ updateLaunchConfigurationDialog();
+ }
+ });
}
- private void checkAllElements(
- final CheckboxTableViewer exposedPortsTableViewer) {
+ private void checkAllElements(final CheckboxTableViewer exposedPortsTableViewer) {
exposedPortsTableViewer.setAllChecked(true);
model.setSelectedPorts(new HashSet<>(model.getExposedPorts()));
}
- private SelectionListener onAddPort(
- final CheckboxTableViewer exposedPortsTableViewer) {
+ private SelectionListener onAddPort(final CheckboxTableViewer exposedPortsTableViewer) {
return SelectionListener.widgetSelectedAdapter(e -> {
- final ContainerPortDialog dialog = new ContainerPortDialog(
- getShell());
+ final ContainerPortDialog dialog = new ContainerPortDialog(getShell());
dialog.create();
if (dialog.open() == IDialogConstants.OK_ID) {
final ExposedPortModel port = dialog.getPort();
@@ -354,22 +325,16 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
});
}
- private SelectionListener onEditPort(
- final CheckboxTableViewer exposedPortsTableViewer) {
+ private SelectionListener onEditPort(final CheckboxTableViewer exposedPortsTableViewer) {
return SelectionListener.widgetSelectedAdapter(e -> {
- final IStructuredSelection selection = exposedPortsTableViewer
- .getStructuredSelection();
- final ExposedPortModel selectedContainerPort = (ExposedPortModel) selection
- .getFirstElement();
- final ContainerPortDialog dialog = new ContainerPortDialog(
- getShell(), selectedContainerPort);
+ final IStructuredSelection selection = exposedPortsTableViewer.getStructuredSelection();
+ final ExposedPortModel selectedContainerPort = (ExposedPortModel) selection.getFirstElement();
+ final ContainerPortDialog dialog = new ContainerPortDialog(getShell(), selectedContainerPort);
dialog.create();
if (dialog.open() == IDialogConstants.OK_ID) {
final ExposedPortModel configuredPort = dialog.getPort();
- selectedContainerPort
- .setContainerPort(configuredPort.getContainerPort());
- selectedContainerPort
- .setHostAddress(configuredPort.getHostAddress());
+ selectedContainerPort.setContainerPort(configuredPort.getContainerPort());
+ selectedContainerPort.setHostAddress(configuredPort.getHostAddress());
selectedContainerPort.setHostPort(configuredPort.getHostPort());
exposedPortsTableViewer.refresh();
updateLaunchConfigurationDialog();
@@ -377,14 +342,11 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
});
}
- private SelectionListener onRemovePorts(
- final TableViewer portsTableViewer) {
+ private SelectionListener onRemovePorts(final TableViewer portsTableViewer) {
return SelectionListener.widgetSelectedAdapter(e -> {
- final IStructuredSelection selection = portsTableViewer
- .getStructuredSelection();
+ final IStructuredSelection selection = portsTableViewer.getStructuredSelection();
for (@SuppressWarnings("unchecked")
- Iterator<ExposedPortModel> iterator = selection.iterator(); iterator
- .hasNext();) {
+ Iterator<ExposedPortModel> iterator = selection.iterator(); iterator.hasNext();) {
final ExposedPortModel port = iterator.next();
model.removeAvailablePort(port);
model.getSelectedPorts().remove(port);
@@ -393,8 +355,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
});
}
- private ISelectionChangedListener onSelectionChanged(
- final Button... targetButtons) {
+ private ISelectionChangedListener onSelectionChanged(final Button... targetButtons) {
return e -> {
if (e.getSelection().isEmpty()) {
setControlsEnabled(targetButtons, false);
@@ -404,41 +365,29 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
};
}
- private static void setControlsEnabled(final Control[] controls,
- final boolean enabled) {
+ private static void setControlsEnabled(final Control[] controls, final boolean enabled) {
for (Control control : controls) {
control.setEnabled(enabled);
}
}
- private CheckboxTableViewer createPortSettingsTable(
- final Composite container) {
- final Table table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION
- | SWT.V_SCROLL | SWT.H_SCROLL | SWT.CHECK);
+ private CheckboxTableViewer createPortSettingsTable(final Composite container) {
+ final Table table = new Table(container,
+ SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.CHECK);
final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
- createTableViewerColum(tableViewer,
- Messages.ContainerTab_Port_Column,
- 100);
- createTableViewerColum(tableViewer,
- Messages.ContainerTab_Type_Column,
- 50);
- createTableViewerColum(tableViewer,
- Messages.ContainerTab_HostAddress_Column,
- 100);
- createTableViewerColum(tableViewer,
- Messages.ContainerTab_HostPort_Column,
- 100);
+ createTableViewerColum(tableViewer, Messages.ContainerTab_Port_Column, 100);
+ createTableViewerColum(tableViewer, Messages.ContainerTab_Type_Column, 50);
+ createTableViewerColum(tableViewer, Messages.ContainerTab_HostAddress_Column, 100);
+ createTableViewerColum(tableViewer, Messages.ContainerTab_HostPort_Column, 100);
tableViewer.setContentProvider(new ObservableListContentProvider());
return tableViewer;
}
- private TableViewerColumn createTableViewerColum(
- final TableViewer tableViewer, final String title,
+ private TableViewerColumn createTableViewerColum(final TableViewer tableViewer, final String title,
final int width) {
- final TableViewerColumn viewerColumn = new TableViewerColumn(
- tableViewer, SWT.NONE);
+ final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
if (title != null) {
column.setText(title);
@@ -462,8 +411,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
keepButton = createCheckButton(group, Messages.ContainerTab_Keep_Label);
keepButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Boolean keepPref = prefs.getBoolean(
- PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
+ Boolean keepPref = prefs.getBoolean(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
keepButton.setSelection(keepPref);
keepValue = keepPref;
keepButton.addSelectionListener(new SelectionListener() {
@@ -480,8 +428,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
}
});
- stdinButton = createCheckButton(group,
- Messages.ContainerTab_Stdin_Support_Label);
+ stdinButton = createCheckButton(group, Messages.ContainerTab_Stdin_Support_Label);
stdinButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
stdinValue = false;
stdinButton.addSelectionListener(new SelectionListener() {
@@ -498,8 +445,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
}
});
- privilegedButton = createCheckButton(group,
- Messages.ContainerTab_Privileged_Mode_Label);
+ privilegedButton = createCheckButton(group, Messages.ContainerTab_Privileged_Mode_Label);
privilegedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
privilegedValue = false;
privilegedButton.addSelectionListener(new SelectionListener() {
@@ -518,8 +464,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
});
}
- private Composite createComposite(Composite parent, int columns, int hspan,
- int fill) {
+ private Composite createComposite(Composite parent, int columns, int hspan, int fill) {
Composite g = new Composite(parent, SWT.NONE);
g.setLayout(new GridLayout(columns, false));
g.setFont(parent.getFont());
@@ -618,8 +563,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
for (int i = 0; i < strs.length; i++) {
stripped.append(strs[i]);
}
- control.getAccessible().addAccessibleListener(
- new ControlAccessibleListener(stripped.toString()));
+ control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
}
private class ControlAccessibleListener extends AccessibleAdapter {
@@ -637,35 +581,28 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
- (String) null);
- configuration.setAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS,
- (String) null);
+ configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS, (String) null);
+ configuration.setAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS, (String) null);
configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
- Preferences prefs = InstanceScope.INSTANCE
- .getNode(DockerLaunchUIPlugin.PLUGIN_ID);
+ Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
String image = prefs.get(PreferenceConstants.DEFAULT_IMAGE, ""); //$NON-NLS-1$
configuration.setAttribute(ILaunchConstants.ATTR_IMAGE, image);
- Boolean keepContainer = prefs.getBoolean(
- PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
- configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH,
- keepContainer);
+ Boolean keepContainer = prefs.getBoolean(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
+ configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, keepContainer);
configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false);
}
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- java.util.List<String> additionalDirs = configuration.getAttribute(
- ILaunchConstants.ATTR_ADDITIONAL_DIRS,
+ java.util.List<String> additionalDirs = configuration.getAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(java.util.List<String>) null);
if (additionalDirs != null)
directoriesList.setItems(additionalDirs.toArray(new String[0]));
- java.util.List<String> exposedPortInfos = configuration
- .getAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS,
- Collections.<String> emptyList());
+ java.util.List<String> exposedPortInfos = configuration.getAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS,
+ Collections.<String>emptyList());
model.removeExposedPorts();
for (String port : exposedPortInfos) {
ExposedPortModel m = ExposedPortModel.createPortModel(port);
@@ -675,11 +612,9 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
tableViewer.setChecked(m, true);
}
}
- connectionUri = configuration.getAttribute(
- ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
+ connectionUri = configuration.getAttribute(ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
int defaultIndex = 0;
- connections = DockerConnectionManager.getInstance()
- .getConnections();
+ connections = DockerConnectionManager.getInstance().getConnections();
if (connections.length > 0) {
if (!connectionUri.isEmpty()) {
String[] connectionNames = new String[connections.length];
@@ -693,22 +628,17 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
connectionUri = connections[0].getUri();
}
}
- imageName = configuration.getAttribute(ILaunchConstants.ATTR_IMAGE,
- "");
+ imageName = configuration.getAttribute(ILaunchConstants.ATTR_IMAGE, "");
imageCombo.setText(imageName);
- keepValue = configuration.getAttribute(
- ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
+ keepValue = configuration.getAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
keepButton.setSelection(keepValue);
- stdinValue = configuration.getAttribute(
- ILaunchConstants.ATTR_STDIN_SUPPORT, false);
+ stdinValue = configuration.getAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false);
stdinButton.setSelection(stdinValue);
- privilegedValue = configuration
- .getAttribute(ILaunchConstants.ATTR_PRIVILEGED_MODE, false);
+ privilegedValue = configuration.getAttribute(ILaunchConstants.ATTR_PRIVILEGED_MODE, false);
privilegedButton.setSelection(privilegedValue);
} catch (CoreException e) {
- setErrorMessage(Messages.bind(
- Messages.ContainerTab_Error_Reading_Configuration, e
- .getStatus().getMessage())); //$NON-NLS-1$
+ setErrorMessage(
+ Messages.bind(Messages.ContainerTab_Error_Reading_Configuration, e.getStatus().getMessage())); //$NON-NLS-1$
DockerLaunchUIPlugin.log(e);
}
}
@@ -716,18 +646,13 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
String[] dirs = directoriesList.getItems();
- configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
- Arrays.asList(dirs));
+ configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS, Arrays.asList(dirs));
String image = imageCombo.getText();
configuration.setAttribute(ILaunchConstants.ATTR_IMAGE, image);
- configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI,
- connectionUri);
- configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH,
- keepButton.getSelection());
- configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT,
- stdinButton.getSelection());
- configuration.setAttribute(ILaunchConstants.ATTR_PRIVILEGED_MODE,
- privilegedButton.getSelection());
+ configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, connectionUri);
+ configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, keepButton.getSelection());
+ configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, stdinButton.getSelection());
+ configuration.setAttribute(ILaunchConstants.ATTR_PRIVILEGED_MODE, privilegedButton.getSelection());
configuration.setAttribute(ILaunchConstants.ATTR_EXPOSED_PORTS,
ExposedPortModel.toArrayString(model.getExposedPorts()));
}
@@ -735,21 +660,18 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
@Override
public boolean isValid(ILaunchConfiguration launchConfig) {
try {
- String image = launchConfig
- .getAttribute(ILaunchConstants.ATTR_IMAGE, (String) null);
+ String image = launchConfig.getAttribute(ILaunchConstants.ATTR_IMAGE, (String) null);
if (image == null)
return false;
int index = image.lastIndexOf(':'); //$NON-NLS-1$
if (index <= 0)
return false;
- if (connection.hasImage(image.substring(0, index),
- image.substring(index + 1))) {
+ if (connection.hasImage(image.substring(0, index), image.substring(index + 1))) {
setWarningMessage(null);
return true;
} else {
- setWarningMessage(Messages.bind(
- Messages.ContainerTab_Warning_Image_Not_Found,
- image, connections[0].getName()));
+ setWarningMessage(
+ Messages.bind(Messages.ContainerTab_Warning_Image_Not_Found, image, connections[0].getName()));
}
} catch (CoreException e) {
return false;
@@ -806,8 +728,7 @@ public class ContainerTab extends AbstractLaunchConfigurationTab implements
connectionSelector.addModifyListener(connectionModifyListener);
}
- public void listChanged(IDockerConnection c,
- java.util.List<IDockerImage> list) {
+ public void listChanged(IDockerConnection c, java.util.List<IDockerImage> list) {
setErrorMessage(null);
final IDockerImage[] finalList = list.toArray(new IDockerImage[0]);
if (finalList.length == 0) {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTabModel.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTabModel.java
index f22cdb8288f..aae8fe282a2 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTabModel.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerTabModel.java
@@ -42,8 +42,7 @@ public class ContainerTabModel extends BaseDatabindingModel {
}
public void setPublishAllPorts(boolean publishAllPorts) {
- firePropertyChange(PUBLISH_ALL_PORTS, this.publishAllPorts,
- this.publishAllPorts = publishAllPorts);
+ firePropertyChange(PUBLISH_ALL_PORTS, this.publishAllPorts, this.publishAllPorts = publishAllPorts);
}
public WritableList<ExposedPortModel> getExposedPorts() {
@@ -83,8 +82,7 @@ public class ContainerTabModel extends BaseDatabindingModel {
}
public void setSelectedPorts(final Set<ExposedPortModel> ports) {
- firePropertyChange(SELECTED_PORTS, this.selectedPorts,
- this.selectedPorts = ports);
+ firePropertyChange(SELECTED_PORTS, this.selectedPorts, this.selectedPorts = ports);
}
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/DataVolumeModel.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/DataVolumeModel.java
index 4225271a512..fe7bfe98709 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/DataVolumeModel.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/DataVolumeModel.java
@@ -24,8 +24,7 @@ import org.eclipse.core.runtime.Platform;
* Data binding model for container data volumes
*
*/
-public class DataVolumeModel extends BaseDatabindingModel
- implements Comparable<DataVolumeModel> {
+public class DataVolumeModel extends BaseDatabindingModel implements Comparable<DataVolumeModel> {
private static final String SEPARATOR = ":"; //$NON-NLS-1$
@@ -59,7 +58,6 @@ public class DataVolumeModel extends BaseDatabindingModel
private boolean selected;
-
/**
* Default constructor
*/
@@ -68,7 +66,7 @@ public class DataVolumeModel extends BaseDatabindingModel
/**
* Constructor
- *
+ *
* @param containerPath
* the container path
*/
@@ -77,8 +75,7 @@ public class DataVolumeModel extends BaseDatabindingModel
this.mountType = MountType.NONE;
}
- public DataVolumeModel(final String containerPath, final String hostPath,
- final boolean readOnly) {
+ public DataVolumeModel(final String containerPath, final String hostPath, final boolean readOnly) {
this.containerPath = containerPath;
this.mountType = MountType.HOST_FILE_SYSTEM;
this.hostPathMount = hostPath;
@@ -108,12 +105,11 @@ public class DataVolumeModel extends BaseDatabindingModel
/**
* Create a DataVolumeModel from a toString() output.
- *
+ *
* @param fromString
* @return DataVolumeModel
*/
- public static DataVolumeModel parseString(
- final String fromString) {
+ public static DataVolumeModel parseString(final String fromString) {
final DataVolumeModel model = new DataVolumeModel();
final String[] items = fromString.split(SEPARATOR); // $NON-NLS-1$
model.containerPath = items[0];
@@ -128,8 +124,7 @@ public class DataVolumeModel extends BaseDatabindingModel
// a windows drive using the : separator, we have to form the
// host path by merging the path back together. If the user
// has specified an alternate format, we don't do this.
- if (Platform.OS_WIN32.equals(Platform.getOS())
- && items.length > 5) {
+ if (Platform.OS_WIN32.equals(Platform.getOS()) && items.length > 5) {
model.setHostPathMount(items[2] + SEPARATOR + items[3]);
model.setReadOnly(Boolean.valueOf(items[4]));
model.setSelected(Boolean.valueOf(items[5]));
@@ -148,12 +143,12 @@ public class DataVolumeModel extends BaseDatabindingModel
/**
* creates a {@link DataVolumeModel} from the 'volumeFrom' container info
- *
+ *
* @param volumeFrom
* the value to parse.
- *
+ *
* Format: <code>&lt;containerName&gt;</code>
- *
+ *
* @See <a href="https://docs.docker.com/engine/userguide/dockervolumes/">
* https://docs.docker.com/engine/userguide/dockervolumes/</a>
*/
@@ -167,18 +162,18 @@ public class DataVolumeModel extends BaseDatabindingModel
/**
* creates a {@link DataVolumeModel} from the 'volumeFrom' container info
- *
+ *
* @param volumeFrom
* the value to parse. Format:
* <code>&lt;host_path&gt;:&lt;container_path&gt;:&lt;label_suffix_flag&gt;</code>
- *
+ *
* @See <a href="https://docs.docker.com/engine/userguide/dockervolumes/">
* https://docs.docker.com/engine/userguide/dockervolumes/</a>
*/
public static DataVolumeModel parseHostBinding(String volumeFrom) {
final DataVolumeModel model = new DataVolumeModel();
final String[] items = volumeFrom.split(SEPARATOR); // $NON-NLS-1$
- // converts the host path to a valid Win32 path if Platform OS is Win32
+ // converts the host path to a valid Win32 path if Platform OS is Win32
model.setHostPathMount(convertToWin32Path(Platform.getOS(), items[0]));
model.containerPath = items[1];
model.mountType = MountType.HOST_FILE_SYSTEM;
@@ -194,7 +189,7 @@ public class DataVolumeModel extends BaseDatabindingModel
/**
* Converts the given path to a portable form, replacing all "\" and ": "
* with "/" if the given <code>os</code> is {@link Platform#OS_WIN32}.
- *
+ *
* @param os
* the current OS
* @param path
@@ -202,8 +197,7 @@ public class DataVolumeModel extends BaseDatabindingModel
* @return the converted path or the given path
* @see {@link Platform#getOS()}
*/
- public static String convertToWin32Path(final String os,
- final String path) {
+ public static String convertToWin32Path(final String os, final String path) {
if (os != null && os.equals(Platform.OS_WIN32)) {
// replace all "/" with "\" and then drive info (eg "/c/" to "C:/")
final Matcher m = Pattern.compile("^/([a-zA-Z])/").matcher(path); //$NON-NLS-1$
@@ -224,8 +218,7 @@ public class DataVolumeModel extends BaseDatabindingModel
}
public void setContainerPath(final String containerPath) {
- firePropertyChange(CONTAINER_PATH, this.containerPath,
- this.containerPath = containerPath);
+ firePropertyChange(CONTAINER_PATH, this.containerPath, this.containerPath = containerPath);
}
public String getMount() {
@@ -247,8 +240,7 @@ public class DataVolumeModel extends BaseDatabindingModel
if (mountType == null) {
return;
}
- firePropertyChange(MOUNT_TYPE, this.mountType,
- this.mountType = mountType);
+ firePropertyChange(MOUNT_TYPE, this.mountType, this.mountType = mountType);
if (this.mountType == MountType.NONE) {
setMount("");
}
@@ -260,8 +252,7 @@ public class DataVolumeModel extends BaseDatabindingModel
}
public void setHostPathMount(final String hostPathMount) {
- firePropertyChange(HOST_PATH_MOUNT, this.hostPathMount,
- this.hostPathMount = hostPathMount);
+ firePropertyChange(HOST_PATH_MOUNT, this.hostPathMount, this.hostPathMount = hostPathMount);
if (this.mountType == MountType.HOST_FILE_SYSTEM) {
setMount(this.hostPathMount);
}
@@ -272,8 +263,7 @@ public class DataVolumeModel extends BaseDatabindingModel
}
public void setReadOnly(final boolean readOnly) {
- firePropertyChange(READ_ONLY_VOLUME, this.readOnly,
- this.readOnly = readOnly);
+ firePropertyChange(READ_ONLY_VOLUME, this.readOnly, this.readOnly = readOnly);
}
public String getContainerMount() {
@@ -281,8 +271,7 @@ public class DataVolumeModel extends BaseDatabindingModel
}
public void setContainerMount(final String containerMount) {
- firePropertyChange(CONTAINER_MOUNT, this.containerMount,
- this.containerMount = containerMount);
+ firePropertyChange(CONTAINER_MOUNT, this.containerMount, this.containerMount = containerMount);
if (this.mountType == MountType.CONTAINER) {
setMount(this.containerMount);
}
@@ -305,8 +294,7 @@ public class DataVolumeModel extends BaseDatabindingModel
@Override
public String toString() {
final StringBuffer buffer = new StringBuffer();
- buffer.append(
- this.containerPath + SEPARATOR + getMountType() + SEPARATOR);
+ buffer.append(this.containerPath + SEPARATOR + getMountType() + SEPARATOR);
switch (getMountType()) {
case CONTAINER:
buffer.append(getContainerMount());
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ExposedPortModel.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ExposedPortModel.java
index 107cd33dd13..12e9a8cacfe 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ExposedPortModel.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ExposedPortModel.java
@@ -20,8 +20,7 @@ import java.util.UUID;
import org.eclipse.core.runtime.Assert;
-public class ExposedPortModel extends BaseDatabindingModel
- implements Comparable<ExposedPortModel> {
+public class ExposedPortModel extends BaseDatabindingModel implements Comparable<ExposedPortModel> {
private static final String SEPARATOR = ":"; //$NON-NLS-1$
@@ -52,17 +51,15 @@ public class ExposedPortModel extends BaseDatabindingModel
/**
* Parses and converts the {@link List} of the given {@link String} values
* into a {@link List} of {@link ExposedPortModel}
- *
+ *
* @param exposedPortInfos
* the input values
* @return the corresponding {@link ExposedPortModel}s
*/
- public static List<ExposedPortModel> fromStrings(
- final Collection<String> exposedPortInfos) {
+ public static List<ExposedPortModel> fromStrings(final Collection<String> exposedPortInfos) {
final List<ExposedPortModel> exposedPorts = new ArrayList<>();
for (String exposedPortInfo : exposedPortInfos) {
- final ExposedPortModel exposedPort = ExposedPortModel
- .fromString(exposedPortInfo);
+ final ExposedPortModel exposedPort = ExposedPortModel.fromString(exposedPortInfo);
if (exposedPort != null) {
exposedPorts.add(exposedPort);
}
@@ -73,14 +70,13 @@ public class ExposedPortModel extends BaseDatabindingModel
/**
* Converts a collection of ExposedPortModel to a {@link List} of
* {@link String} values
- *
- *
+ *
+ *
* @param exposedPorts
* collection of ExposedPortModel instances
* @return the corresponding {@link List} of {@link String}s
*/
- public static List<String> toArrayString(
- final Collection<ExposedPortModel> exposedPorts) {
+ public static List<String> toArrayString(final Collection<ExposedPortModel> exposedPorts) {
final List<String> exposedPortList = new ArrayList<>();
for (ExposedPortModel exposedPort : exposedPorts) {
final String exposedPortString = exposedPort.toString();
@@ -94,51 +90,41 @@ public class ExposedPortModel extends BaseDatabindingModel
/**
* Parse the given value and returns an instance of
* {@link ExposedPortModel}.
- *
+ *
* @param exposedPortInfo
* the value to parse
* @return the corresponding {@link ExposedPortModel}
*/
public static ExposedPortModel fromString(final String exposedPortInfo) {
- final String privatePort = exposedPortInfo.substring(0,
- exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR));
+ final String privatePort = exposedPortInfo.substring(0, exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR));
// exposed ports without host IP/port info
final int firstColumnSeparator = exposedPortInfo.indexOf(SEPARATOR);
- if (firstColumnSeparator == -1
- && exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR) != -1) {
- final String type = exposedPortInfo.substring(
- exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR)); // $NON-NLS-1$
- final ExposedPortModel exposedPort = new ExposedPortModel(
- privatePort, type, "", privatePort); // $NON-NLS-1$
+ if (firstColumnSeparator == -1 && exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR) != -1) {
+ final String type = exposedPortInfo.substring(exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR)); // $NON-NLS-1$
+ final ExposedPortModel exposedPort = new ExposedPortModel(privatePort, type, "", privatePort); // $NON-NLS-1$
return exposedPort; // $NON-NLS-1$
} else {
- final int secondColumnSeparator = exposedPortInfo.indexOf(SEPARATOR,
- firstColumnSeparator + 1);
- final String type = exposedPortInfo.substring(
- exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR), // $NON-NLS-1$
+ final int secondColumnSeparator = exposedPortInfo.indexOf(SEPARATOR, firstColumnSeparator + 1);
+ final String type = exposedPortInfo.substring(exposedPortInfo.indexOf(CONTAINER_TYPE_SEPARATOR), // $NON-NLS-1$
firstColumnSeparator); // $NON-NLS-1$
- final String hostIP = exposedPortInfo
- .substring(firstColumnSeparator + 1, secondColumnSeparator);
- final String hostPort = exposedPortInfo
- .substring(secondColumnSeparator + 1);
- final ExposedPortModel exposedPort = new ExposedPortModel(
- privatePort, type, hostIP, hostPort); // $NON-NLS-1$
+ final String hostIP = exposedPortInfo.substring(firstColumnSeparator + 1, secondColumnSeparator);
+ final String hostPort = exposedPortInfo.substring(secondColumnSeparator + 1);
+ final ExposedPortModel exposedPort = new ExposedPortModel(privatePort, type, hostIP, hostPort); // $NON-NLS-1$
return exposedPort; // $NON-NLS-1$
}
}
/**
* Full constructor
- *
+ *
* @param privatePort
* @param portType
* @param hostAddress
* @param hostPort
*/
- public ExposedPortModel(final String privatePort, final String type,
- final String hostAddress, final String hostPort) {
- Assert.isNotNull(privatePort,
- "Port Mapping privatePort cannot be null"); //$NON-NLS-1$
+ public ExposedPortModel(final String privatePort, final String type, final String hostAddress,
+ final String hostPort) {
+ Assert.isNotNull(privatePort, "Port Mapping privatePort cannot be null"); //$NON-NLS-1$
Assert.isNotNull(type, "Port Mapping portType cannot be null"); //$NON-NLS-1$
this.containerPort = privatePort;
this.hostPort = hostPort;
@@ -148,19 +134,17 @@ public class ExposedPortModel extends BaseDatabindingModel
/**
* Create an ExposedPortModel from its toString output
- *
+ *
* @param stringValue
* @return ExposedPortModel
*/
static public ExposedPortModel createPortModel(String stringValue) {
final String[] elements = stringValue.split(SEPARATOR);
- final String[] containerPortElements = elements[0]
- .split(CONTAINER_TYPE_SEPARATOR);
- ExposedPortModel model = new ExposedPortModel(containerPortElements[0],
- containerPortElements[1], elements[1], elements[2]);
+ final String[] containerPortElements = elements[0].split(CONTAINER_TYPE_SEPARATOR);
+ ExposedPortModel model = new ExposedPortModel(containerPortElements[0], containerPortElements[1], elements[1],
+ elements[2]);
// check the last argument if exists otherwise assume 'true'
- model.selected = (elements.length == 4) ? Boolean.valueOf(elements[3])
- : true;
+ model.selected = (elements.length == 4) ? Boolean.valueOf(elements[3]) : true;
return model;
}
@@ -169,8 +153,7 @@ public class ExposedPortModel extends BaseDatabindingModel
}
public void setContainerPort(final String containerPort) {
- firePropertyChange(CONTAINER_PORT, this.containerPort,
- this.containerPort = containerPort);
+ firePropertyChange(CONTAINER_PORT, this.containerPort, this.containerPort = containerPort);
}
public String getPortType() {
@@ -202,8 +185,7 @@ public class ExposedPortModel extends BaseDatabindingModel
}
public void setHostAddress(final String hostAddress) {
- firePropertyChange(HOST_ADDRESS, this.hostAddress,
- this.hostAddress = hostAddress);
+ firePropertyChange(HOST_ADDRESS, this.hostAddress, this.hostAddress = hostAddress);
}
@Override
@@ -240,9 +222,8 @@ public class ExposedPortModel extends BaseDatabindingModel
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
- buffer.append(containerPort + CONTAINER_TYPE_SEPARATOR + portType
- + SEPARATOR + (hostAddress != null ? hostAddress : "")
- + SEPARATOR + hostPort + SEPARATOR + selected);
+ buffer.append(containerPort + CONTAINER_TYPE_SEPARATOR + portType + SEPARATOR
+ + (hostAddress != null ? hostAddress : "") + SEPARATOR + hostPort + SEPARATOR + selected);
return buffer.toString();
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java
index 2ba223f60e1..ff901778631 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/GdbDebuggerPage.java
@@ -60,7 +60,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
protected Button fReverseCheckBox;
protected Button fUpdateThreadlistOnSuspend;
protected Button fDebugOnFork;
-
+
/**
* A combo box to let the user choose if fast tracepoints should be used or not.
*/
@@ -78,8 +78,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
fTabFolder = new TabFolder(comp, SWT.NONE);
- fTabFolder.setLayoutData(
- new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
+ fTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
createTabs(fTabFolder);
fTabFolder.setSelection(0);
setControl(parent);
@@ -87,31 +86,20 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
- .getPreferenceStore();
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- preferenceStore.getBoolean(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
+ IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
+ preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
if (fSolibBlock != null)
@@ -132,8 +120,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
}
/** utility method to cut down on clutter */
- private String getStringAttr(ILaunchConfiguration config,
- String attributeName, String defaultValue) {
+ private String getStringAttr(ILaunchConfiguration config, String attributeName, String defaultValue) {
try {
return config.getAttribute(attributeName, defaultValue);
} catch (CoreException e) {
@@ -142,8 +129,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
}
/** utility method to cut down on clutter */
- private boolean getBooleanAttr(ILaunchConfiguration config,
- String attributeName, boolean defaultValue) {
+ private boolean getBooleanAttr(ILaunchConfiguration config, String attributeName, boolean defaultValue) {
try {
return config.getAttribute(attributeName, defaultValue);
} catch (CoreException e) {
@@ -154,22 +140,14 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
setInitializing(true);
- IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
- .getPreferenceStore();
- String gdbCommand = getStringAttr(configuration,
- IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
- String gdbInit = getStringAttr(configuration,
- IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
- boolean nonStopMode = getBooleanAttr(configuration,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- preferenceStore.getBoolean(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
- boolean reverseEnabled = getBooleanAttr(configuration,
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
+ IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
+ String gdbCommand = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
+ String gdbInit = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
+ boolean nonStopMode = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
+ preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
+ boolean reverseEnabled = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
boolean updateThreadsOnSuspend = getBooleanAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
@@ -198,17 +176,14 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
- if (tracepointMode.equals(
- IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_NORMAL_ONLY)) {
+ if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_NORMAL_ONLY)) {
fTracepointModeCombo.setText(TP_NORMAL_ONLY);
- } else if (tracepointMode.equals(
- IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY)) {
+ } else if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY)) {
fTracepointModeCombo.setText(TP_FAST_ONLY);
- } else if (tracepointMode.equals(
- IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL)) {
+ } else if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL)) {
fTracepointModeCombo.setText(TP_AUTOMATIC);
} else {
- assert false : "Unknown Tracepoint Mode: " + tracepointMode; // //$NON-NLS-1$
+ assert false : "Unknown Tracepoint Mode: " + tracepointMode; // //$NON-NLS-1$
fTracepointModeCombo.setText(TP_NORMAL_ONLY);
}
}
@@ -217,14 +192,11 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
protected String getSelectedTracepointMode() {
if (fTracepointModeCombo != null) {
int selectedIndex = fTracepointModeCombo.getSelectionIndex();
- if (fTracepointModeCombo.getItem(selectedIndex)
- .equals(TP_NORMAL_ONLY)) {
+ if (fTracepointModeCombo.getItem(selectedIndex).equals(TP_NORMAL_ONLY)) {
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_NORMAL_ONLY;
- } else if (fTracepointModeCombo.getItem(selectedIndex)
- .equals(TP_FAST_ONLY)) {
+ } else if (fTracepointModeCombo.getItem(selectedIndex).equals(TP_FAST_ONLY)) {
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY;
- } else if (fTracepointModeCombo.getItem(selectedIndex)
- .equals(TP_AUTOMATIC)) {
+ } else if (fTracepointModeCombo.getItem(selectedIndex).equals(TP_AUTOMATIC)) {
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL;
} else {
assert false : "Unknown Tracepoint mode: " //$NON-NLS-1$
@@ -236,28 +208,19 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- fGDBCommandText.getText().trim());
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- fGDBInitText.getText().trim());
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, fGDBCommandText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, fGDBInitText.getText().trim());
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
fNonStopCheckBox.getSelection());
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
fReverseCheckBox.getSelection());
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
fUpdateThreadlistOnSuspend.getSelection());
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
fDebugOnFork.getSelection());
if (fTracepointModeCombo != null) {
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
getSelectedTracepointMode());
}
@@ -288,7 +251,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
/*
* (non-Javadoc)
- *
+ *
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
@Override
@@ -298,8 +261,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
}
public IMILaunchConfigurationComponent createSolibBlock(Composite parent) {
- IMILaunchConfigurationComponent block = new GDBSolibBlock(
- new SolibSearchPathBlock(), true, true);
+ IMILaunchConfigurationComponent block = new GDBSolibBlock(new SolibSearchPathBlock(), true, true);
block.createControl(parent);
return block;
}
@@ -312,22 +274,18 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
public void createMainTab(TabFolder tabFolder) {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(Messages.GDBDebuggerPage_main_tab_name);
- Composite comp = ControlFactory.createCompositeEx(tabFolder, 1,
- GridData.FILL_BOTH);
+ Composite comp = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
comp.setFont(tabFolder.getFont());
tabItem.setControl(comp);
- Composite subComp = ControlFactory.createCompositeEx(comp, 3,
- GridData.FILL_HORIZONTAL);
+ Composite subComp = ControlFactory.createCompositeEx(comp, 3, GridData.FILL_HORIZONTAL);
((GridLayout) subComp.getLayout()).makeColumnsEqualWidth = false;
subComp.setFont(tabFolder.getFont());
- Label label = ControlFactory.createLabel(subComp,
- Messages.GDBDebuggerPage_gdb_debugger);
+ Label label = ControlFactory.createLabel(subComp, Messages.GDBDebuggerPage_gdb_debugger);
GridData gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData(gd);
- fGDBCommandText = ControlFactory.createTextField(subComp,
- SWT.SINGLE | SWT.BORDER);
+ fGDBCommandText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
fGDBCommandText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
@@ -335,8 +293,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
updateLaunchConfigurationDialog();
}
});
- Button button = createPushButton(subComp,
- Messages.GDBDebuggerPage_gdb_browse, null);
+ Button button = createPushButton(subComp, Messages.GDBDebuggerPage_gdb_browse, null);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
@@ -368,13 +325,11 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
fGDBCommandText.setText(res);
}
});
- label = ControlFactory.createLabel(subComp,
- Messages.GDBDebuggerPage_gdb_command_file);
+ label = ControlFactory.createLabel(subComp, Messages.GDBDebuggerPage_gdb_command_file);
gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData(gd);
- fGDBInitText = ControlFactory.createTextField(subComp,
- SWT.SINGLE | SWT.BORDER);
+ fGDBInitText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBInitText.setLayoutData(gd);
fGDBInitText.addModifyListener(new ModifyListener() {
@@ -384,8 +339,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
updateLaunchConfigurationDialog();
}
});
- button = createPushButton(subComp,
- Messages.GDBDebuggerPage_gdb_cmdfile_browse, null);
+ button = createPushButton(subComp, Messages.GDBDebuggerPage_gdb_cmdfile_browse, null);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
@@ -399,8 +353,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
- dialog.setFilterPath(
- gdbCommand.substring(0, lastSeparatorIndex));
+ dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
@@ -410,9 +363,8 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
}
});
- label = ControlFactory.createLabel(subComp,
- Messages.GDBDebuggerPage_cmdfile_warning,
- 200, SWT.DEFAULT, SWT.WRAP);
+ label = ControlFactory.createLabel(subComp, Messages.GDBDebuggerPage_cmdfile_warning, 200, SWT.DEFAULT,
+ SWT.WRAP);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
@@ -421,23 +373,17 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
// TODO: Ideally, this field should be disabled if the back-end doesn't support non-stop debugging
// TODO: Find a way to determine if non-stop is supported (i.e. find the GDB version) then grey out the check box if necessary
- fNonStopCheckBox = addCheckbox(subComp,
- Messages.GDBDebuggerPage_nonstop_mode);
+ fNonStopCheckBox = addCheckbox(subComp, Messages.GDBDebuggerPage_nonstop_mode);
// TODO: Ideally, this field should be disabled if the back-end doesn't support reverse debugging
// TODO: Find a way to determine if reverse is supported (i.e. find the GDB version) then grey out the check box if necessary
- fReverseCheckBox = addCheckbox(subComp,
- Messages.GDBDebuggerPage_reverse_Debugging);
- fUpdateThreadlistOnSuspend = addCheckbox(subComp,
- Messages.GDBDebuggerPage_update_thread_list_on_suspend);
+ fReverseCheckBox = addCheckbox(subComp, Messages.GDBDebuggerPage_reverse_Debugging);
+ fUpdateThreadlistOnSuspend = addCheckbox(subComp, Messages.GDBDebuggerPage_update_thread_list_on_suspend);
// This checkbox needs an explanation. Attach context help to it.
- PlatformUI.getWorkbench().getHelpSystem().setHelp(
- fUpdateThreadlistOnSuspend,
- GdbUIPlugin.PLUGIN_ID
- + ".update_threadlist_button_context"); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateThreadlistOnSuspend,
+ GdbUIPlugin.PLUGIN_ID + ".update_threadlist_button_context"); //$NON-NLS-1$
- fDebugOnFork = addCheckbox(subComp,
- Messages.GDBDebuggerPage_Automatically_debug_forked_processes);
+ fDebugOnFork = addCheckbox(subComp, Messages.GDBDebuggerPage_Automatically_debug_forked_processes);
createTracepointModeCombo(subComp);
}
@@ -460,13 +406,11 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
protected void createTracepointModeCombo(Composite parent) {
// Add a combo to choose the type of tracepoint mode to use
- Label label = ControlFactory.createLabel(parent,
- Messages.GDBDebuggerPage_tracepoint_mode_label);
+ Label label = ControlFactory.createLabel(parent, Messages.GDBDebuggerPage_tracepoint_mode_label);
label.setLayoutData(new GridData());
fTracepointModeCombo = new Combo(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
- fTracepointModeCombo.setLayoutData(
- new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
+ fTracepointModeCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
fTracepointModeCombo.add(TP_NORMAL_ONLY);
fTracepointModeCombo.add(TP_FAST_ONLY);
fTracepointModeCombo.add(TP_AUTOMATIC);
@@ -487,8 +431,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
public void createSolibTab(TabFolder tabFolder) {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(Messages.GDBDebuggerPage10);
- Composite comp = ControlFactory.createCompositeEx(fTabFolder, 1,
- GridData.FILL_BOTH);
+ Composite comp = ControlFactory.createCompositeEx(fTabFolder, 1, GridData.FILL_BOTH);
comp.setFont(tabFolder.getFont());
tabItem.setControl(comp);
fSolibBlock = createSolibBlock(comp);
@@ -498,7 +441,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/
@Override
@@ -513,7 +456,7 @@ public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug
* .core.ILaunchConfigurationWorkingCopy)
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ILaunchConstants.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ILaunchConstants.java
index f28979ca4dd..62dc1b902b0 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ILaunchConstants.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ILaunchConstants.java
@@ -18,35 +18,26 @@ import org.eclipse.debug.core.DebugPlugin;
public interface ILaunchConstants {
- public final static String LAUNCH_ID = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".launchConfigurationType"; //$NON-NLS-1$
+ public final static String LAUNCH_ID = DockerLaunchUIPlugin.getUniqueIdentifier() + ".launchConfigurationType"; //$NON-NLS-1$
- public final static String ATTR_ADDITIONAL_DIRS = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".additional_dirs"; //$NON-NLS-1$
+ public final static String ATTR_ADDITIONAL_DIRS = DockerLaunchUIPlugin.getUniqueIdentifier() + ".additional_dirs"; //$NON-NLS-1$
- public final static String ATTR_EXPOSED_PORTS = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".exposed_ports"; //$NON-NLS-1$
+ public final static String ATTR_EXPOSED_PORTS = DockerLaunchUIPlugin.getUniqueIdentifier() + ".exposed_ports"; //$NON-NLS-1$
- public final static String ATTR_IMAGE = DockerLaunchUIPlugin.getUniqueIdentifier()
- + ".image"; //$NON-NLS-1$
+ public final static String ATTR_IMAGE = DockerLaunchUIPlugin.getUniqueIdentifier() + ".image"; //$NON-NLS-1$
- public final static String ATTR_CONNECTION_URI = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".connection_uri"; //$NON-NLS-1$
+ public final static String ATTR_CONNECTION_URI = DockerLaunchUIPlugin.getUniqueIdentifier() + ".connection_uri"; //$NON-NLS-1$
- public final static String ATTR_KEEP_AFTER_LAUNCH = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".keep_after_launch"; //$NON-NLS-1$
+ public final static String ATTR_KEEP_AFTER_LAUNCH = DockerLaunchUIPlugin.getUniqueIdentifier()
+ + ".keep_after_launch"; //$NON-NLS-1$
- public final static String ATTR_STDIN_SUPPORT = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".support_std_input"; //$NON-NLS-1$
+ public final static String ATTR_STDIN_SUPPORT = DockerLaunchUIPlugin.getUniqueIdentifier() + ".support_std_input"; //$NON-NLS-1$
- public final static String ATTR_PRIVILEGED_MODE = DockerLaunchUIPlugin
- .getUniqueIdentifier() + ".privileged_mode"; //$NON-NLS-1$
+ public final static String ATTR_PRIVILEGED_MODE = DockerLaunchUIPlugin.getUniqueIdentifier() + ".privileged_mode"; //$NON-NLS-1$
// Attributes that need to match CDT attribute names
- public static final String ATTR_GDBSERVER_PORT = DebugPlugin
- .getUniqueIdentifier() + ".ATTR_GDBSERVER_PORT"; //$NON-NLS-1$
- public static final String ATTR_GDBSERVER_COMMAND = DebugPlugin
- .getUniqueIdentifier() + ".ATTR_GDBSERVER_COMMAND"; //$NON-NLS-1$
+ public static final String ATTR_GDBSERVER_PORT = DebugPlugin.getUniqueIdentifier() + ".ATTR_GDBSERVER_PORT"; //$NON-NLS-1$
+ public static final String ATTR_GDBSERVER_COMMAND = DebugPlugin.getUniqueIdentifier() + ".ATTR_GDBSERVER_COMMAND"; //$NON-NLS-1$
public static final String ATTR_GDBSERVER_PORT_DEFAULT = "2345"; //$NON-NLS-1$
public static final String ATTR_GDBSERVER_COMMAND_DEFAULT = "gdbserver"; //$NON-NLS-1$
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java
index 34a9751681e..f40abf34413 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/LaunchShortcut.java
@@ -96,17 +96,16 @@ public class LaunchShortcut implements ILaunchShortcut {
/**
* Method getLaunchConfigType.
- *
+ *
* @return ILaunchConfigurationType
*/
protected ILaunchConfigurationType getLaunchConfigType() {
- return getLaunchManager()
- .getLaunchConfigurationType(ILaunchConstants.LAUNCH_ID);
+ return getLaunchManager().getLaunchConfigurationType(ILaunchConstants.LAUNCH_ID);
}
/**
* Search and launch binary.
- *
+ *
* @param elements
* Binaries to search.
* @param mode
@@ -119,31 +118,22 @@ public class LaunchShortcut implements ILaunchShortcut {
bin = (IBinary) elements[0];
} else {
final List<IBinary> results = new ArrayList<>();
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(
- getActiveWorkbenchShell());
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(getActiveWorkbenchShell());
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
- public void run(IProgressMonitor pm)
- throws InterruptedException {
+ public void run(IProgressMonitor pm) throws InterruptedException {
int nElements = elements.length;
- pm.beginTask(
- Messages.LaunchShortcut_Looking_for_executables,
- nElements);
+ pm.beginTask(Messages.LaunchShortcut_Looking_for_executables, nElements);
try {
IProgressMonitor sub = new SubProgressMonitor(pm, 1);
for (int i = 0; i < nElements; i++) {
if (elements[i] instanceof IAdaptable) {
- IResource r = (IResource) ((IAdaptable) elements[i])
- .getAdapter(IResource.class);
+ IResource r = (IResource) ((IAdaptable) elements[i]).getAdapter(IResource.class);
if (r != null) {
- ICProject cproject = CoreModel
- .getDefault().create(
- r.getProject());
+ ICProject cproject = CoreModel.getDefault().create(r.getProject());
if (cproject != null) {
try {
- IBinary[] bins = cproject
- .getBinaryContainer()
- .getBinaries();
+ IBinary[] bins = cproject.getBinaryContainer().getBinaries();
for (IBinary bin : bins) {
if (bin.isExecutable()) {
@@ -194,7 +184,7 @@ public class LaunchShortcut implements ILaunchShortcut {
/**
* Prompts the user to select a binary
- *
+ *
* @param binList
* The list of binaries.
* @param mode
@@ -219,8 +209,7 @@ public class LaunchShortcut implements ILaunchShortcut {
if (element instanceof IBinary) {
IBinary bin = (IBinary) element;
StringBuilder name = new StringBuilder();
- name.append(bin.getCPU()
- + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$
+ name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$
name.append(" - "); //$NON-NLS-1$
name.append(bin.getPath().toString());
return name.toString();
@@ -229,8 +218,7 @@ public class LaunchShortcut implements ILaunchShortcut {
}
};
- TwoPaneElementSelector dialog = new TwoPaneElementSelector(
- getActiveWorkbenchShell(), programLabelProvider,
+ TwoPaneElementSelector dialog = new TwoPaneElementSelector(getActiveWorkbenchShell(), programLabelProvider,
qualifierLabelProvider);
dialog.setElements(binList.toArray());
dialog.setTitle(Messages.LaunchShortcut_Launcher);
@@ -246,14 +234,13 @@ public class LaunchShortcut implements ILaunchShortcut {
}
protected void handleFail(String message) {
- MessageDialog.openError(getActiveWorkbenchShell(),
- Messages.LaunchShortcut_Launcher, message);
+ MessageDialog.openError(getActiveWorkbenchShell(), Messages.LaunchShortcut_Launcher, message);
}
/**
* Locate a configuration to launch for the given type. If one cannot be
* found, create one.
- *
+ *
* @param bin
* The binary to look launch for.
* @param mode
@@ -261,8 +248,7 @@ public class LaunchShortcut implements ILaunchShortcut {
*
* @return A re-useable config or <code>null</code> if none.
*/
- protected ILaunchConfiguration findLaunchConfiguration(IBinary bin,
- String mode) {
+ protected ILaunchConfiguration findLaunchConfiguration(IBinary bin, String mode) {
ILaunchConfiguration configuration = null;
ILaunchConfigurationType configType = getLaunchConfigType();
List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
@@ -275,33 +261,25 @@ public class LaunchShortcut implements ILaunchShortcut {
cbcfg = buildConfig.getAdapter(ICBuildConfiguration.class);
if (cbcfg != null) {
IToolChain toolChain = cbcfg.getToolChain();
- connectionUri = toolChain.getProperty(
- IContainerLaunchTarget.ATTR_CONNECTION_URI);
- imageName = toolChain
- .getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
+ connectionUri = toolChain.getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
+ imageName = toolChain.getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
}
} catch (CoreException e1) {
// do nothing
}
if (cbcfg == null) {
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(project).getActiveConfiguration();
+ ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
+ .getActiveConfiguration();
if (cfgd != null) {
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
if (cfg != null) {
- IOptionalBuildProperties props = cfg
- .getOptionalBuildProperties();
- String containerBuild = props.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
+ String containerBuild = props.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (containerBuild != null) {
- boolean containerBuildEnabled = Boolean
- .parseBoolean(containerBuild);
+ boolean containerBuildEnabled = Boolean.parseBoolean(containerBuild);
if (containerBuildEnabled) {
- connectionUri = props.getProperty(
- ContainerCommandLauncher.CONNECTION_ID);
- imageName = props.getProperty(
- ContainerCommandLauncher.IMAGE_ID);
+ connectionUri = props.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ imageName = props.getProperty(ContainerCommandLauncher.IMAGE_ID);
}
}
}
@@ -309,12 +287,10 @@ public class LaunchShortcut implements ILaunchShortcut {
}
if (connectionUri == null) {
- IDockerConnection[] connections = DockerConnectionManager
- .getInstance().getConnections();
+ IDockerConnection[] connections = DockerConnectionManager.getInstance().getConnections();
if (connections != null && connections.length > 0) {
connectionUri = connections[0].getUri();
- Preferences prefs = InstanceScope.INSTANCE
- .getNode(DockerLaunchUIPlugin.PLUGIN_ID);
+ Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
imageName = prefs.get(PreferenceConstants.DEFAULT_IMAGE, null);
if (imageName == null) {
List<IDockerImage> images = connections[0].getImages();
@@ -325,38 +301,30 @@ public class LaunchShortcut implements ILaunchShortcut {
}
try {
- ILaunchConfiguration[] configs = DebugPlugin.getDefault()
- .getLaunchManager().getLaunchConfigurations(configType);
+ ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
+ .getLaunchConfigurations(configType);
candidateConfigs = new ArrayList<>(configs.length);
for (ILaunchConfiguration config : configs) {
IPath programPath = CDebugUtils.getProgramPath(config);
String projectName = CDebugUtils.getProjectName(config);
IPath binPath = bin.getResource().getProjectRelativePath();
- if (projectName != null && projectName
- .equals(bin.getCProject().getProject().getName())) {
+ if (projectName != null && projectName.equals(bin.getCProject().getProject().getName())) {
if (programPath != null) {
if (programPath.equals(binPath)) {
// if we have an active configuration with container
// build properties, make sure they match, otherwise
// add the launch config as a candidate
- if (connectionUri != null
- && connectionUri.equals(config.getAttribute(
- ILaunchConstants.ATTR_CONNECTION_URI,
- (String) null))) {
- if (imageName != null
- && imageName.equals(config.getAttribute(
- ILaunchConstants.ATTR_IMAGE,
- (String) null))) {
+ if (connectionUri != null && connectionUri
+ .equals(config.getAttribute(ILaunchConstants.ATTR_CONNECTION_URI, (String) null))) {
+ if (imageName != null && imageName
+ .equals(config.getAttribute(ILaunchConstants.ATTR_IMAGE, (String) null))) {
candidateConfigs.add(config);
}
}
}
} else if (cbcfg != null && candidateConfigs.isEmpty()) {
- ILaunchConfigurationWorkingCopy wc = config
- .getWorkingCopy();
- populateLaunchConfiguration(wc, mode, bin,
- projectName,
- connectionUri, imageName);
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ populateLaunchConfiguration(wc, mode, bin, projectName, connectionUri, imageName);
wc.doSave();
candidateConfigs.add(config);
break;
@@ -388,53 +356,39 @@ public class LaunchShortcut implements ILaunchShortcut {
return configuration;
}
- private void populateLaunchConfiguration(ILaunchConfigurationWorkingCopy wc,
- String mode, IBinary bin, String projectName, String connectionUri,
- String imageName) {
+ private void populateLaunchConfiguration(ILaunchConfigurationWorkingCopy wc, String mode, IBinary bin,
+ String projectName, String connectionUri, String imageName) {
// DSF settings...use GdbUIPlugin preference store for defaults
- IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- preferenceStore.getBoolean(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
+ preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
bin.getResource().getProjectRelativePath().toString());
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- projectName);
- wc.setMappedResources(new IResource[] { bin.getResource(),
- bin.getResource().getProject() });
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- (String) null); // default is the project directory
-
- Preferences prefs = InstanceScope.INSTANCE
- .getNode(DockerLaunchUIPlugin.PLUGIN_ID);
-
- Boolean keepPref = prefs.getBoolean(
- PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
+ wc.setMappedResources(new IResource[] { bin.getResource(), bin.getResource().getProject() });
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null); // default is the project directory
+
+ Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
+
+ Boolean keepPref = prefs.getBoolean(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
wc.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, keepPref);
// For Debug mode we need to set gdbserver info as well
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- wc.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND,
- "gdbserver"); //$NON-NLS-1$
+ wc.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND, "gdbserver"); //$NON-NLS-1$
wc.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, "2345"); //$NON-NLS-1$
}
wc.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, connectionUri);
@@ -452,8 +406,7 @@ public class LaunchShortcut implements ILaunchShortcut {
* resource, and false if it should not be saved.
* @return a launch configuration generated for the binary.
*/
- protected ILaunchConfiguration createConfiguration(IBinary bin,
- String mode, boolean save) {
+ protected ILaunchConfiguration createConfiguration(IBinary bin, String mode, boolean save) {
ILaunchConfiguration config = null;
try {
IProject project = bin.getResource().getProject();
@@ -462,54 +415,39 @@ public class LaunchShortcut implements ILaunchShortcut {
String connectionId = null;
String imageName = null;
IBuildConfiguration buildConfig = project.getActiveBuildConfig();
- ICBuildConfiguration cbuildcfg = buildConfig
- .getAdapter(ICBuildConfiguration.class);
+ ICBuildConfiguration cbuildcfg = buildConfig.getAdapter(ICBuildConfiguration.class);
if (cbuildcfg != null) {
IToolChain toolChain = cbuildcfg.getToolChain();
- connectionId = toolChain.getProperty(
- IContainerLaunchTarget.ATTR_CONNECTION_URI);
- imageName = toolChain
- .getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
+ connectionId = toolChain.getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
+ imageName = toolChain.getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
} else {
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(project)
+ ICConfigurationDescription cfgd = CoreModel.getDefault().getProjectDescription(project)
.getActiveConfiguration();
- IConfiguration cfg = ManagedBuildManager
- .getConfigurationForDescription(cfgd);
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
- IOptionalBuildProperties options = cfg
- .getOptionalBuildProperties();
+ IOptionalBuildProperties options = cfg.getOptionalBuildProperties();
if (options != null) {
- String containerBuildString = options.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ String containerBuildString = options.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
if (containerBuildString != null) {
containerBuild = Boolean
- .parseBoolean(options.getProperty(
- ContainerCommandLauncher.CONTAINER_BUILD_ENABLED));
+ .parseBoolean(options.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED));
}
if (containerBuild) {
- connectionId = options.getProperty(
- ContainerCommandLauncher.CONNECTION_ID);
- imageName = options
- .getProperty(ContainerCommandLauncher.IMAGE_ID);
+ connectionId = options.getProperty(ContainerCommandLauncher.CONNECTION_ID);
+ imageName = options.getProperty(ContainerCommandLauncher.IMAGE_ID);
}
}
}
ILaunchConfigurationType configType = getLaunchConfigType();
- ILaunchConfigurationWorkingCopy wc = configType.newInstance(
- null,
+ ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
getLaunchManager().generateLaunchConfigurationName(
- bin.getResource().getName() + (imageName != null
- ? ("[" + imageName + "]") //$NON-NLS-1$ //$NON-NLS-2$
+ bin.getResource().getName() + (imageName != null ? ("[" + imageName + "]") //$NON-NLS-1$ //$NON-NLS-2$
: ""))); //$NON-NLS-1$
-
-
- Preferences prefs = InstanceScope.INSTANCE
- .getNode(DockerLaunchUIPlugin.PLUGIN_ID);
+ Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
// get the connection using following order:
// 1. connection used in build of project
@@ -517,16 +455,13 @@ public class LaunchShortcut implements ILaunchShortcut {
// 3. first connection
IDockerConnection connection = null;
if (connectionId != null) {
- connection = DockerConnectionManager.getInstance()
- .getConnectionByUri(connectionId);
+ connection = DockerConnectionManager.getInstance().getConnectionByUri(connectionId);
}
if (connection == null) {
- connection = ConnectionListener.getInstance()
- .getCurrentConnection();
+ connection = ConnectionListener.getInstance().getCurrentConnection();
}
if (connection == null) {
- IDockerConnection[] connections = DockerConnectionManager
- .getInstance().getConnections();
+ IDockerConnection[] connections = DockerConnectionManager.getInstance().getConnections();
if (connections != null && connections.length > 0)
connection = connections[0];
}
@@ -536,17 +471,14 @@ public class LaunchShortcut implements ILaunchShortcut {
@Override
public void run() {
- MessageDialog.openError(
- Display.getCurrent().getActiveShell(),
- Messages.LaunchShortcut_Error_Launching,
- Messages.LaunchShortcut_No_Connections);
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),
+ Messages.LaunchShortcut_Error_Launching, Messages.LaunchShortcut_No_Connections);
}
});
return null;
}
-
// use build image if one is specified, otherwise, see if a default
// image is set in preferences, otherwise find first image in image
// list
@@ -567,18 +499,15 @@ public class LaunchShortcut implements ILaunchShortcut {
@Override
public void run() {
- MessageDialog.openError(
- Display.getCurrent().getActiveShell(),
- Messages.LaunchShortcut_Error_Launching,
- Messages.LaunchShortcut_No_Images);
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),
+ Messages.LaunchShortcut_Error_Launching, Messages.LaunchShortcut_No_Images);
}
});
return null;
}
- populateLaunchConfiguration(wc, mode, bin, project.getName(),
- connection.getUri(), image);
+ populateLaunchConfiguration(wc, mode, bin, project.getName(), connection.getUri(), image);
if (save) {
config = wc.doSave();
@@ -598,7 +527,7 @@ public class LaunchShortcut implements ILaunchShortcut {
/**
* Show a selection dialog that allows the user to choose one of the
* specified launch configurations.
- *
+ *
* @param configList
* The list of launch configurations to choose from.
* @param mode
@@ -606,12 +535,9 @@ public class LaunchShortcut implements ILaunchShortcut {
* @return The chosen config, or <code>null</code> if the user cancelled the
* dialog.
*/
- protected ILaunchConfiguration chooseConfiguration(
- List<ILaunchConfiguration> configList, String mode) {
- IDebugModelPresentation labelProvider = DebugUITools
- .newDebugModelPresentation();
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(
- getActiveWorkbenchShell(), labelProvider);
+ protected ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configList, String mode) {
+ IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getActiveWorkbenchShell(), labelProvider);
dialog.setElements(configList.toArray());
dialog.setTitle(Messages.LaunchShortcut_Launch_Configuration_Selection);
dialog.setMessage(Messages.LaunchShortcut_Choose_a_launch_configuration);
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java
index 2ac47015ae9..3d2565222d2 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java
@@ -72,7 +72,7 @@ public class Messages extends NLS {
public static String Port_number_textfield_label;
public static String Gdbserver_start;
public static String Gdbserver_up;
-
+
public static String GDBDebuggerPage0;
public static String GDBDebuggerPage1;
public static String GDBDebuggerPage2;
@@ -86,7 +86,7 @@ public class Messages extends NLS {
public static String GDBDebuggerPage10;
public static String GDBDebuggerPage11;
public static String GDBDebuggerPage12;
-
+
public static String GDBDebuggerPage_gdb_executable_not_specified;
public static String GDBDebuggerPage_tab_name;
public static String GDBDebuggerPage_main_tab_name;
@@ -106,7 +106,7 @@ public class Messages extends NLS {
public static String GDBDebuggerPage_tracepoint_mode_fast;
public static String GDBDebuggerPage_tracepoint_mode_normal;
public static String GDBDebuggerPage_tracepoint_mode_auto;
-
+
public static String StandardGDBDebuggerPage14;
public static String ContainerPropertyTab_Title;
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java
index 771fcc3ca08..9b6f3f70623 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerPage.java
@@ -1,16 +1,16 @@
/*******************************************************************************
* Copyright (c) 2006, 2018 PalmSource, Inc. and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
* Ewa Matejska (PalmSource)
- *
+ *
* Referenced GDBDebuggerPage code to write this.
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.tabs
* Red Hat Inc. - modified to work with CDT Container Launcher
@@ -62,13 +62,10 @@ public class RemoteDebuggerPage extends GdbDebuggerPage {
super.setDefaults(configuration);
configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND,
ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
- configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT,
- ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED,
+ configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED,
LaunchUtils.getRemoteTimeoutEnabledDefault());
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE,
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE,
LaunchUtils.getRemoteTimeoutValueDefault());
}
@@ -80,14 +77,12 @@ public class RemoteDebuggerPage extends GdbDebuggerPage {
boolean remoteTimeoutEnabled = false;
String remoteTimeoutValue = null;
try {
- gdbserverCommand = configuration.getAttribute(
- ILaunchConstants.ATTR_GDBSERVER_COMMAND,
+ gdbserverCommand = configuration.getAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND,
ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
} catch (CoreException e) {
}
try {
- gdbserverPortNumber = configuration.getAttribute(
- ILaunchConstants.ATTR_GDBSERVER_PORT,
+ gdbserverPortNumber = configuration.getAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT,
ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
} catch (CoreException e) {
}
@@ -115,20 +110,15 @@ public class RemoteDebuggerPage extends GdbDebuggerPage {
super.performApply(configuration);
String str = fGDBServerCommandText.getText();
str.trim();
- configuration
- .setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND, str);
+ configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND, str);
str = fGDBServerPortNumberText.getText();
str.trim();
configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, str);
boolean b = fRemoteTimeoutEnabledCheckbox.getSelection();
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED,
- b);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, b);
str = fRemoteTimeoutValueText.getText();
str.trim();
- configuration.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE,
- str);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, str);
}
protected void createGdbserverSettingsTab(TabFolder tabFolder) {
@@ -178,27 +168,22 @@ public class RemoteDebuggerPage extends GdbDebuggerPage {
});
fRemoteTimeoutEnabledCheckbox = new Button(subComp, SWT.CHECK);
- fRemoteTimeoutEnabledCheckbox
- .setText(Messages.Gdbserver_Settings_Remotetimeout_label);
- fRemoteTimeoutEnabledCheckbox
- .setToolTipText(
- Messages.Gdbserver_Settings_Remotetimeout_tooltip);
+ fRemoteTimeoutEnabledCheckbox.setText(Messages.Gdbserver_Settings_Remotetimeout_label);
+ fRemoteTimeoutEnabledCheckbox.setToolTipText(Messages.Gdbserver_Settings_Remotetimeout_tooltip);
gd = new GridData();
fRemoteTimeoutEnabledCheckbox.setLayoutData(gd);
- fRemoteTimeoutEnabledCheckbox
- .addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- remoteTimeoutEnabledChanged();
- updateLaunchConfigurationDialog();
- }
- });
+ fRemoteTimeoutEnabledCheckbox.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ remoteTimeoutEnabledChanged();
+ updateLaunchConfigurationDialog();
+ }
+ });
fRemoteTimeoutValueText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
data = new GridData(SWT.FILL, SWT.TOP, true, false);
fRemoteTimeoutValueText.setLayoutData(data);
- fRemoteTimeoutValueText.setToolTipText(
- Messages.Gdbserver_Settings_Remotetimeout_tooltip);
+ fRemoteTimeoutValueText.setToolTipText(Messages.Gdbserver_Settings_Remotetimeout_tooltip);
fRemoteTimeoutValueText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -209,13 +194,12 @@ public class RemoteDebuggerPage extends GdbDebuggerPage {
}
private void remoteTimeoutEnabledChanged() {
- fRemoteTimeoutValueText
- .setEnabled(fRemoteTimeoutEnabledCheckbox.getSelection());
+ fRemoteTimeoutValueText.setEnabled(fRemoteTimeoutEnabledCheckbox.getSelection());
}
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createTabs(org.eclipse
* .swt.widgets.TabFolder)
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerTab.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerTab.java
index 1f5a9fa5524..35ab0ff106f 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerTab.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/RemoteDebuggerTab.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Anna Dushistova (Mentor Graphics) - initial API and implementation
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.tabs
@@ -78,8 +78,7 @@ public class RemoteDebuggerTab extends CDebuggerTab {
return;
}
// Ask the dynamic UI to create its Control
- debuggerPage
- .setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+ debuggerPage.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
debuggerPage.createControl(dynamicTabHolder);
debuggerPage.getControl().setVisible(true);
dynamicTabHolder.layout(true);
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/SWTImagesFactory.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/SWTImagesFactory.java
index 4be09c46143..f05af735723 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/SWTImagesFactory.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/SWTImagesFactory.java
@@ -24,9 +24,7 @@ import org.eclipse.swt.graphics.Image;
public class SWTImagesFactory {
// The plug-in registry
- private static ImageRegistry imageRegistry = DockerLaunchUIPlugin
- .getDefault()
- .getImageRegistry();
+ private static ImageRegistry imageRegistry = DockerLaunchUIPlugin.getDefault().getImageRegistry();
// Sub-directory (under the package containing this class) where 16 color
// images are
@@ -34,43 +32,33 @@ public class SWTImagesFactory {
static {
try {
- fgIconBaseURL = new URL(
- DockerLaunchUIPlugin.getDefault().getBundle()
- .getEntry("/"), "icons/"); //$NON-NLS-1$ //$NON-NLS-2$
+ fgIconBaseURL = new URL(DockerLaunchUIPlugin.getDefault().getBundle().getEntry("/"), "icons/"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (MalformedURLException e) {
DockerLaunchUIPlugin.log(e);
}
}
- private static final String NAME_PREFIX = DockerLaunchUIPlugin.PLUGIN_ID
- + '.';
+ private static final String NAME_PREFIX = DockerLaunchUIPlugin.PLUGIN_ID + '.';
private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
- public static final String IMG_CONTAINER = NAME_PREFIX
- + "repository-middle.gif"; //$NON-NLS-1$
- public static final String IMG_FOLDER_CLOSED = NAME_PREFIX
- + "folder_closed.gif"; //$NON-NLS-1$
+ public static final String IMG_CONTAINER = NAME_PREFIX + "repository-middle.gif"; //$NON-NLS-1$
+ public static final String IMG_FOLDER_CLOSED = NAME_PREFIX + "folder_closed.gif"; //$NON-NLS-1$
public static final String IMG_FILE = NAME_PREFIX + "file_obj.gif"; //$NON-NLS-1$
public static final String IMG_WARNING = NAME_PREFIX + "warning_obj.gif"; //$NON-NLS-1$
public static final String IMG_ERROR = NAME_PREFIX + "error_obj.gif"; //$NON-NLS-1$
- public static final ImageDescriptor DESC_CONTAINER = createManaged("",
- IMG_CONTAINER);
- public static final ImageDescriptor DESC_FOLDER_CLOSED = createManaged("",
- IMG_FOLDER_CLOSED);
+ public static final ImageDescriptor DESC_CONTAINER = createManaged("", IMG_CONTAINER);
+ public static final ImageDescriptor DESC_FOLDER_CLOSED = createManaged("", IMG_FOLDER_CLOSED);
public static final ImageDescriptor DESC_FILE = createManaged("", IMG_FILE);
- public static final ImageDescriptor DESC_WARNING = createManaged("",
- IMG_WARNING);
- public static final ImageDescriptor DESC_ERROR = createManaged("",
- IMG_ERROR);
+ public static final ImageDescriptor DESC_WARNING = createManaged("", IMG_WARNING);
+ public static final ImageDescriptor DESC_ERROR = createManaged("", IMG_ERROR);
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
}
- private static ImageDescriptor createManaged(ImageRegistry registry,
- String prefix, String name) {
- ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(
- prefix, name.substring(NAME_PREFIX_LENGTH)));
+ private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
+ ImageDescriptor result = ImageDescriptor
+ .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
registry.put(name, result);
return result;
}
@@ -96,7 +84,7 @@ public class SWTImagesFactory {
/**
* Sets all available image descriptors for the given action.
- *
+ *
* @param action
* to set descriptor for
* @param type
@@ -104,8 +92,7 @@ public class SWTImagesFactory {
* @param relPath
* relative path
*/
- public static void setImageDescriptors(IAction action, String type,
- String relPath) {
+ public static void setImageDescriptors(IAction action, String type, String relPath) {
if (relPath.startsWith(NAME_PREFIX))
relPath = relPath.substring(NAME_PREFIX_LENGTH);
action.setDisabledImageDescriptor(create("d" + type, relPath)); //$NON-NLS-1$
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java
index ecc575c0610..dceb3f3a1e6 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Red Hat Inc. - modified for use in Container build
*******************************************************************************/
@@ -64,11 +64,10 @@ import org.eclipse.linuxtools.docker.ui.Activator;
/**
* The Container GCC toolchain. It represents a GCC that will run in a Docker
* Container. It can be overridden to change environment variable settings.
- *
+ *
* @since 1.2
*/
-public class ContainerGCCToolChain extends PlatformObject
- implements IToolChain, IToolChain2 {
+public class ContainerGCCToolChain extends PlatformObject implements IToolChain, IToolChain2 {
public static final String TYPE_ID = "org.eclipse.cdt.docker.launcher.gcc"; //$NON-NLS-1$
@@ -82,9 +81,7 @@ public class ContainerGCCToolChain extends PlatformObject
private String cppCommand;
private String[] commands;
-
- public ContainerGCCToolChain(String id, IToolChainProvider provider,
- Map<String, String> properties,
+ public ContainerGCCToolChain(String id, IToolChainProvider provider, Map<String, String> properties,
IEnvironmentVariable[] envVars) {
this.provider = provider;
this.path = new File("/usr/bin/gcc").toPath(); //$NON-NLS-1$
@@ -171,7 +168,7 @@ public class ContainerGCCToolChain extends PlatformObject
public void setProperty(String key, String value) {
properties.put(key, value);
}
-
+
@Override
public String getBinaryParserId() {
return CCorePlugin.PLUGIN_ID + ".ELF"; //$NON-NLS-1$
@@ -185,9 +182,9 @@ public class ContainerGCCToolChain extends PlatformObject
}
@Override
- synchronized public IExtendedScannerInfo getScannerInfo(
- IBuildConfiguration buildConfig, List<String> commandStrings,
- IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) {
+ synchronized public IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig,
+ List<String> commandStrings, IExtendedScannerInfo baseScannerInfo, IResource resource,
+ URI buildDirectoryURI) {
try {
Path buildDirectory = Paths.get(buildDirectoryURI);
@@ -225,8 +222,7 @@ public class ContainerGCCToolChain extends PlatformObject
}
addDiscoveryOptions(commandLine);
- commandLine.addAll(
- commandStrings.subList(offset + 1, commandStrings.size()));
+ commandLine.addAll(commandStrings.subList(offset + 1, commandStrings.size()));
// Strip surrounding quotes from the args on Windows
if (Platform.OS_WIN32.equals(Platform.getOS())) {
@@ -305,8 +301,7 @@ public class ContainerGCCToolChain extends PlatformObject
}
@Override
- synchronized public IExtendedScannerInfo getDefaultScannerInfo(
- IBuildConfiguration buildConfig,
+ synchronized public IExtendedScannerInfo getDefaultScannerInfo(IBuildConfiguration buildConfig,
IExtendedScannerInfo baseScannerInfo, ILanguage language, URI buildDirectoryURI) {
try {
String[] commands = getCompileCommands(language);
@@ -332,7 +327,7 @@ public class ContainerGCCToolChain extends PlatformObject
commandLine.add("-I" + includePath); //$NON-NLS-1$
}
}
-
+
if (baseScannerInfo.getDefinedSymbols() != null) {
for (Map.Entry<String, String> macro : baseScannerInfo.getDefinedSymbols().entrySet()) {
if (macro.getValue() != null && !macro.getValue().isEmpty()) {
@@ -377,26 +372,22 @@ public class ContainerGCCToolChain extends PlatformObject
// Startup the command
ContainerCommandLauncher commandLauncher = new ContainerCommandLauncher();
- ICBuildConfiguration cconfig = buildConfig
- .getAdapter(ICBuildConfiguration.class);
+ ICBuildConfiguration cconfig = buildConfig.getAdapter(ICBuildConfiguration.class);
commandLauncher.setBuildConfiguration(cconfig);
commandLauncher.setProject(buildConfig.getProject());
// CCorePlugin.getDefault().getBuildEnvironmentManager().setEnvironment(processBuilder.environment(),
// buildConfig, true);
- org.eclipse.core.runtime.IPath commandPath = new org.eclipse.core.runtime.Path(
- commandLine.get(0));
- String[] args = commandLine.subList(1, commandLine.size())
- .toArray(new String[0]);
- org.eclipse.core.runtime.IPath workingDirectory = new org.eclipse.core.runtime.Path(
- buildDirectory.toString());
+ org.eclipse.core.runtime.IPath commandPath = new org.eclipse.core.runtime.Path(commandLine.get(0));
+ String[] args = commandLine.subList(1, commandLine.size()).toArray(new String[0]);
+ org.eclipse.core.runtime.IPath workingDirectory = new org.eclipse.core.runtime.Path(buildDirectory.toString());
Process process;
try (ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ByteArrayOutputStream stderr = new ByteArrayOutputStream()) {
- process = commandLauncher.execute(commandPath, args, new String[0],
- workingDirectory, new NullProgressMonitor());
- if (process != null && commandLauncher.waitAndRead(stdout, stderr,
- new NullProgressMonitor()) != ICommandLauncher.OK) {
+ process = commandLauncher.execute(commandPath, args, new String[0], workingDirectory,
+ new NullProgressMonitor());
+ if (process != null
+ && commandLauncher.waitAndRead(stdout, stderr, new NullProgressMonitor()) != ICommandLauncher.OK) {
String errMsg = commandLauncher.getErrorMessage();
DockerLaunchUIPlugin.logErrorMessage(errMsg);
return null;
@@ -410,14 +401,11 @@ public class ContainerGCCToolChain extends PlatformObject
// concatenate stdout after stderr as stderr has the include paths
// and stdout has the defines
- String[] outlines = stdout.toString(StandardCharsets.UTF_8.name())
- .split("\\r?\\n"); //$NON-NLS-1$
- String[] errlines = stderr.toString(StandardCharsets.UTF_8.name())
- .split("\\r?\\n"); //$NON-NLS-1$
+ String[] outlines = stdout.toString(StandardCharsets.UTF_8.name()).split("\\r?\\n"); //$NON-NLS-1$
+ String[] errlines = stderr.toString(StandardCharsets.UTF_8.name()).split("\\r?\\n"); //$NON-NLS-1$
String[] lines = new String[errlines.length + outlines.length];
System.arraycopy(errlines, 0, lines, 0, errlines.length);
- System.arraycopy(outlines, 0, lines, errlines.length,
- outlines.length);
+ System.arraycopy(outlines, 0, lines, errlines.length, outlines.length);
for (String line : lines) {
line = line.trim();
@@ -426,11 +414,9 @@ public class ContainerGCCToolChain extends PlatformObject
inIncludePaths = false;
} else {
String include = line.trim();
- org.eclipse.core.runtime.IPath path = new org.eclipse.core.runtime.Path(
- include);
+ org.eclipse.core.runtime.IPath path = new org.eclipse.core.runtime.Path(include);
if (!path.isAbsolute()) {
- org.eclipse.core.runtime.IPath newPath = workingDirectory
- .append(path);
+ org.eclipse.core.runtime.IPath newPath = workingDirectory.append(path);
include = newPath.makeAbsolute().toPortableString();
}
includePath.add(include);
@@ -447,8 +433,7 @@ public class ContainerGCCToolChain extends PlatformObject
// Process include paths for scanner info and point to any copied
// header directories
- includePath = CommandLauncherManager.getInstance()
- .processIncludePaths(cconfig, includePath);
+ includePath = CommandLauncherManager.getInstance().processIncludePaths(cconfig, includePath);
ExtendedScannerInfo info = new ExtendedScannerInfo(symbols,
includePath.toArray(new String[includePath.size()]));
@@ -621,10 +606,9 @@ public class ContainerGCCToolChain extends PlatformObject
}
@Override
- public Process startBuildProcess(ICBuildConfiguration config,
- List<String> command, String buildDirectory,
- IEnvironmentVariable[] envVars, IConsole console,
- IProgressMonitor monitor) throws CoreException, IOException {
+ public Process startBuildProcess(ICBuildConfiguration config, List<String> command, String buildDirectory,
+ IEnvironmentVariable[] envVars, IConsole console, IProgressMonitor monitor)
+ throws CoreException, IOException {
IPath cmdPath = new org.eclipse.core.runtime.Path("/usr/bin/env"); //$NON-NLS-1$
@@ -644,29 +628,24 @@ public class ContainerGCCToolChain extends PlatformObject
buf.deleteCharAt(buf.length() - 1); // remove last blank;
argList.add(buf.toString());
- ICommandLauncher launcher = CommandLauncherManager.getInstance()
- .getCommandLauncher(config);
+ ICommandLauncher launcher = CommandLauncherManager.getInstance().getCommandLauncher(config);
// Bug 536884 - following is a kludge to allow us to check if the
// Container headers have been deleted by the user in which case
// we need to re-perform scanner info collection and copy headers
// to the host.
// TODO: make this cleaner
- CommandLauncherManager.getInstance().processIncludePaths(config,
- Collections.emptyList());
+ CommandLauncherManager.getInstance().processIncludePaths(config, Collections.emptyList());
launcher.setProject(config.getBuildConfiguration().getProject());
if (launcher instanceof ICBuildCommandLauncher) {
((ICBuildCommandLauncher) launcher).setBuildConfiguration(config);
- console.getOutputStream().write(
- ((ICBuildCommandLauncher) launcher).getConsoleHeader());
+ console.getOutputStream().write(((ICBuildCommandLauncher) launcher).getConsoleHeader());
}
- org.eclipse.core.runtime.Path workingDir = new org.eclipse.core.runtime.Path(
- buildDirectory);
+ org.eclipse.core.runtime.Path workingDir = new org.eclipse.core.runtime.Path(buildDirectory);
- Process p = launcher.execute(cmdPath, argList.toArray(new String[0]),
- new String[0], workingDir, monitor);
+ Process p = launcher.execute(cmdPath, argList.toArray(new String[0]), new String[0], workingDir, monitor);
return p;
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
index f9bb6cbe1dd..754eec9608c 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Red Hat Inc. - initial contribution
*******************************************************************************/
@@ -40,14 +40,13 @@ import org.eclipse.linuxtools.docker.core.IDockerConnectionManagerListener;
import org.eclipse.linuxtools.docker.core.IDockerImage;
/**
- *
+ *
* @author jjohnstn
*
* @since 1.2
- *
+ *
*/
-public class ContainerGCCToolChainProvider
- implements IToolChainProvider, IDockerConnectionManagerListener {
+public class ContainerGCCToolChainProvider implements IToolChainProvider, IDockerConnectionManagerListener {
public static final String PROVIDER_ID = "org.eclipse.cdt.docker.launcher.gcc.provider"; //$NON-NLS-1$
public static final String CONTAINER_LINUX_CONFIG_ID = "linux-container-id"; //$NON-NLS-1$
@@ -60,11 +59,9 @@ public class ContainerGCCToolChainProvider
}
@Override
- public synchronized void init(IToolChainManager manager)
- throws CoreException {
+ public synchronized void init(IToolChainManager manager) throws CoreException {
this.toolChainManager = manager;
- IDockerConnection[] connections = DockerConnectionManager.getInstance()
- .getConnections();
+ IDockerConnection[] connections = DockerConnectionManager.getInstance().getConnections();
Map<String, IDockerConnection> connectionMap = new HashMap<>();
for (IDockerConnection connection : connections) {
connectionMap.put(connection.getUri(), connection);
@@ -74,17 +71,12 @@ public class ContainerGCCToolChainProvider
Map<String, String> properties = new HashMap<>();
- properties.put(ILaunchTarget.ATTR_OS,
- ContainerTargetTypeProvider.CONTAINER_LINUX);
- properties.put(ILaunchTarget.ATTR_ARCH,
- Platform.getOSArch());
- properties.put(IContainerLaunchTarget.ATTR_CONNECTION_URI,
- connection.getUri());
- properties.put(IContainerLaunchTarget.ATTR_IMAGE_ID,
- image.repoTags().get(0));
+ properties.put(ILaunchTarget.ATTR_OS, ContainerTargetTypeProvider.CONTAINER_LINUX);
+ properties.put(ILaunchTarget.ATTR_ARCH, Platform.getOSArch());
+ properties.put(IContainerLaunchTarget.ATTR_CONNECTION_URI, connection.getUri());
+ properties.put(IContainerLaunchTarget.ATTR_IMAGE_ID, image.repoTags().get(0));
// following can be used for naming build configurations
- properties.put(CONTAINER_LINUX_CONFIG_ID,
- image.repoTags().get(0).replace(':', '_'));
+ properties.put(CONTAINER_LINUX_CONFIG_ID, image.repoTags().get(0).replace(':', '_'));
// .replace('/', '_'));
ContainerGCCToolChain toolChain = new ContainerGCCToolChain(
@@ -98,8 +90,7 @@ public class ContainerGCCToolChainProvider
// add a Docker Connection listener to handle enablement/disablement of
// Connections
- DockerConnectionManager.getInstance()
- .addConnectionManagerListener(this);
+ DockerConnectionManager.getInstance().addConnectionManagerListener(this);
// re-check configs in case an enabled Connection has made old configs
// valid again do this in a separate job to prevent a possible
@@ -111,8 +102,7 @@ public class ContainerGCCToolChainProvider
// call the recheckConfigs method in case any disabled targets
// are now
// ok
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager mgr = CCorePlugin.getService(ICBuildConfigurationManager.class);
ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
cbuildmanager.recheckConfigs();
return Status.OK_STATUS;
@@ -123,8 +113,7 @@ public class ContainerGCCToolChainProvider
}
@Override
- public synchronized void changeEvent(IDockerConnection connection,
- int type) {
+ public synchronized void changeEvent(IDockerConnection connection, int type) {
final ContainerGCCToolChainProvider provider = this;
@@ -132,43 +121,34 @@ public class ContainerGCCToolChainProvider
@Override
protected IStatus run(IProgressMonitor monitor) {
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager mgr = CCorePlugin.getService(ICBuildConfigurationManager.class);
ICBuildConfigurationManager2 manager = (ICBuildConfigurationManager2) mgr;
if (type == IDockerConnectionManagerListener.ADD_EVENT
|| type == IDockerConnectionManagerListener.ENABLE_EVENT) {
List<IDockerImage> images = connection.getImages();
for (IDockerImage image : images) {
- if (!image.isDangling()
- && !image.isIntermediateImage()) {
+ if (!image.isDangling() && !image.isIntermediateImage()) {
Map<String, String> properties = new HashMap<>();
- properties.put(ILaunchTarget.ATTR_OS,
- ContainerTargetTypeProvider.CONTAINER_LINUX);
- properties.put(ILaunchTarget.ATTR_ARCH,
- Platform.getOSArch());
- properties.put(
- IContainerLaunchTarget.ATTR_CONNECTION_URI,
- connection.getUri());
- properties.put(IContainerLaunchTarget.ATTR_IMAGE_ID,
- image.repoTags().get(0));
+ properties.put(ILaunchTarget.ATTR_OS, ContainerTargetTypeProvider.CONTAINER_LINUX);
+ properties.put(ILaunchTarget.ATTR_ARCH, Platform.getOSArch());
+ properties.put(IContainerLaunchTarget.ATTR_CONNECTION_URI, connection.getUri());
+ properties.put(IContainerLaunchTarget.ATTR_IMAGE_ID, image.repoTags().get(0));
// following can be used for naming build
// configurations
- properties.put(CONTAINER_LINUX_CONFIG_ID,
- image.repoTags().get(0).replace(':', '_'));
+ properties.put(CONTAINER_LINUX_CONFIG_ID, image.repoTags().get(0).replace(':', '_'));
// .replace('/', '_'));
-
Collection<IToolChain> toolChains;
try {
- toolChains = toolChainManager
- .getToolChainsMatching(properties);
+ toolChains = toolChainManager.getToolChainsMatching(properties);
if (toolChains.isEmpty()) {
ContainerGCCToolChain toolChain = new ContainerGCCToolChain(
"gcc-img-" + image.id().substring(0, //$NON-NLS-1$
- 19), provider, properties, null);
+ 19),
+ provider, properties, null);
toolChainManager.addToolChain(toolChain);
}
} catch (CoreException e) {
@@ -183,11 +163,9 @@ public class ContainerGCCToolChainProvider
|| type == IDockerConnectionManagerListener.DISABLE_EVENT) {
try {
String connectionURI = connection.getUri();
- Collection<IToolChain> toolChains = toolChainManager
- .getAllToolChains();
+ Collection<IToolChain> toolChains = toolChainManager.getAllToolChains();
for (IToolChain toolChain : toolChains) {
- String uri = toolChain.getProperty(
- IContainerLaunchTarget.ATTR_CONNECTION_URI);
+ String uri = toolChain.getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI);
if (connectionURI.equals(uri)) {
toolChainManager.removeToolChain(toolChain);
}
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchConfigProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchConfigProvider.java
index 99971bb0d23..eb76f9d4d29 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchConfigProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchConfigProvider.java
@@ -46,8 +46,7 @@ public class CoreBuildContainerLaunchConfigProvider extends AbstractLaunchConfig
@Override
public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
- return target != null && ContainerTargetTypeProvider.TYPE_ID
- .equals(target.getTypeId());
+ return target != null && ContainerTargetTypeProvider.TYPE_ID.equals(target.getTypeId());
}
@Override
@@ -66,10 +65,8 @@ public class CoreBuildContainerLaunchConfigProvider extends AbstractLaunchConfig
if (configMap == null) {
configMap = new HashMap<>();
}
- String connection = target.getAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
- String imageId = target
- .getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, ""); //$NON-NLS-1$
+ String connection = target.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
+ String imageId = target.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, ""); //$NON-NLS-1$
String imageName = connection + "-" + imageId; //$NON-NLS-1$
config = configMap.get(imageName);
if (config == null) {
@@ -81,15 +78,11 @@ public class CoreBuildContainerLaunchConfigProvider extends AbstractLaunchConfig
return config;
}
- private String getImageName(ILaunchConfiguration config)
- throws CoreException {
+ private String getImageName(ILaunchConfiguration config) throws CoreException {
IProject project = config.getMappedResources()[0].getProject();
- ICBuildConfiguration cconfig = project.getActiveBuildConfig()
- .getAdapter(ICBuildConfiguration.class);
- String image = cconfig.getToolChain()
- .getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
- String connection = cconfig.getToolChain()
- .getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI); // $NON-NLS-1$
+ ICBuildConfiguration cconfig = project.getActiveBuildConfig().getAdapter(ICBuildConfiguration.class);
+ String image = cconfig.getToolChain().getProperty(IContainerLaunchTarget.ATTR_IMAGE_ID);
+ String connection = cconfig.getToolChain().getProperty(IContainerLaunchTarget.ATTR_CONNECTION_URI); // $NON-NLS-1$
String imageName = "unknown"; //$NON-NLS-1$
if (connection != null && image != null) {
imageName = connection + "-" + image; //$NON-NLS-1$
@@ -105,40 +98,29 @@ public class CoreBuildContainerLaunchConfigProvider extends AbstractLaunchConfig
// Set the project and the connection
IProject project = descriptor.getAdapter(IProject.class);
- wc.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- project.getName());
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
wc.setAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI,
- target.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI,
- null));
- wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, target
- .getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, null));
+ target.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, null));
+ wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID,
+ target.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, null));
// DSF settings...use GdbUIPlugin preference store for defaults
- IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore preferenceStore = GdbUIPlugin.getDefault().getPreferenceStore();
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
- preferenceStore.getString(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
+ preferenceStore.getString(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
- preferenceStore.getBoolean(
- IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
+ preferenceStore.getBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
- wc.setAttribute(
- IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
- (String) null); // default is the project directory
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null); // default is the project directory
wc.setMappedResources(new IResource[] { project });
}
@@ -163,10 +145,8 @@ public class CoreBuildContainerLaunchConfigProvider extends AbstractLaunchConfig
@Override
public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException {
- for (Entry<IProject, Map<String, ILaunchConfiguration>> entry : configs
- .entrySet()) {
- for (Entry<String, ILaunchConfiguration> innerEntry : entry
- .getValue().entrySet()) {
+ for (Entry<IProject, Map<String, ILaunchConfiguration>> entry : configs.entrySet()) {
+ for (Entry<String, ILaunchConfiguration> innerEntry : entry.getValue().entrySet()) {
if (configuration.equals(innerEntry.getValue())) {
entry.getValue().remove(innerEntry.getKey());
return true;
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchDescriptorType.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchDescriptorType.java
index 24ba66b1caf..843938a328a 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchDescriptorType.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/CoreBuildContainerLaunchDescriptorType.java
@@ -21,7 +21,7 @@ import org.eclipse.launchbar.core.internal.Activator;
/**
* The launch descriptor type for launch objects built with the Core Build
* System.
- *
+ *
* @since 1.2
*/
public class CoreBuildContainerLaunchDescriptorType implements ILaunchDescriptorType {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/Messages.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/Messages.java
index 9e47f729ef1..7ea7bc1ebb8 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/Messages.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/Messages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Red Hat Inc. - initial version
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher.ui.launchbar;
@@ -26,7 +26,7 @@ public class Messages extends NLS {
public static String ContainerGCCToolChainProvider_Saving;
public static String ContainerGCCToolChainProvider_NotOurs;
public static String ContainerGCCToolChainProvider_Loading;
-
+
public static String NewContainerTargetWizard_title;
public static String NewContainerTargetWizardPage_name;
public static String NewContainerTargetWizardPage_title;
@@ -40,7 +40,6 @@ public class Messages extends NLS {
public static String EditContainerTargetWizardPage_title;
public static String EditContainerTargetWizardPage_description;
-
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
@@ -49,4 +48,3 @@ public class Messages extends NLS {
private Messages() {
}
}
-
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizard.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizard.java
index 6af7eac219c..61ac6eb0453 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizard.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizard.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Red Hat Inc. - initial contribution
*******************************************************************************/
@@ -41,8 +41,7 @@ import org.eclipse.launchbar.ui.target.LaunchTargetWizard;
public class NewContainerTargetWizard extends LaunchTargetWizard {
private NewContainerTargetWizardPage page;
- protected IToolChainManager toolChainManager = CDebugCorePlugin
- .getService(IToolChainManager.class);
+ protected IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
public NewContainerTargetWizard() {
if (getLaunchTarget() == null) {
@@ -62,8 +61,7 @@ public class NewContainerTargetWizard extends LaunchTargetWizard {
@Override
public boolean performFinish() {
- ILaunchTargetManager manager = CDebugUIPlugin
- .getService(ILaunchTargetManager.class);
+ ILaunchTargetManager manager = CDebugUIPlugin.getService(ILaunchTargetManager.class);
String typeId = ContainerTargetTypeProvider.TYPE_ID;
String id = page.getTargetName();
@@ -75,12 +73,9 @@ public class NewContainerTargetWizard extends LaunchTargetWizard {
ILaunchTargetWorkingCopy wc = target.getWorkingCopy();
wc.setId(id);
wc.setAttribute(ILaunchTarget.ATTR_OS, Platform.getOS());
- wc.setAttribute(ILaunchTarget.ATTR_ARCH,
- ContainerTargetTypeProvider.CONTAINER_LINUX);
- wc.setAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI,
- page.getConnectionURI());
- wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID,
- page.getImageId());
+ wc.setAttribute(ILaunchTarget.ATTR_ARCH, ContainerTargetTypeProvider.CONTAINER_LINUX);
+ wc.setAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, page.getConnectionURI());
+ wc.setAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, page.getImageId());
wc.save();
// Pick the first one that matches
@@ -109,8 +104,7 @@ public class NewContainerTargetWizard extends LaunchTargetWizard {
@Override
public void performDelete() {
- ILaunchTargetManager manager = Activator
- .getService(ILaunchTargetManager.class);
+ ILaunchTargetManager manager = Activator.getService(ILaunchTargetManager.class);
ILaunchTarget target = getLaunchTarget();
if (target != null) {
manager.removeLaunchTarget(getLaunchTarget());
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizardPage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizardPage.java
index 90722f21b12..8c100684302 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizardPage.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/NewContainerTargetWizardPage.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contibutors:
* Red Hat Inc. - initial implementation
*******************************************************************************/
@@ -60,7 +60,6 @@ public class NewContainerTargetWizardPage extends WizardPage
private String connectionName;
private String connectionUri = "";
-
public NewContainerTargetWizardPage(ILaunchTarget launchTarget) {
super(NewContainerTargetWizardPage.class.getName());
if (launchTarget == null) {
@@ -73,10 +72,8 @@ public class NewContainerTargetWizardPage extends WizardPage
this.launchTarget = launchTarget;
this.wizardPage = this;
if (launchTarget != null) {
- connectionUri = launchTarget.getAttribute(
- IContainerLaunchTarget.ATTR_CONNECTION_URI, null);
- imageName = launchTarget
- .getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, null);
+ connectionUri = launchTarget.getAttribute(IContainerLaunchTarget.ATTR_CONNECTION_URI, null);
+ imageName = launchTarget.getAttribute(IContainerLaunchTarget.ATTR_IMAGE_ID, null);
}
}
@@ -183,8 +180,7 @@ public class NewContainerTargetWizardPage extends WizardPage
int defaultIndex = -1;
connections = DockerConnectionManager.getInstance().getConnections();
if (connections.length == 0) {
- setErrorMessage(
- Messages.NewContainerTargetWizardPage_no_connections);
+ setErrorMessage(Messages.NewContainerTargetWizardPage_no_connections);
return;
}
String[] connectionNames = new String[connections.length];
@@ -209,8 +205,7 @@ public class NewContainerTargetWizardPage extends WizardPage
if (connection != null) {
java.util.List<IDockerImage> images = connection.getImages();
if (images == null || images.size() == 0) {
- setErrorMessage(
- Messages.NewContainerTargetWizardPage_no_images);
+ setErrorMessage(Messages.NewContainerTargetWizardPage_no_images);
return;
}
connection.removeImageListener(wizardPage);
@@ -259,12 +254,10 @@ public class NewContainerTargetWizardPage extends WizardPage
connectionUri = connection.getUri();
java.util.List<IDockerImage> images = connection.getImages();
if (images == null || images.size() == 0) {
- setErrorMessage(
- Messages.NewContainerTargetWizardPage_no_images);
+ setErrorMessage(Messages.NewContainerTargetWizardPage_no_images);
}
} else {
- setErrorMessage(
- Messages.NewContainerTargetWizardPage_no_connections);
+ setErrorMessage(Messages.NewContainerTargetWizardPage_no_connections);
connection = null;
connectionUri = "";
connectionSelector.setText("");
@@ -272,8 +265,7 @@ public class NewContainerTargetWizardPage extends WizardPage
connectionSelector.addModifyListener(connectionModifyListener);
}
- public void listChanged(IDockerConnection c,
- java.util.List<IDockerImage> list) {
+ public void listChanged(IDockerConnection c, java.util.List<IDockerImage> list) {
setErrorMessage(null);
final IDockerImage[] finalList = list.toArray(new IDockerImage[0]);
if (finalList.length == 0) {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerHeaderPreferencePage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerHeaderPreferencePage.java
index 0e0269ab90d..6886972d965 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerHeaderPreferencePage.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerHeaderPreferencePage.java
@@ -36,8 +36,7 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-public class DockerHeaderPreferencePage extends PreferencePage
- implements IWorkbenchPreferencePage, Listener {
+public class DockerHeaderPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener {
// SWT Widgets and content providers
private Table hdrTable;
@@ -46,8 +45,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
private Button removeButton;
private List<IPath> directories;
- private final class HeaderContentProvider
- implements IStructuredContentProvider, ITableLabelProvider {
+ private final class HeaderContentProvider implements IStructuredContentProvider, ITableLabelProvider {
/**
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
@@ -69,8 +67,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
* Object, Object)
*/
@Override
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
/**
@@ -90,8 +87,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
String name = path.lastSegment();
if (namePath.toFile().exists()) {
try (FileReader reader = new FileReader(namePath.toFile());
- BufferedReader bufferReader = new BufferedReader(
- reader);) {
+ BufferedReader bufferReader = new BufferedReader(reader);) {
name = bufferReader.readLine();
} catch (IOException e) {
// ignore
@@ -149,9 +145,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
@Override
public void init(IWorkbench workbench) {
directories = new ArrayList<>();
- IPath pluginPath = Platform
- .getStateLocation(
- Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
+ IPath pluginPath = Platform.getStateLocation(Platform.getBundle(DockerLaunchUIPlugin.PLUGIN_ID))
.append("HEADERS"); //$NON-NLS-1$
File d = pluginPath.toFile();
@@ -162,9 +156,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
File[] images = connection.listFiles();
for (File image : images) {
if (image.isDirectory()) {
- directories
- .add(pluginPath.append(connection.getName())
- .append(image.getName()));
+ directories.add(pluginPath.append(connection.getName()).append(image.getName()));
}
}
}
@@ -174,8 +166,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
@Override
protected Control createContents(Composite parent) {
- Composite page = createComposite(parent, 1, 2, false, null, -1, -1,
- GridData.FILL);
+ Composite page = createComposite(parent, 1, 2, false, null, -1, -1, GridData.FILL);
GridData gd = (GridData) page.getLayoutData();
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
@@ -184,8 +175,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
// SystemResources.RESID_PREF_SIGNON_DESCRIPTION, 2);
// Header table
- hdrTable = new Table(page, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
- | SWT.H_SCROLL | SWT.BORDER);
+ hdrTable = new Table(page, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
hdrTable.setLinesVisible(true);
hdrTable.setHeaderVisible(true);
hdrTable.addListener(SWT.Selection, this);
@@ -203,8 +193,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
// Connection column
TableColumn connectionColumn = new TableColumn(hdrTable, SWT.NONE);
- connectionColumn
- .setText(Messages.HeaderPreferencePage_Connection_Label);
+ connectionColumn.setText(Messages.HeaderPreferencePage_Connection_Label);
// Image column
TableColumn imageColumn = new TableColumn(hdrTable, SWT.NONE);
@@ -216,23 +205,20 @@ public class DockerHeaderPreferencePage extends PreferencePage
hdrTableViewer.setInput(directories);
// Create the Button bar for add, change and remove
- Composite buttonBar = createComposite(page, 1, 1, false, null, -1, -1,
- GridData.FILL);
+ Composite buttonBar = createComposite(page, 1, 1, false, null, -1, -1, GridData.FILL);
gd = (GridData) buttonBar.getLayoutData();
gd.grabExcessHorizontalSpace = false;
gd.grabExcessVerticalSpace = true;
- removeButton = createPushButton(buttonBar, this,
- Messages.HeaderPreferencePage_Remove_Label,
+ removeButton = createPushButton(buttonBar, this, Messages.HeaderPreferencePage_Remove_Label,
Messages.HeaderPreferencePage_Remove_Tooltip);
removeButton.setEnabled(false);
return parent;
}
- private static Composite createComposite(Composite parent, int parentSpan,
- int numColumns, boolean border, String label, int marginSize,
- int spacingSize, int verticalAlignment) {
+ private static Composite createComposite(Composite parent, int parentSpan, int numColumns, boolean border,
+ String label, int marginSize, int spacingSize, int verticalAlignment) {
// border = true;
boolean borderNeeded = border;
if (label != null)
@@ -273,8 +259,7 @@ public class DockerHeaderPreferencePage extends PreferencePage
return composite;
}
- public static Button createPushButton(Composite group, Listener listener,
- String label, String tooltip) {
+ public static Button createPushButton(Composite group, Listener listener, String label, String tooltip) {
Button button = new Button(group, SWT.PUSH);
button.setText(label);
if (listener != null)
@@ -353,4 +338,3 @@ public class DockerHeaderPreferencePage extends PreferencePage
dir.delete();
}
}
-
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerLaunchPreferencePage.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerLaunchPreferencePage.java
index 3851ec24d0d..9375b9fc8a8 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerLaunchPreferencePage.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/preferences/DockerLaunchPreferencePage.java
@@ -22,8 +22,7 @@ import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-public class DockerLaunchPreferencePage extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
+public class DockerLaunchPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private StringFieldEditor defaultImage;
private BooleanFieldEditor keepContainerAfterLaunch;
@@ -39,12 +38,11 @@ public class DockerLaunchPreferencePage extends FieldEditorPreferencePage
* editor knows how to save and restore itself.
*/
public void createFieldEditors() {
- defaultImage = new StringFieldEditor(PreferenceConstants.DEFAULT_IMAGE,
- Messages.Default_Image, getFieldEditorParent());
+ defaultImage = new StringFieldEditor(PreferenceConstants.DEFAULT_IMAGE, Messages.Default_Image,
+ getFieldEditorParent());
addField(defaultImage);
- keepContainerAfterLaunch = new BooleanFieldEditor(
- PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH,
+ keepContainerAfterLaunch = new BooleanFieldEditor(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH,
Messages.Keep_Container_After_Launch, getFieldEditorParent());
addField(keepContainerAfterLaunch);
@@ -52,7 +50,7 @@ public class DockerLaunchPreferencePage extends FieldEditorPreferencePage
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/

Back to the top