Home > Blockchain >  Cannot add a plugin customization to an Eclipse product built with Tycho
Cannot add a plugin customization to an Eclipse product built with Tycho

Time:06-14

I'm building an Eclipse RCP product with Maven/Tycho and need to make it load a plugin_customization.ini file with certain product preferences and cannot achieve this.

What I've tried

Launch arguments

I've added -pluginCustomization to the launch arguments of the product. This works with a local path to the plugin_customization.ini file. However, in the final product the plugin_customization.ini file is contained in a bundle, but I cannot access that. A URI with the platform:/plugin/ suffix does not work.

config.ini

Adding the same as value of the eclipse.pluginCustomization key to the generated config.ini of the product has the same problem. It can access the local file, but not the one in a product bundle.

I couldn't figure out any possibility to add the plugin_customization.ini directly to the product outside of any bundle jar.

org.eclipse.core.runtime.products extension

According to the docs you can pass a plugin_customization.ini as value of the preferenceCustomization property of a org.eclipse.core.runtime.products extension in a product plugin. Also without success.

What I didn't try yet

Instead of loading a plugin_customization.ini I may add a bundle with an activator that sets the required preferences on startup. That seems to be some overkill, because there are the above means of setting preferences. However, that will be my last resort.

Questions

  1. Is it possible to add a file (plugin_customization.ini in this case) to an Eclipse product outside of a jar? How?
  2. Does the platform:/plugin/ URI in principle work with launch arguments or in a config.ini or is there an alternative to access a file in a bundle?
  3. What else can I try?

Versions

  • Eclipse: 2022-03
  • Maven: 3.6.3
  • Platform: Ubuntu 20.04

CodePudding user response:

After comparing my project with the project mentioned in @howlger's comment to the question, I found out why my third attempt with the org.eclipse.core.runtime.products extension didn't work.

To connect the product definition in the .product file with the product extension in an Eclipse plugin you have to ensure two things (which I did both wrong):

  • The Application class in the product definition has to be the same as the application entry in the org.eclipse.core.runtime.products extension setup (as @howlger already pointed out).

  • The Product in the product definition (of the .product editor) has to point to the org.eclipse.core.runtime.products extension of the plugin. To achieve that, the Product value must have the format <plugin ID>.<extension ID>. This is stored as id attribute of the product tag in the .product file.

  • Related