Skip to main content

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

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);
@SuppressWarnings("restriction")
ExtensionRegistry extensionRegistry = (ExtensionRegistry) Platform.getExtensionRegistry();

@SuppressWarnings("restriction")
Field declaredField = ExtensionRegistry.class.getDeclaredField("masterToken");
declaredField.setAccessible(true);
Object masterToken = declaredField.get(extensionRegistry);

@SuppressWarnings("restriction")
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,


Back to the top