Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Registering Extensions dynamically to eclipse extension registry

I have not really used the dynamic contributions stuff in the extension registry.  But I do know there is a testcase that "tests" it at:

Perhaps having a look at that may help.  I'm fairly certain you should not be using reflection to do this.


From:        Awanthika Senarath <wnthksnrth@xxxxxxxxx>
To:        eclipse-dev@xxxxxxxxxxx
Date:        05/09/2016 07:33 AM
Subject:        [eclipse-dev] Registering Extensions dynamically to eclipse        extension registry
Sent by:        eclipse-dev-bounces@xxxxxxxxxxx

Hello devs,

Im trying to do subject as follows,

InputStream inputStream = generateInputStream(displayName, bundle);
String bundleIdStr = String.valueOf(bundle.getBundleId());
String bundleName = bundle.getSymbolicName();
IContributor contributor = new RegistryContributor(bundleIdStr, bundleName, null, null);
ExtensionRegistry extensionRegistry = (ExtensionRegistry) Platform.getExtensionRegistry();

Field declaredField = ExtensionRegistry.class.getDeclaredField("masterToken");
Object masterToken = declaredField.get(extensionRegistry);

boolean addContribution = extensionRegistry.addContribution(inputStream, ContributorFactoryOSGi.createContributor(bundle42), false,
null, null, masterToken);

The method "extensionRegistry.addContribution" return true, but when I iterate over the registered items for the particular
extensions point after this method, I'm unable to find this registration I did dynamically.

If it returns true does not that mean that the dynamic registration was successful?
Why am I not able to see it in the ExtensionRegistry?

Appreciate your feedback..

Awanthika Senarath

Software Engineer
WSO2 Inc,
eclipse-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top