Eclipse: Import and Export with Save Actions

You can import and export cleaning as an xml file in Preferences->Java->Code Style->Clean Up .

I want these settings to be applied to the code every time a file is saved.

Unfortunately, when I go to Preferences->Java->Editor->Save Actions , I donโ€™t have the ability to import and export cleaning settings (even if I have the option to manually configure them). Is there a way to import and export these settings?

Explanation: My goal is to create a โ€œClearโ€ option that I can share with my team members so that if any of us save the file, these cleanup options will be automatically applied to the code.

I am using Eclipse 4.3 Kepler.

+6
source share
3 answers

These options are included in the export settings, but only if "Export All" is specified.

It seems that there is no export that just exports these parameters.

Settings are saved in the workspace in the file .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs , but again they are mixed with many other parameters.

+6
source
  • Open the old work file .metadata / .plugins / org.eclipse.core.runtime / .settings / org.eclipse.jdt.ui.prefs.

  • Copy all the "sp_cleanup. *" Properties from the old workspace file and paste into the new one (replacing the old identical properties).

Worked for me!

Seiya !!!: D

+3
source

I just ran some differences from the generated settings file (.epf) and determined the specific entries that need to be added to the settings file to enable the posting feature

They look like this (tested on Eclipse Mars.1):

 /instance/org.eclipse.jdt.ui/sp_cleanup.format_source_code=true /instance/org.eclipse.jdt.ui/sp_cleanup.organize_imports=true /instance/org.eclipse.jdt.ui/editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true /instance/org.eclipse.jdt.ui/sp_cleanup.on_save_use_additional_actions=false 

They will be translated to: Window> Settings> Java> Editor> Save Actions

  • Follow selected actions when saving (checked)
  • Source code format (marked)
  • Format of edited lines (unchecked)
  • Arrange imports (checked)
  • Additional actions (unverified)
0
source

All Articles