[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Get ast from file name
|
Hi Maxime
Try the following code (given that "fileName" is a string containing an
absolute or workspace-relative path to the file):
URI fileUri = new File(fileName).toURI();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile[] files = root.findFilesForLocationURI(fileUri);
CoreModelUtil.findTranslationUnit(files[0]);
Lukas
On Mon, 2011-04-11 at 15:16 +0200, maximed@xxxxxxxxxxxxxxxxxxx wrote:
> Hi all.
>
> I've been looking for it for a long time, but did'nt find it. Is there
> a way to get a file's translation unit from its filename.
>
> I'm looking for something like
> public IASTTranslationUnit getUnitFromFilename(String pFilename),
> or a way do it. The best should be a way to get directlya node selector.
>
> If somebody has time to answer me, thanks in advance.
>
> Maxime
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev