Prevent Bundle from being loaded [message #894056] |
Fri, 06 July 2012 09:56  |
Eclipse User |
|
|
|
Hi,
I have a Plug-In which makes contributions to the Eclipse UI (Views/Perspectives) via Extensions (plugin.xml). Depending on a license check I want the views not to be visible at all.
My idea was to prevent the bundle from being loaded or stop/uninstall it after the license check was negative. Unfortunately all my attempts failed (the views are visible but their classes can not be loaded, so they only show exceptions).
Do you have any ideas how to do this?
Thanks in advance!
Ralph
|
|
|
|
Re: Prevent Bundle from being loaded [message #894338 is a reply to message #894056] |
Sun, 08 July 2012 09:31  |
Eclipse User |
|
|
|
Hello,
one method to consider may be something like this:
1. Create IStartup class that will be checking licence (or whatever
appropriate) and bind it using org.eclipse.ui.startup extension point
(1). Plug-in referred in this extension point will be started when
Eclipse starts.
2. If license check failed in early startup plug-in, uninstall bundle
programmatically with Bundle.uninstall() method (2). List of installed
bundles can be achieved from BundleContext.getBundles() method.
3. As Gunnar said, uninstalled bundles, not surprisingly, do not
contribute to UI anymore.
(1)
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-capabilitiespref.htm
(2)
http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#uninstall()
Libor
On 07/06/2012 03:56 PM, Missing name Mising name wrote:
> Hi,
>
> I have a Plug-In which makes contributions to the Eclipse UI
> (Views/Perspectives) via Extensions (plugin.xml). Depending on a license
> check I want the views not to be visible at all.
> My idea was to prevent the bundle from being loaded or stop/uninstall it
> after the license check was negative. Unfortunately all my attempts
> failed (the views are visible but their classes can not be loaded, so
> they only show exceptions).
>
> Do you have any ideas how to do this?
>
> Thanks in advance!
> Ralph
|
|
|
Powered by
FUDForum. Page generated in 0.04139 seconds