mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
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>
This commit is contained in:
parent
fd8765e352
commit
c7632069df
1 changed files with 10 additions and 6 deletions
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.launch.remote;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
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.MultiStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
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.ILaunch;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
@ -97,10 +96,13 @@ public class RemoteHelper {
|
||||||
IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
|
IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
if (skipDownload)
|
if (skipDownload) {
|
||||||
// Nothing to do. Download is skipped.
|
// Nothing to do. Download is skipped.
|
||||||
return;
|
return;
|
||||||
monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100);
|
}
|
||||||
|
|
||||||
|
SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.RemoteRunLaunchDelegate_2, 100);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IRemoteConnection conn = getCurrentConnection(config);
|
IRemoteConnection conn = getCurrentConnection(config);
|
||||||
IRemoteFileService fs = conn.getService(IRemoteFileService.class);
|
IRemoteFileService fs = conn.getService(IRemoteFileService.class);
|
||||||
|
@ -112,12 +114,14 @@ public class RemoteHelper {
|
||||||
if (!localFile.fetchInfo().exists()) {
|
if (!localFile.fetchInfo().exists()) {
|
||||||
return;
|
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
|
// Need to change the permissions to match the original file
|
||||||
// permissions because of a bug in upload
|
// permissions because of a bug in upload
|
||||||
Process p = remoteShellExec(
|
Process p = remoteShellExec(
|
||||||
config,
|
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
|
// Wait if necessary for the permission change
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue