Manipulating C++ source file [message #169186] |
Thu, 04 May 2006 12:07 |
Eclipse User |
|
|
|
I am manipulating include statements in a C++ source file using CDT API's
and am facing some problems
I am doing something like this....
ICElement cFile = CoreModel.getDefault().create(currentFile); // Where
currentFile is c++ source file
ITranslationUnit trUnit = (ITranslationUnit) cFile;
trUnit.createInclude(includeSt, true, null, new NullProgressMonitor());
But I have noticed 3 problems...
1. CDT doesn't check for duplication and add the include even if it already
exists.
2 .Also, I see that it doesn't add new line character before the include
statement.
Include statement is added next to an existing include statement
Like #include <abc.hh>#include <abc.hh>
3. Currently, CDT adds the first include statement at the end of the source
file
if sibling argument is null in createInclude(....)
I want CDT to add the statement at the beginning of the file. How can i
achieve that ?
One way is to find whether there are includes and then use the sibling
argument.
But I want to use createInclude(....) with the following params
consistently, irrespective of includes are present or not in a source file
createInclude(includeSt, true, null, new NullProgressMonitor());
I have done the same thing in JDT and it behaves in a normal way
1. It checks for duplication.
2. Add imports in a new line.
3. Add import as a first statement even if import statement or package
statements are not there
Can someone help me and confirm if there is a bug or all the points are
solvable by some means ?
|
|
|
Powered by
FUDForum. Page generated in 0.03922 seconds