Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the default code formatting and template for a new workspace

Tags:

java

eclipse

Eclipse allows Java class files to use custom formatting and templates. The normal way to change these settings is from the Windows | Preferences menu and then Java > Code Style in the preferences dialog. The formatter governs how braces, indentation etc. works. The template governs what sort of file, class and method headers appear in a new class file.

I have two files for these settings which I must import and set to take effect. Sometimes I create a workspace and forget to set the template. Then formatting picks up the wrong style or omits the boiler plate which if I don't catch at checkin time. This causes the file to be non standard and can cause merge conflicts for other people and vice versa to me if they make the mistake.

Is it possible to modify Eclipse easily so that it always defaults to the custom formatting and template when creating a new workspace? Even if I have to put the XML into the Eclipse folder somewhere and tweak some setting I would like to be able to do this and put instructions out for others in my team to do the same.

like image 892
locka Avatar asked Sep 04 '12 10:09

locka


1 Answers

Have a look at Workspace Mechanic. It synchronizes workspace properties over different workspaces. So also new one. You can copy your reference-workspace configuration into the workspace mechanic directory and it will automaticcally be installed in new workspaces.

like image 118
Kai Avatar answered Oct 22 '22 20:10

Kai