Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Can we use Oomph to share and enforce company code format?
Can we use Oomph to share and enforce company code format? [message #1749188] Fri, 02 December 2016 20:13 Go to next message
Mike Muske is currently offline Mike MuskeFriend
Messages: 2
Registered: December 2016
Junior Member
Hi all,
I am attempting to setup code formatting preferences for my company that are identical across all of our projects. Initially I looked at Workspace Mechanic and the Common Preferences plugin, but these seem to have died off after Oomph was introduced - presumably because Oomph does the same things better and offers additional capabilities?

Basically what we are trying to achieve is to define a global code format profile, and use a tool (like Oomph) to keep all of the developers' environments up to date with the central definition. This way a team lead can modify the central code format profile and the change will be pushed to every dev's eclipse the next time it starts up (or better yet at some polling interval).

Is this possible?

I tried to achieve this by creating my own product.setup file with all the plugins/repos we use. I was then trying to populate it with User Preferences by first recording preference changes into my workspace.setup file, and then copying those into the product.setup file. The problem I ran into with the formatter is that the only preference the Oomph recorder saved was the profile name that is selected. Is there a way to include the profile in the setup file as well?

I've seen comments on the forum and in blog articles about using project settings for formatter preferences, but we don't want to do that. We don't work on code external to our company, we always use the same formatter. We don't want to maintain multiple project.setup files every time a format setting changes.

My hope is that after defining a product.setup file with formatter and other preferences, I can host it at an HTTP url, and our developers can point the Eclipse installer at it to install the company flavor of Eclipse. If the installer is pointed at a URL for the product.setup file, does that mean that Eclipse will check this remote product.setup file each time it starts to see if it has changed and then update Eclipse accordingly?

I'm afraid I may be fundamentally misunderstanding Oomph's capabilities. Most of the blogs/docs are more interested in explaining how to roll up all your plugins in a distro, which is neat, but not our main requirement. I'm really hoping Oomph is able to facilitate team code formatting standards because it looks like a lot of thought and effort has gone into this tool, and it seems to be the future of Eclipse preference management.
Re: Can we use Oomph to share and enforce company code format? [message #1749215 is a reply to message #1749188] Sat, 03 December 2016 11:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Mike Muske wrote on Fri, 02 December 2016 15:13
Hi all,
I am attempting to setup code formatting preferences for my company that are identical across all of our projects. Initially I looked at Workspace Mechanic and the Common Preferences plugin, but these seem to have died off after Oomph was introduced - presumably because Oomph does the same things better and offers additional capabilities?

I'd like to think that Oomph does this very well.

Quote:

Basically what we are trying to achieve is to define a global code format profile, and use a tool (like Oomph) to keep all of the developers' environments up to date with the central definition. This way a team lead can modify the central code format profile and the change will be pushed to every dev's eclipse the next time it starts up (or better yet at some polling interval).

Is this possible?

Yes.

Quote:

I tried to achieve this by creating my own product.setup file with all the plugins/repos we use. I was then trying to populate it with User Preferences by first recording preference changes into my workspace.setup file, and then copying those into the product.setup file. The problem I ran into with the formatter is that the only preference the Oomph recorder saved was the profile name that is selected. Is there a way to include the profile in the setup file as well?

Yes. The recorder only detects things you change so if you didn't change the profile itself during the process, but only changes to active profile that was chosen, then only the latter is recorded.

Quote:

I've seen comments on the forum and in blog articles about using project settings for formatter preferences, but we don't want to do that. We don't work on code external to our company, we always use the same formatter. We don't want to maintain multiple project.setup files every time a format setting changes.

Maintaining it in your own Product definition is definitely a way to achieve your goal.

Quote:

My hope is that after defining a product.setup file with formatter and other preferences, I can host it at an HTTP url, and our developers can point the Eclipse installer at it to install the company flavor of Eclipse. If the installer is pointed at a URL for the product.setup file, does that mean that Eclipse will check this remote product.setup file each time it starts to see if it has changed and then update Eclipse accordingly?

Yes, exactly.

Quote:

I'm afraid I may be fundamentally misunderstanding Oomph's capabilities. Most of the blogs/docs are more interested in explaining how to roll up all your plugins in a distro, which is neat, but not our main requirement. I'm really hoping Oomph is able to facilitate team code formatting standards because it looks like a lot of thought and effort has gone into this tool, and it seems to be the future of Eclipse preference management.

So it sounds like the only thing you've missed the recording of the profile itself. If I open a Setup Editor, and use the "Record Preferences" button, and go to the JDT formatter preferences to create a new profile and activate it, I get these recorded tasks:
<?xml version="1.0" encoding="UTF-8"?>
<setup:CompoundTask
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
    name="org.eclipse.jdt.ui">
  <setupTask
      xsi:type="setup:PreferenceTask"
      key="/instance/org.eclipse.jdt.ui/formatter_profile"
      value="_MyFormatter"/>
  <setupTask
      xsi:type="setup:PreferenceTask"
      key="/instance/org.eclipse.jdt.ui/formatter_settings_version"
      value="12"/>
  <setupTask
      xsi:type="setup:PreferenceTask"
      key="/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles"
      value="*** removed because it's very big ***"/>
</setup:CompoundTask>

Note that the setup editor also has a "Capture Preferences" toolbar button that lets you record the current state of any preference as a preference task, so you could find your org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles preference and capture it in your Product setup.

I've used this support in customer projects so this definitely all works. In this case I was captured in a Project setup, but the tasks are the same. Note that for this customer I also defined the profiles for source cleanup and editor save actions. The latter are cool because the files will be formatted when you save them, so they're always in the perfect state.



Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Can we use Oomph to share and enforce company code format? [message #1749453 is a reply to message #1749215] Tue, 06 December 2016 23:15 Go to previous messageGo to next message
Mike Muske is currently offline Mike MuskeFriend
Messages: 2
Registered: December 2016
Junior Member
I cannot tell you how happy I am to hear that this is possible, thank you so much for your fast reply! Also, thank you for all your work in bringing this tool to the Eclipse community, I look forward to getting to know it better.
Re: Can we use Oomph to share and enforce company code format? [message #1749886 is a reply to message #1749453] Tue, 13 December 2016 14:21 Go to previous messageGo to next message
Benjamin Asbach is currently offline Benjamin AsbachFriend
Messages: 1
Registered: December 2016
Junior Member
I basically want to provide the same thing. I wonder if there's a possibility to

a) Replace the entire eclipse products so that only the company products are available
b) Provide an installer which is preconfigured so that no manual step is needed to add the custom product (and project) setup

Thanks in advance
Re: Can we use Oomph to share and enforce company code format? [message #1749937 is a reply to message #1749886] Wed, 14 December 2016 07:22 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Yes, you can host your own Index as described in the authoring guide. Note that the latest version of Oomph has wizards to create all the needed resource types, i.e., the Index, Product and Project catalogs, and of course Product and Projects. Modifying the eclipse-inst.ini lets you specialize your installer. There are documented steps for how to recompose the Windows self-extracting executable.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Uninstalling all JPA plugins from eclipse
Next Topic:Extending 'Eclipse IDE for Java EE Developers' brings in fewer features than expected
Goto Forum:
  


Current Time: Thu Dec 26 21:36:10 GMT 2024

Powered by FUDForum. Page generated in 0.05199 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top