Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Setup tasks for preferences(Can I associate preference tasks with a product?)
Setup tasks for preferences [message #1851054] Fri, 25 March 2022 18:10 Go to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 149
Registered: March 2010
Senior Member
Hello,

I am a new user of Oomph. I am switching from using scripts that invoke P2 director to provision plugins and edit workspace preference files.

I have so far achieved the following:


  1. Created a product model with my repositories and features
  2. Recorded preferences in my user.setup file


I used the product model with the installer to deploy and IDE that has several plugins from many repos (JDT, m2e, egit, eclemma, pmd, checkstyle, genuitect theme, etc etc etc). This works well.

The second part works well FOR MYSELF ONLY: any workspace I create has the preferences I defined. But my questions is:

I would like to be able to share the preferences in my user.setup file with others. What is the best way to do this?

Ideally I would like to bundle the user.setup with the product: whenever the product opens and/or creates any workspace, it should also apply those preferences as part of opening the workspace. Is that possible?
Re: Setup tasks for preferences [message #1851064 is a reply to message #1851054] Sat, 26 March 2022 06:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33145
Registered: July 2009
Senior Member
Of course you can put a preference task anywhere that you can put any other task, e.g., in your product setup. Also, even if you have a preference task in the product setup, a user could have a preference task in their user.setup for the same preference to override the preferred value.

It is possible to share tasks using macros:

https://wiki.eclipse.org/Eclipse_Oomph_Authoring#Macros_and_Macro_Expansion_Tasks

But I don't see a real use case here for that here. Your product setup should decide which preferences are appropriate to set in general when the product is used by anyone and everyone while your user setup should decide which personal preferences you want across all products and workspaces you use...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Setup tasks for preferences [message #1851068 is a reply to message #1851064] Sat, 26 March 2022 15:58 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 149
Registered: March 2010
Senior Member
Hello Ed,

Thanks for your pointers. I ended up NOT using the macro tasks but just defining compound tasks under my product model (first level under root) with children of type "Preference". Like you said it just makes sense and was what I was looking for.

It was just not clear I could do that and I couldn't find it in any documentation I read...

To spell it out for people like me who don't have much context, below is a bullet list for MANUAL steps to explain what is happening, BUT after this I have a cool AUTOMATIC way of quickly doing this without manual entry:


  • Select "New Child" and then "Compound"
  • Click on the new "Compound" node in the tree and in the properties view set a name like "User preferences"
  • Right-click on the "User preferences" node and create a "New child" again of type "Compound"
  • Click on the new compound and in the properties view give it the plugin name for which you want to set preferences (e.g. "org.eclipse.ui.editors")
  • In the plugin compound you created, right-click and select "New child" but this time use child of type "Preference"
  • In the properties view enter the key/value of the new preference (e.g. key=/instance/org.eclipse.ui.editors/printMargin and value=true)


Basically you don't need to group preferences into one compound per plugin, you could just define them all in a single "User preferences" compound. You need to set each preference ID and its value and then when the product is installed it will configure these for workspaces created by it.

HERE IS THE COOL WAY OF DOING THIS


  1. Use the preference recorder to record settings into your user.setup file
  2. Choose menu entry: Navigate -> Open Setup -> User
  3. Lay out your product model editor and user.setup editor next to each other
  4. Drag the "User Preferences" node from the user.setup editor into the product model editor (drop on the root node)
  5. DONE!


Basically the manual approach I described was replicating what the preference recorder generates for user.setup, but this is a very useful way to collect preferences and add them to the product in one drag-and-drop step.

I found this while reviewing user.setup in the editor. I thought I'd try it and started replicating the layout of user.setup manually in my product model. After 2-3 preferences, it dawned on me that this is likely some EMF-based editor, so drag-and-drop should work ...and it did!

I deleted my user.setup after copying them to the product model and created a new product installation. Launching the product created a workspace with those preferences pre-configured as I like them.
Re: Setup tasks for preferences [message #1851077 is a reply to message #1851068] Sun, 27 March 2022 06:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33145
Registered: July 2009
Senior Member
There are several other ways to do this. When a setup editor is open (which is indeed an EMF editor), the toolbar has buttons for Record Preferences, Capture Preferences, and Import Preference. The first will record any changes you make into the setup you have open; but it only record changes you make.... The Capture Preferences shows all preferences and you can convert any of them to preference tasks. The Import Preference can take the preferences you've exported from some IDE and convert them to preference tasks.

Sorry that the documentation is lacking. It would be great to have a week or two to write a manual that describes each task and all its properties with examples, as well as a better overview of all the tools...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:GitClone tasks and GitHub tokens
Next Topic:Issues Eclipse DE
Goto Forum:
  


Current Time: Tue May 07 11:08:32 GMT 2024

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

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

Back to the top