From 8dcdc17ebc75261db9c9cd05373b8ea476c15015 Mon Sep 17 00:00:00 2001 From: Kushal Munir < kmunir@ca.ibm.com> Date: Tue, 1 Aug 2006 19:14:04 +0000 Subject: [PATCH] Bug 149150 --- .../ui/propertypages/SystemCachePreferencePage.java | 6 +++++- .../files/ui/resources/SystemEditableRemoteFile.java | 7 ++++++- .../rse/files/ui/resources/SystemTempFileListener.java | 10 +++++++++- .../ui/resources/UniversalFileTransferUtility.java | 7 ++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemCachePreferencePage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemCachePreferencePage.java index 2260a60d0f2..56851b921b6 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemCachePreferencePage.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemCachePreferencePage.java @@ -417,7 +417,11 @@ public class SystemCachePreferencePage extends PreferencePage implements IWorkbe (ISystemEditableRemoteObject) properties.getRemoteFileObject(); dirtyReplicas.add(editable); } - else if (properties.getDownloadFileTimeStamp() != child.getLocalTimeStamp()) + // get the modified timestamp from the File, not the IFile + // for some reason, the modified timestamp from the IFile does not always return + // the right value. There is a Javadoc comment saying the value from IFile might be a + // cached value and that might be the cause of the problem. + else if (properties.getDownloadFileTimeStamp() != child.getLocation().toFile().lastModified()) { String ssString = properties.getRemoteFileSubSystem(); ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java index 0b2aaeb4ced..085d454be4c 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java @@ -573,7 +573,12 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP properties.setDownloadFileTimeStamp(file.getLocalTimeStamp()); properties.setDirty(false); properties.setUsedBinaryTransfer(remoteFile.isBinary()); - properties.setDownloadFileTimeStamp(file.getLocalTimeStamp()); + + // get the modified timestamp from the File, not the IFile + // for some reason, the modified timestamp from the IFile does not always return + // the right value. There is a Javadoc comment saying the value from IFile might be a + // cached value and that might be the cause of the problem. + properties.setDownloadFileTimeStamp(file.getLocation().toFile().lastModified()); return true; } diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java index 0edf176bb55..65598151a22 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java @@ -361,7 +361,15 @@ public abstract class SystemTempFileListener implements IResourceChangeListener if (!_changedResources.contains(resource) && !isIgnorable((IFile)resource)) { SystemIFileProperties properties = new SystemIFileProperties(resource); - if (properties.getDownloadFileTimeStamp() != resource.getLocalTimeStamp()) + long t1 = properties.getDownloadFileTimeStamp(); + + // get the modified timestamp from the File, not the IFile + // for some reason, the modified timestamp from the IFile does not always return + // the right value. There is a Javadoc comment saying the value from IFile might be a + // cached value and that might be the cause of the problem. + long t2 = resource.getLocation().toFile().lastModified(); + + if (t1 != t2) { String ssStr = properties.getRemoteFileSubSystem(); if (ssStr != null) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java index ac7ae699822..8893f214086 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java @@ -211,7 +211,12 @@ public class UniversalFileTransferUtility String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem); properties.setRemoteFileSubSystem(subSystemId); properties.setRemoteFilePath(remotePath); - properties.setDownloadFileTimeStamp(tempFile.getLocalTimeStamp()); + + // get the modified timestamp from the File, not the IFile + // for some reason, the modified timestamp from the IFile does not always return + // the right value. There is a Javadoc comment saying the value from IFile might be a + // cached value and that might be the cause of the problem. + properties.setDownloadFileTimeStamp(tempFile.getLocation().toFile().lastModified()); boolean isMounted = isRemoteFileMounted(subSystem, remotePath); properties.setRemoteFileMounted(isMounted);