Skip to main content
summaryrefslogtreecommitdiffstats
path: root/cross
diff options
context:
space:
mode:
authorSimon Marchi2017-02-21 13:27:00 -0500
committerSergey Prigogin2017-02-27 18:21:20 -0500
commitc7632069df3bc95f0192e83cb9cb8496cce0a86b (patch)
tree926b5e426e32f8ded00c99b89631bf02105ef583 /cross
parentfd8765e352bb7e7b94b32d97d80d1ad8deacd094 (diff)
downloadorg.eclipse.cdt-c7632069df3bc95f0192e83cb9cb8496cce0a86b.tar.gz
org.eclipse.cdt-c7632069df3bc95f0192e83cb9cb8496cce0a86b.tar.xz
org.eclipse.cdt-c7632069df3bc95f0192e83cb9cb8496cce0a86b.zip
Convert RemoteHelper.remoteFileDownload to use SubMonitor
This patch converts RemoteHelper.remoteFileDownload to use SubMonitor instead of the deprecated SubProgressMonitor. The remoteFileDownload operation consists of two sub-operations, to which I assigned the following weigth: - Download the file to the target (95%) - Change the permissions (5%) Ref: http://www.eclipse.org/articles/Article-Progress-Monitors/article.html Change-Id: I8336f8e853e811a4350f1a63ba64934121ace5d8 Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Diffstat (limited to 'cross')
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
index bc389c24cb..7b991d0741 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
@@ -17,7 +17,6 @@ package org.eclipse.cdt.launch.remote;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -33,7 +32,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.osgi.util.NLS;
@@ -97,10 +96,13 @@ public class RemoteHelper {
IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
false);
- if (skipDownload)
+ if (skipDownload) {
// Nothing to do. Download is skipped.
return;
- monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100);
+ }
+
+ SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.RemoteRunLaunchDelegate_2, 100);
+
try {
IRemoteConnection conn = getCurrentConnection(config);
IRemoteFileService fs = conn.getService(IRemoteFileService.class);
@@ -112,12 +114,14 @@ public class RemoteHelper {
if (!localFile.fetchInfo().exists()) {
return;
}
- localFile.copy(remoteFile, EFS.OVERWRITE, monitor);
+
+ localFile.copy(remoteFile, EFS.OVERWRITE, subMonitor.split(95));
+
// Need to change the permissions to match the original file
// permissions because of a bug in upload
Process p = remoteShellExec(
config,
- "", "chmod", "+x " + spaceEscapify(remoteExePath), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "", "chmod", "+x " + spaceEscapify(remoteExePath), subMonitor.split(5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// Wait if necessary for the permission change
try {

Back to the top