This post starts with the question - how the callback method is called in Eclipse Platform.
Short answer is: call back method is called by host plug-in.
The example used is from a previous post which is about creating a sample plugin with a menu through plug-in wizard. I believe anyone who have played a little bit with plug-in has used it before.
The first diagram illustrates the relation between a host plug-in and an extender plugin-in.
As everything in Eclipse is a plug-in, the UI is no exception. Our Sample Action extends its ActionSet extension point. There are also a bunch of other extension points which would share the same principle of callback.
The second diagram is used to show how run() method is called by the host plug-in. (In other cases rather than Action, it could be createPartControl(Composite parent) or others.)
PluginAction stand in the role of proxy, and it causes the real callback object to be instantiated only when some action is required of it.
Here are some facts from the diagram below:
PluginAction implements IAction's run() method.
PluginAction has a IActionDelegate instance.
PluginAction's run() method wrap IActionDelegate's run() method.
This pattern is called: Virtual Proxy.
For complete code of PluginAction.java, reference 2 points to Google code.
This is one of the most important concept in Eclipse, more details will coming soon ...
<pre><code> String foo = "bar"; </code></pre>