We made an Eclipse CDT plugin in order to create a C project layout that follow certain standard set across our organization. We maintain some sort of XML files that define the project/product dependencies. That means, every product will have an XML file that defines what source files/headers goes into that product.

So, when importing a C project in Eclipse CDT, instead of following the standard CDT project setup, our plugin takes product name as the input and parses the product's XML to generate a C project with appropriate source files.

We were able to attach source files to the C project using the following API and Linked Resources concept in Eclipse.

org.eclipse.core.resources.IFolder
org.eclipse.core.resources.IFile

We were also able to attach header files to the same C project using the following class.

org.eclipse.cdt.core.model.IIncludeEntry

Quote:

Note: We created IIncludeEntry instances with the inlcude directories as the input. Eclipse's scanner discovery mechanism is identifying the individual source files inside each directory and showing them under "Includes" tag in C project.

Now the source files are shown under "Source" tag and the header files are shown under "Includes" tag in the C project. We could modify and build the source files without any issues.

However, we couldn't edit any of the header files. If I manually add an external header file thru Project >> Properties >> C/C++ General >> Paths and Symbols everything works fine, we can edit the files.

I also tried to use org.eclipse.cdt.core.model.IIncludeFileEntry instead of IIncludeEntry by giving individual header file paths to IIncludeFileEntry. But Eclipse isn't identifying anything with IIncludeFileEntry.