Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Storing formatter profile in plugin
Storing formatter profile in plugin [message #1005514] Fri, 25 January 2013 14:45 Go to next message
Joseph Carroll is currently offline Joseph Carroll
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

I am familiar with the code formatter and how to create/modify to your liking. I am also familiar with the process of defining plugin specific settings to use specific formatters.

We are just now starting to use custom profiles in our development. Since we have multiple teams working on plugins, I created the profiles and then exported the xml files and saved them in the .settings folder of the plugin. I then changed the org.eclipse.jdt.ui.prefs to reflect the following:
...
cleanup_profile=JavaCodeStyle.CleanUp.xml
formatter_profile=JavaCodeStyle.Format.xml

However, looking at the plugin properties for Clean Up & Formatter it now states:
"Unmanaged profile 'avaCodeStyle.CleanUp.xml'"
"Unmanaged profile 'avaCodeStyle.Format.xml'"

Are there any drawbacks to having an "Unmanaged profile" ?
[Besides not being able to edit the profile directly]

This was the best way I could think of to ensure everyone is using the same profile and settings no matter what.

Thanks,

JD

[Updated on: Fri, 25 January 2013 14:47]

Report message to a moderator

Re: Storing formatter profile in plugin [message #1032889 is a reply to message #1005514] Wed, 03 April 2013 11:14 Go to previous message
Joseph Carroll is currently offline Joseph Carroll
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

I was just asked if there was any update on this thread, so here is what I have learned since the original post:

The clean-up, formatter, and other code style engines read their settings directly from the preferences files located under your.project.name -> .settings folder. Thus, specifying an outside file does not work.

The best way I have found to handle this is to just remove the profile names from the preferences file. This will cause the profile to be listed as 'Unmanaged Profile' and prevent someone from changing the settings directly.

For example: For the Formatter & Clean-Up engines, create your project specific settings and name the profile "Project Specific Settings". To open the preferences file, navigate to your.project.name -> .settings -> org.eclipse.jdt.ui.prefs. In this file there will be entries:
cleanup-profile=_Project Specific Settings
formatter_profile=_Project Specific Settings

Delete both of these entries from the file and you'll be all set. Then, for any project that you want to share the settings just copy the files org.eclipse.jdt.ui.prefs & org.eclipse.jdt.core.prefs into the respective .settings folders and you'll be all set.

I suppose at some point it would be possible to create a central profile somewhere and have the projects do a one time read at start-up from this location. But someone much more familiar with the code with have to implement that, if it is even desired.

Thats my update, happy formatting!

JD
Previous Topic:Some trouble with rcp.
Next Topic:Foreground color not applying
Goto Forum:
  


Current Time: Fri Aug 29 10:16:18 EDT 2014

Powered by FUDForum. Page generated in 0.02581 seconds