1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[281712] [dstore] Warning message is needed when disk is full

This commit is contained in:
David McKnight 2009-07-10 17:17:21 +00:00
parent 310127f6c6
commit b20ea620b0

View file

@ -502,16 +502,17 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
// use standard remote path // use standard remote path
String stdRemotePath = remotePath.replace('\\', '/'); String stdRemotePath = remotePath.replace('\\', '/');
DataElement result = ds.find(uploadLog, DE.A_NAME, stdRemotePath,1); int numTransfers = 0;
DataElement result = ds.find(uploadLog, DE.A_NAME, stdRemotePath,1);
if (result == null) if (result == null)
{ {
result = ds.createObject(uploadLog, "uploadstatus", stdRemotePath); result = ds.createObject(uploadLog, "uploadstatus", stdRemotePath); //$NON-NLS-1$
result.setAttribute(DE.A_SOURCE, "running"); result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$
result.setAttribute(DE.A_VALUE, ""); result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$
DataElement cmd = getDataStore().findCommandDescriptor(DataStoreSchema.C_SET); DataElement cmd = getDataStore().findCommandDescriptor(DataStoreSchema.C_SET);
DataElement setstatus = ds.command(cmd, uploadLog, true); ds.command(cmd, uploadLog, true);
} }
try try
@ -560,11 +561,11 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncoding, this); IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncoding, this);
// upload bytes while available // upload bytes while available
while (available > 0 && !isCancelled) while (available > 0 && !isCancelled)
{ {
result.setAttribute(DE.A_SOURCE, "working"); //$NON-NLS-1$ numTransfers++;
numToRead = (available < buffer_size) ? available : buffer_size; numToRead = (available < buffer_size) ? available : buffer_size;
int bytesRead = bufInputStream.read(buffer, 0, numToRead); int bytesRead = bufInputStream.read(buffer, 0, numToRead);
@ -693,19 +694,29 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
if (totalBytes > 0) if (totalBytes > 0)
{ {
if (transferSuccessful) if (transferSuccessful)
{ {
String resultStr = result.getSource(); if (numTransfers > 1){
while (!resultStr.equals("success")) // forced sleep to make sure we get the latest status
try {
Thread.sleep(200);
}
catch (InterruptedException e){
}
}
String resultStr = result.getSource();
while (!resultStr.equals("success")) //$NON-NLS-1$
{ {
// sleep until the upload is complete // sleep until the upload is complete
try { try {
Thread.sleep(200); Thread.sleep(200);
} }
catch (InterruptedException e){ catch (InterruptedException e){
} }
resultStr = result.getSource();
if (resultStr.equals("failed")){ resultStr = result.getSource();
if (resultStr.equals("failed") || monitor.isCanceled()){ //$NON-NLS-1$
String msgTxt = NLS.bind(ServiceResources.FILEMSG_COPY_FILE_FAILED, remotePath); String msgTxt = NLS.bind(ServiceResources.FILEMSG_COPY_FILE_FAILED, remotePath);
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt); SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);