Use fragment to replace resource file in Eclipse plugin

315 Views Asked by At

I have an Eclipse plugin containing a resource file (resource.xml) which is loaded by the source code. This plugin is used in two applications, one base and one derivative, and I want to use a different resource.xml file in the derivative application.

I've been investigating Eclipse fragments as a possible way of doing this, but all results my research has turned up either described how to replace .class files or have only described fragments at a very abstract level.

Now I ask, is there a way to do this using fragments, or am I investigating a dead end?

1

There are 1 best solutions below

1
On BEST ANSWER

Probably the best way is to use two fragments with the two resource.xml files in these fragments. You would only include one of the fragments in each application. The parent ('host') plug-in would not include the resource.xml at all.

You need to be sure to use the appropriate APIs (such as FileLocator) to find the resource.xml so that the fragments are searched.