Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2013-01-18 15:05:42 +0000
committerChris Recoskie2013-01-18 15:05:42 +0000
commit8f9a00e1b6104726a3b5e64f5f8d99ced8e695c5 (patch)
treef567ae835fbb4d16dca87f474085481cdee455d4
parenta30919dff8048044f7ffec6ba59ee7c64bb0b234 (diff)
downloadorg.eclipse.cdt-8f9a00e1b6104726a3b5e64f5f8d99ced8e695c5.tar.gz
org.eclipse.cdt-8f9a00e1b6104726a3b5e64f5f8d99ced8e695c5.tar.xz
org.eclipse.cdt-8f9a00e1b6104726a3b5e64f5f8d99ced8e695c5.zip
Bug 398499 - FileContent.adapt(CodeReader) does not properly
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java
index fd7085fbd78..c9821eaacf1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/FileContent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2013 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,9 +8,13 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
+ * Chris Recoskie (IBM Corporation)
*******************************************************************************/
package org.eclipse.cdt.core.parser;
+import java.io.File;
+import java.io.InputStream;
+
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.index.IIndexFileLocation;
import org.eclipse.cdt.core.model.ITranslationUnit;
@@ -133,6 +137,16 @@ public abstract class FileContent {
public static FileContent adapt(CodeReader reader) {
if (reader == null)
return null;
- return create(reader.getPath(), reader.buffer);
+
+ long fileReadTime = System.currentTimeMillis();
+ String path = reader.getPath();
+ File file = new File(path);
+
+ CharArray chars = new CharArray(reader.buffer);
+
+
+ FileContent fileContent = new InternalFileContent(path, chars , file.lastModified(), file.length(), fileReadTime);
+
+ return fileContent;
}
}

Back to the top