我正在使用Maven/Tycho构建Eclipse RCP产品,并需要使其加载 plugin_customization.ini
具有某些产品首选项的文件,并且无法实现这一目标。
我尝试的
启动参数
是我在产品的启动参数中添加了 -plugincustomization
。这与 plugin_customization.ini
文件的本地路径一起工作。但是,在最终产品中, plugin_customization.ini
文件包含在捆绑包中,但我无法访问。带有平台的URI:/plugin/
后缀不起作用。
config.ini
添加与 eclipse.plugincustomization
键的值相同的产品键的键 proceed config.ini of产品的具有相同的问题。它可以访问本地文件,但不能访问产品捆绑包中的文件。
我不知道将 plugin_customization.ini
直接添加到任何捆绑jar外部的产品的可能性。
org.eclipse.core.runtime.products.products
根据文档扩展
您可以将 plugin_customization.ini
作为 preferenceCustomization
属性的值 org.eclipse.core.runtime.products
产品插件中的扩展。也没有成功。
我还没有尝试的是,
而不是加载 plugin_customization.ini
我可以添加一个带有激活器的捆绑包,该捆绑包在启动时设置了所需的首选项。这似乎是有些过度的,因为有上述设定偏好的方式。但是,那将是我的最后一个手段。
问题
- 是否可以将文件(在这种情况下为
plugin_customization.ini
)添加到JAR外的Eclipse产品中?如何?
-
platform:/plugin/
uri原则上与启动参数合作或在 config.ini
中使用,还是有其他替代方案可以访问捆绑包中的文件?
- 我还能尝试什么?
Eclipse版本
- :2022-03
- Maven:3.6.3
- 平台:Ubuntu 20.04
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
- Is it possible to add a file (
plugin_customization.ini
in this case) to an Eclipse product outside of a jar? How?
- 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?
- What else can I try?
Versions
- Eclipse: 2022-03
- Maven: 3.6.3
- Platform: Ubuntu 20.04
发布评论
评论(1)
将我的项目与 org.eclipse.core.runtime.products 扩展程序不起作用。
要在
.prouduct
文件中连接产品定义与Eclipse插件中的产品扩展,您必须确保两件事(我两者都做错了):application 产品定义中的类必须与 application 在
org.eclipse.core.core.runtime.products
扩展设置中的输入(如@howlger已经指出) 。产品定义(
.product
编辑器)中的 product 必须指向org.eclipse.core.core.runtime.products
插件的扩展。实现那就是 product 值必须具有格式
<插件ID>。扩展ID>
。将其存储为product
标记.product
file。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 theorg.eclipse.core.runtime.products
extension of the plugin. To achievethat, the Product value must have the format
<plugin ID>.<extension ID>
. This is stored asid
attribute of theproduct
tag in the.product
file.