mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 398499 - FileContent.adapt(CodeReader) does not properly
set timestamps Change-Id: I57fdacfc2fef225a6b3942b1be185ae79bb28c31 Reviewed-on: https://git.eclipse.org/r/9756 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Chris Recoskie <recoskie@ca.ibm.com> Reviewed-by: Chris Recoskie <recoskie@ca.ibm.com>
This commit is contained in:
parent
adb89806d8
commit
6aebe7dcd5
1 changed files with 10 additions and 2 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,9 +8,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
* Chris Recoskie (IBM Corporation)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -133,6 +136,11 @@ public abstract class FileContent {
|
||||||
public static FileContent adapt(CodeReader reader) {
|
public static FileContent adapt(CodeReader reader) {
|
||||||
if (reader == null)
|
if (reader == null)
|
||||||
return null;
|
return null;
|
||||||
return create(reader.getPath(), reader.buffer);
|
|
||||||
|
long fileReadTime = System.currentTimeMillis();
|
||||||
|
CharArray chars = new CharArray(reader.buffer);
|
||||||
|
String filePath = reader.getPath();
|
||||||
|
File file = new File(filePath);
|
||||||
|
return new InternalFileContent(filePath, chars, file.lastModified(), file.length(), fileReadTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue