0

When writting RCP Plug-ins it often happens that i need to declare and reference IDs in the extension specification (i.e. in the plugin.xml) and also in my java code. When I change one of those, I also have to change the duplicate.

I'm not sure if the problem is already that the same IDs must be used in the code and the plug-in declaration, but thats how the eclipse plug-in templates do it. If that's the root of the problem: how to prevent it?

If it's the correct way, to declare and reference IDs in the plugin.xml and in the java code: how to prevent that code dulication?

Also inside the plugin.xml there is something that may be regarded as duplication: ID definitions and the references pointing at them. If I change the definition, all references have to be updated. One could do that by simply replacing all text-occurence. But I normally edit the plugin.xml in the Plug-in Manifest Editor (i.e. in the forms, not in the plain text XML). Is there a way to refactor the IDs from inside the forms, without touching the plain text xml and without the fault prone approach of simple text replacement?

Waog
  • 7,127
  • 5
  • 25
  • 37
  • Why are you changing extension ids? If you choose reasonable ids to start with it should not be necessary to change them. – greg-449 Jul 02 '14 at 16:59
  • This can have different reasons: In my case it's just because I'm experimenting and not sure how to do it, at the beginning. So I don't know the final *reason* to act reasonably. In general, it could be very normal, that the requirements to the final plug-in change slightly (e.g. in agile processes), though you have to rename your existing IDs to better describe the new requirements. It's not that uncommon to change existing code, neither should it be to change existing IDs. – Waog Jul 02 '14 at 20:40

1 Answers1

0

If you are referring to properties such as Bundle-SymbolicName then you should think of it as a package name, i.e something that shouldn't change at all. Several of the other fields can very easily be externalized to strings, this is to simplify translations. See this help page. A wizard is available on the overview tab in the manifest editor.

Fredrik
  • 10,626
  • 6
  • 45
  • 81