views:

414

answers:

1

In my plugin de.support.help are the plugin.properties files. These properties files include the strings for the preference page.

I want to use this plugin for different customers, but the customer name is inside the properties files.

I want to patch the properties files by using the eclipse fragment mechanism. As far as i now the fragment plugin can patch the coresponding plugin at runtime.

I do have the file plugin.properties in plugin de.support.help which includes the line

plugin.name = Copyright XYZ

And i do have the fragemt de.support.help.fragment which includes the file plugin.properties with line

plugin.name = Copyright ABC

I expect that at runtime the string "Copyright ABC" is shown, but it is not. I had tested the same with java classes a long time ago and i remember that t his was working. The java code from the fragment was placed to the original plugin.

Do you have any idea to handle this? Or do i misunderstand the fragment mechanism?

Thanks

EDIT:

When i remove the plugin.properties file from the de.support.help plugin it works as expected. The fragment file is copied into the plugin directory and is used at runtime.

Or do i have to patch the somce eclipse class Can_fragments_be_used_to_patch_a_plug

+1  A: 

According to How to Internationalize your Eclipse Plug-In article

A plug-in fragment provides additional functionality to its target plug-in.
At runtime, these plug-in contributions are merged along with all dependent fragments.

These contributions can include code contributions and contributions of resources associated with a plug-in, like property and HTML files.

In other words, the plug-in has access to the fragment's contents via the plug-in's classloader.

The Eclipse Platform merges plug-in fragments in a way that the runtime elements in the fragment augment the original targeted plug-in.
The target plug-in is not moved, removed, or modified in any way.

Since the fragment's resources are located by the classloader, the plug-in developer has no need to know whether resources are loaded from the plug-in's JAR file or one of its fragments' JAR files.


I suspect the classLoader detect plugin.name in the de.support.help plugin first before the de.support.help.fragment fragment.

At this point, I am not sure it can be done, since it has been attempted before (for the Eclipse CheckStyle plugin), without much success.

VonC
That sounds like it is not possible with resource files. But with Java classes it is working. Maybe i can patch the eclipse bundle loader to look first in a fragment and than in the plugin.
Markus Lausberg