Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Re: Documentation on PathEntry Containers

I managed to get this working by extending my toolchain from a GNU
Makefile toolchain. So now the new include path is added to the
.cproject as gnu.cpp.compiler.option.include.paths and seems to be
persistent from session to session. But I would also like to add a
PathEntry container, because the include paths might change from time
to time and creating a custom container seems like the best way to
manage them.

I hooked into the org.eclipse.cdt.core.pathEntryContainerInitializer
extension and created my own initialiser. Currently it does nothing,
just prints out some text to tell me that the container is being
loaded. Also I created another container that contains a constant Path
called CONTAINER_ID, which is set to Path("initializerExtensionID");,
as mentioned in some posts. Then I create the container entry using
the following line:
                IContainerEntry
conEntry=CoreModel.newContainerEntry(IncludePathContainer.CONTIANER_ID);
Then I add the container entry just like added the include path
mentioned in my original path. However the container entry does not
appear to be added to the array that is returned by
getRawPathEntries(), which I call after I update the entries with
setRawPathEntries(). The initializer does not get called either, even
after I restart eclipse.

Any suggestions on what could be wrong?

Cheers,
Karol Krizka
http://www.krizka.net

On Wed, Jun 25, 2008 at 11:23 AM, Karol Krizka <kkrizka@xxxxxxxxx> wrote:
> Hi,
>
> I am trying to programittically add external include paths from a CDT
> plugin that I am writing. After doing some search, I found several
> posts about PathEntry Containers and they seem to do exactly what I
> need. However all those posts talk about what PathEntries do, but now
> how to do them. So I was wondering, could someone point me to som
> simple examples or documentation?
>
> I did find the following
> page:http://dev.eclipse.org/viewcvs/index.cgi/cdt-core-home/docs/qnx/cpathentry.html?root=Tools_Project&revision=1.11
> And I tried to do a modify the include entries using the following
> code placed in a process that is called the by CDT template engine.
> But after I tried to look into the .cproject and .project files and
> there were no path entries specified.
> IIncludeEntry in=CoreModel.newIncludeEntry(project.getFullPath(),
>                                                                                                        Path.EMPTY,
>                                                                                                        new Path("/home/kka34/include"),
>                                                                                                        true);
> IPathEntry newe[]={in};
> try
> {
>  CoreModel.setRawPathEntries(cProject, newe, null);
> }
> catch(CModelException e)
> {
>  e.printStackTrace();
> }
>
>
> --
> Cheers,
> Karol Krizka
>


Back to the top