Reputation: 373
Creating the extension point:
Attach to extension point class:
Can I add factory class to the custom extension point, which returns a different class depending on some rule?
Upvotes: 0
Views: 116
Reputation: 111142
To make your class a factory it can implement the IExecutableExtensionFactory
class, The Eclipse extension manager will call the
public Object create() throws CoreException
method to ask your factory to create the extension class.
Many factory classes also implement IExecutableExtension
which has the single method:
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException
The extension manager will call setInitializationData
before calling create
. It gives you the entire configuration element from the plugin.xml so you can look at any attributes you want.
Upvotes: 1