# HG changeset patch # User Ed Swartz # Date 1259959905 21600 # Node ID baa31ffa93b51648ba481674468caf7d3cb9fcbf # Parent 1bb6b7462d648c50f32083d12267f1a978c85011 Move constant about minimum file timestamp resolution into FileUtils diff -r 1bb6b7462d64 -r baa31ffa93b5 core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java --- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java Fri Dec 04 14:46:25 2009 -0600 +++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java Fri Dec 04 14:51:45 2009 -0600 @@ -297,7 +297,8 @@ * the workspace via links (very slow) * @return new path (workspace-relative) or null if not resolvable to workspace */ - static public IPath convertToWorkspacePath(IPath cpath, boolean makeCanonical, boolean resolveLinks) { + @SuppressWarnings("deprecation") + static public IPath convertToWorkspacePath(IPath cpath, boolean makeCanonical, boolean resolveLinks) { if (!Platform.isRunning() || cpath == null) return null; @@ -883,4 +884,20 @@ private static IStatus createErrorStatus(Exception e) { return new Status(IStatus.ERROR, UtilsCorePlugin.ID, null, e); } + + /** + * Get the minimum timestamp resolution for a file in ms (based on heuristics for the OS). + * @param path path to file of interest, or null for worst case + * @return number of ms of resolution. E.g., 50 means only changes in 50ms increments are stored + */ + public static long getMinimumFileTimestampResolution(IPath path) { + // VFAT on Win32 uses 2 second increments. Linux ext2/3 uses 1 second resolution, + // until ext4, where it becomes nanoseconds. + // Assume the worst format in all cases. + long res = HostOS.IS_WIN32 ? 2000 : 1000; + if (path != null) { + // todo + } + return res; + } } diff -r 1bb6b7462d64 -r baa31ffa93b5 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDataCache.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDataCache.java Fri Dec 04 14:46:25 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDataCache.java Fri Dec 04 14:51:45 2009 -0600 @@ -61,7 +61,7 @@ private File projectDir; // Try to wait long enough to ensure the timestamp-based check will detect a change - private static final long FS_TIME_RESOLUTION = ViewDataCache.ModelFileTimestampCollection.MIN_TIMESTAMP_RESOLUTION; + private static final long FS_TIME_RESOLUTION = FileUtils.getMinimumFileTimestampResolution(null); /* (non-Javadoc) * @see com.nokia.carbide.cpp.epoc.engine.tests.BaseTest#setUp() diff -r 1bb6b7462d64 -r baa31ffa93b5 project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java --- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java Fri Dec 04 14:46:25 2009 -0600 +++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ViewDataCache.java Fri Dec 04 14:51:45 2009 -0600 @@ -218,13 +218,6 @@ public static class ModelFileTimestampCollection { /** - * The minimum timestamp resolution for a file in ms (based on heuristics for the OS). - * VFAT on Win32 uses 2 second increments. Linux ext2/3 uses 1 second resolution, - * until ext4, where it becomes nanoseconds. - * Assume the worst format in all cases. - */ - public static final long MIN_TIMESTAMP_RESOLUTION = HostOS.IS_WIN32 ? 2000 : 1000; - /** * Delay in ms between successive checks of the filesystem, to avoid wasting time * when such checks are slow, and in cases where it's unlikely the human will edit files * fast enough to care. @@ -424,6 +417,7 @@ * @return * @throws CoreException */ + @SuppressWarnings("unchecked") private Data getViewData(IPath modelPath, IViewConfiguration configuration, ViewConfigState state, ViewConfigKey key) throws CoreException { Data data;