Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Open Eclipse, select Window > Preferences.
  2. In the search box,  enter  formatter, then select Java > Code Style > Formatter
  3. In the left right pane, select Import.
    An Import Profile dialog displays.
  4. In the dialog, browse to: openmrs-core/tools/src/main/resources/eclipse, and select OpenMRSFormatter.xml.
  5. Select Open.
    The OpenMRS Formatter shows as the Active profile. See the picture below:
  6. Select Apply and Close.
    Now you can let Eclipse format any java class with the shortcut:

...

  1. Select Window > Preferences.
  2.  In the search box,  enter save actions.
  3. Select Java >  Editor > SaveActions.
  4. Select radio buttons and checkboxes to match the image above.
  5. Select Configure.
    The Additional Save Actions dialog displays.
  6. Select the Missing Code tab, select ALL the checkboxes and select OK.
  7. Select the Unnecessary Code tab, and select the checkboxes as the picture below:

  8. Make sure that NOTHING is selected in the Code Organizing, Code Style, and Member Accesses tabs. Select OK to close each tab. 
  9. Select Apply and Close.
    Now when you change a class and save it, Eclipse will format the code for you according to your formatter settings and organize the imports according to the import settings.

Import OpenMRS Code Templates

...

  1. Select Window > Preferences.
  2. In the search box, enter maven (Or search for User Interface).
  3.  Select  Maven > User Interface.
  4. Select the Open XML page in the POM editor by default check box.
  5. Select Apply and Close.

...

To learn more about Eclipse go to: How to Set Up and Use Eclipse.