Lines 23-28
Link Here
|
23 |
* Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file |
23 |
* Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file |
24 |
* Kevin Doyle (IBM) - [210389] Display error dialog when setting file not read-only fails when saving |
24 |
* Kevin Doyle (IBM) - [210389] Display error dialog when setting file not read-only fails when saving |
25 |
* David McKnight (IBM) - [235221] Files truncated on exit of Eclipse |
25 |
* David McKnight (IBM) - [235221] Files truncated on exit of Eclipse |
|
|
26 |
* David McKnight (IBM) - [249544] Save conflict dialog appears when saving files in the editor |
26 |
********************************************************************************/ |
27 |
********************************************************************************/ |
27 |
|
28 |
|
28 |
package org.eclipse.rse.files.ui.resources; |
29 |
package org.eclipse.rse.files.ui.resources; |
Lines 302-312
Link Here
|
302 |
} |
303 |
} |
303 |
|
304 |
|
304 |
// waiting to make sure the file's timestamp is uptodate |
305 |
// waiting to make sure the file's timestamp is uptodate |
305 |
Thread.sleep(1000); |
306 |
remoteFile = waitForTimestampToBeUpToDate(remoteFile, monitor); |
|
|
307 |
|
308 |
|
306 |
|
309 |
|
307 |
// get the remote file object again so that we have a fresh remote timestamp |
|
|
308 |
remoteFile.markStale(true); |
309 |
remoteFile = fs.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor); |
310 |
|
310 |
|
311 |
registry.fireEvent(new SystemResourceChangeEvent(remoteFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, remoteFile)); |
311 |
registry.fireEvent(new SystemResourceChangeEvent(remoteFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, remoteFile)); |
312 |
|
312 |
|
Lines 374-377
Link Here
|
374 |
e.printStackTrace(); |
374 |
e.printStackTrace(); |
375 |
} |
375 |
} |
376 |
} |
376 |
} |
|
|
377 |
|
378 |
private IRemoteFile waitForTimestampToBeUpToDate(IRemoteFile remoteFile, IProgressMonitor monitor) |
379 |
{ |
380 |
IRemoteFileSubSystem fs = remoteFile.getParentRemoteFileSubSystem(); |
381 |
String path = remoteFile.getAbsolutePath(); |
382 |
try { |
383 |
// get the remote file object again so that we have a fresh remote timestamp |
384 |
remoteFile.markStale(true); |
385 |
remoteFile = fs.getRemoteFileObject(path, monitor); |
386 |
|
387 |
long timestamp = remoteFile.getLastModified(); |
388 |
boolean timestampChanged = true; |
389 |
while (timestampChanged){ // wait until the timestamp stops changing |
390 |
try { |
391 |
Thread.sleep(500); // sleep |
392 |
} |
393 |
catch (InterruptedException e){ |
394 |
} |
395 |
|
396 |
// query the remote file again |
397 |
remoteFile.markStale(true); |
398 |
remoteFile = fs.getRemoteFileObject(path, monitor); |
399 |
|
400 |
// what's the timestamp now? |
401 |
long nextTimestamp = remoteFile.getLastModified(); |
402 |
|
403 |
timestampChanged = (timestamp != nextTimestamp); |
404 |
timestamp = nextTimestamp; |
405 |
} |
406 |
} |
407 |
catch (SystemMessageException e){ |
408 |
|
409 |
} |
410 |
|
411 |
return remoteFile; |
412 |
} |
377 |
} |
413 |
} |