I have been using Eclipse CDT for some time now, and I love it, but there are a few tedious things that I would like to fix up about it.
When you create a new file, one of the options is “New”->”Class”. I was wondering if anyone knows of a way to edit the “${declarations}” section of this “Class” template.
To be more specific, I have looked through the “Window”->”Preferences” menu and been unable to find anything. I have changed both “C/C++”->”Code Style”->”Code Templates” and “C/C++”->”Editor”->”Templates”. Only the first of the two actually seems to change what appears upon class creation, and it doesn’t let me change what is in the “${declarations}” section. Does anyone know how to change this?
Thanks,
Chris
The preference
C/C++ -> Editor -> Templatesis used by the templates which are inserted manually via Context Assist. Try create a new file, typeclasand pressctrl+spacefor context assist. You should get two assist proposals: a keyword proposal and a template proposal (the latter will also be triggered automatically as default if you typeclassand pressctrl+space).Upon selection of the template proposal, a class body will be generated according to the template which you can define in this preference.
As for
C/C++ -> Code Style -> Code Templates, this is used in automatic generation. When you use the New Class wizard, theDefault C++ Source templateandDefault C++ Header templateare used and the$(declarations)variable is replaced by whatever code is generated by the New Class wizard.This would mean that you can use a custom template by triggering one of the Editor templates manually, possibly via creating a named class with New Class wizard and then replacing the default class body in header by your custom template.
Or do you suggest that the New Class wizard lacks any important fields and should be extended?