1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-20 06:35:50 +02:00

fix for 142181. Including better progress message.

This commit is contained in:
David McKnight 2006-05-19 16:24:23 +00:00
parent 5e65fc8836
commit 2bd06778f7
2 changed files with 20 additions and 5 deletions

View file

@ -96,7 +96,7 @@ public interface IUniversalDataStoreConstants extends IServiceConstants
public static final int KB_IN_BYTES = 1024; public static final int KB_IN_BYTES = 1024;
// Number of kilobytes we want // Number of kilobytes we want
public static final int NUM_OF_KB = 40; public static final int NUM_OF_KB = 10;
// The size of file segments to read and send across connection (in bytes) // The size of file segments to read and send across connection (in bytes)
public static final int BUFFER_SIZE = NUM_OF_KB * KB_IN_BYTES; public static final int BUFFER_SIZE = NUM_OF_KB * KB_IN_BYTES;

View file

@ -23,11 +23,13 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.dstore.core.model.DE; import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement; import org.eclipse.dstore.core.model.DataElement;
import org.eclipse.dstore.core.model.DataStore; import org.eclipse.dstore.core.model.DataStore;
@ -42,6 +44,7 @@ import org.eclipse.rse.services.clientserver.IServiceConstants;
import org.eclipse.rse.services.clientserver.ISystemFileTypes; import org.eclipse.rse.services.clientserver.ISystemFileTypes;
import org.eclipse.rse.services.clientserver.PathUtility; import org.eclipse.rse.services.clientserver.PathUtility;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.dstore.AbstractDStoreService; import org.eclipse.rse.services.dstore.AbstractDStoreService;
import org.eclipse.rse.services.dstore.ServiceResources; import org.eclipse.rse.services.dstore.ServiceResources;
@ -63,6 +66,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
private int _bufferDownloadSize = IUniversalDataStoreConstants.BUFFER_SIZE; private int _bufferDownloadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
protected ISystemFileTypes _fileTypeRegistry; protected ISystemFileTypes _fileTypeRegistry;
private static String _percentMsg = SystemMessage.sub(SystemMessage.sub(SystemMessage.sub(ServiceResources.DStore_Service_Percent_Complete_Message, "&0", "{0}"), "&1", "{1}"), "&2", "{2}");
private static String[] _filterAttributes = { private static String[] _filterAttributes = {
"attributes", "attributes",
"filter", "filter",
@ -360,6 +365,14 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
IHostFile created = createFile(monitor, remoteParent, remoteFile); IHostFile created = createFile(monitor, remoteParent, remoteFile);
return created.exists(); return created.exists();
} }
/*
SubProgressMonitor subMonitor = null;
if (monitor != null)
{
monitor.subTask(file.getName());
subMonitor = new SubProgressMonitor(monitor, (int)totalBytes);
}
*/
DataElement uploadLog = findUploadLog(); DataElement uploadLog = findUploadLog();
// listener = new FileTransferStatusListener(remotePath, shell, monitor, getConnectorService(), ds, uploadLog); // listener = new FileTransferStatusListener(remotePath, shell, monitor, getConnectorService(), ds, uploadLog);
@ -454,13 +467,15 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
percentBuf.append("%"); percentBuf.append("%");
monitor.worked(bytesRead); monitor.worked(bytesRead);
/*
progressMsg.makeSubstitution(totalSentBuf.toString(), totalBuf, percentBuf); String str = MessageFormat.format(_percentMsg, new Object[] {totalSentBuf, totalBuf, percentBuf});
monitor.subTask(progressMsg.getLevelOneText()); monitor.subTask(str);
*/
while (display.readAndDispatch()) while (display.readAndDispatch())
{ {
} }
Thread.sleep(200);
isCancelled = monitor.isCanceled(); isCancelled = monitor.isCanceled();
if (isCancelled) if (isCancelled)