Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

Adding indent to Momentics IDE
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: Adding indent to Momentics IDE
  • SDP: 6.4.1
  • Host: Any supported host
________________________________________________________________________

Recommendation
________________________________________________________________________

When working with code that someone else wrote it can be hard enough to understand the logic behind it. Especially when comments are missing and the used names are ambiguous. In such cases the formatting of the code can be another distraction, yet this can be helped by using a Pretty Printer. The de facto standard for these tools is the GNU indent (http://www.gnu.org/software/indent/). To make Eclipse/Momentics aware of this tool I installed it as an external tool.
First install indent on your machine.

$ sudo apt-get install indent

pretty much did the trick for me. Then open The IDE and select Run->External Tools->External Tools... from the Menu. Now Create a new Program, Name it 'indent', and put the path to the executable in the Location tab. I.e. /usr/bin/indent. The working directory is ${container_loc} and the argument is at least ${resource_name}. In the Refresh tab select to refresh the selected resource, so the result is visible. The indent options I am using are:

-bad -bap -bbb -bbo -nbc -nbfda -br -brs -cdw -ce -di18 -i4 -npcs -npsl
-lp -ip0 -npcs -nsaf -nsai -nsaw -nhnl -ut -prs -sbi4 -sc -sob -ss -ts4

This creates code that looks like it's following SUN's Java Styleguide. I can't deny my roots after all.

To invoke indent select the codefile that needs to be formatted and select 'indent' from the external tool. After the first call, it will be automagically called upon clicking the 'External Tools' icon on the menubar.

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.