From efe1cbf838493544457b47a2db9e90c037c1928d Mon Sep 17 00:00:00 2001
From: ladenberger <ladenberger@1434b563-b632-4741-aa49-43a3a8374d2e>
Date: Fri, 14 Feb 2014 08:01:53 +0000
Subject: [PATCH] Workaround for save bug. The method getTextTimestamp returns
 in some cases -1 (no time annotation exists). I noticed that many different
 instances of the same resource exist. Some are annotated, the others not.

git-svn-id: svn://svn.code.sf.net/p/rodin-b-sharp/svn/trunk/Camille@16184 1434b563-b632-4741-aa49-43a3a8374d2e
---
 .../src/org/eventb/texttools/PersistenceHelper.java      | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/org.eventb.texttools/src/org/eventb/texttools/PersistenceHelper.java b/org.eventb.texttools/src/org/eventb/texttools/PersistenceHelper.java
index d9a921c..dd62b9e 100644
--- a/org.eventb.texttools/src/org/eventb/texttools/PersistenceHelper.java
+++ b/org.eventb.texttools/src/org/eventb/texttools/PersistenceHelper.java
@@ -60,7 +60,14 @@ public class PersistenceHelper {
 			 * Try to set timestamp to the same as in the annotation. Setting on
 			 * both Resource and IResource to be save.
 			 */
-			final long textTimestamp = getTextTimestamp(resource);
+			//final long textTimestamp = getTextTimestamp(resource);
+			// TODO: Workaround for save bug. The method getTextTimestamp
+			// returns in some cases -1 (no time annotation exists). I noticed
+			// that many different instances of the same resource exist. Some
+			// are annotated, the others not.
+			long textTimestamp = getTextTimestamp(resource);
+			if(textTimestamp == -1)
+				textTimestamp = System.currentTimeMillis();
 			resource.setTimeStamp(textTimestamp);
 			getIResource(resource).setLocalTimeStamp(textTimestamp);
 		} catch (final IOException e) {
-- 
GitLab