formatter-maven-plugin icon indicating copy to clipboard operation
formatter-maven-plugin copied to clipboard

Support for Eclipse Save Actions

Open maggu2810 opened this issue 10 years ago • 6 comments

The Eclipse IDE support Save Actions for Java files. There are additional actions that are not covered by the formatter. For example you can configure that the final keyword should be used where possible (IMHO a good practice). I think this includes also #51

maggu2810 avatar Mar 06 '16 22:03 maggu2810

@maggu2810 is it possible that you could add this logic? I'm all for it but don't have much time to spend in this area.

hazendaz avatar Mar 10 '16 02:03 hazendaz

Same here... But if I find some time, I will have a look at.

maggu2810 avatar Mar 10 '16 09:03 maggu2810

I have long searched for a solution to apply save actions automatically. The problem is that those cannot be exported to an .xml file nor be applied to a codebase (at least not to my knowledge, the only option is to save each file manually in the editor). However recently I figured out there is also Clean Up formatter that can be exported to xml and applied via Source->Clean Up to entire source trees. Not sure if they contain 100% same settings but most of it seems to be same.

Could it be possible to implement this issue just by running the Clean Up .xml as e.g. configFileCleantUp setting?

Bonus points if it is possible to configure Members Sort Order (Java->Appearance->Members Sort Order), as that setting seems to be global (i.e. non-exportable to .xml) and influences in which order members are sorted for the "Sort members" action.

bjakke avatar Feb 16 '17 07:02 bjakke

I really great feature would be if the plugin could handle Oomph setup files. This files could contain the whole Eclipse IDE setup, so also save actions, clean up rules, formatter, ...

But similar to @hazendaz, I have no time to implement this feature myself.

maggu2810 avatar Mar 02 '17 10:03 maggu2810

Looks like they have published new artifacts to Central after this issue was created.

http://jmini.github.io/blog/2017/2017-01-10_use-eclipse-jdt-in-java-app.html

https://objectteams.wordpress.com/2017/01/09/eclipse-neon-2-is-on-maven-central/

I suspect one can find out how to do it by looking around here: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/plain/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/

In this lib: https://repo1.maven.org/maven2/org/eclipse/jdt/org.eclipse.jdt.ui/3.15.0/

tomasbjerre avatar Nov 01 '18 12:11 tomasbjerre

I think it might be better to pursue Eclipse upstream adding configuration options to the formatting code which support the missing "save action" features that aren't already in the formatting code. The weirdest part of this for me is that they have two separate, overlapping, formatting features.

ctubbsii avatar Nov 01 '18 17:11 ctubbsii

Closing issue as out of scope for formatter plugin. I agree it would be nice to have a save event but as it stands this is not the right plugin for such as it only deals with formatting. I also think latest Eclipse may have gotten rest of the mixed usage and formatting is an option there now in save to address. However, if something is still missing, let us know so long it is for formatting only.

hazendaz avatar Mar 17 '24 05:03 hazendaz