Reputation: 129
I have an Eclipse Plugin which contains a certain method foo() in class X.
Class X {
private void foo(){
...
}
}
How can I create an extension point which allows other plugins to replace the implementation of class foo()?
And should I create an extension point and also extend it just like other plugins do? or just provide the base implementation ?
Upvotes: 0
Views: 158
Reputation: 13858
For creating extension points I suggest reading the Extension point tutorial at vogella.de: http://www.vogella.de/articles/EclipseExtensionPoint/article.html It features both an extension point definition and its application.
About your other questions: if you define an extension point for providing class X, you should also use the extension point to get its instance. It may be a fine option that your implementation is the implementation that runs when no extension is provided, otherwise not, but generally it is a good idea for you as well to use the extension (aka eat your own dogfood).
However, keep in mind, that multiple extensions might be available for provider extension, you have to handle that case as well.
About base implementation - it is a nice touch if you provide some kind of abstract base class that other extension providers can override.
Upvotes: 1