Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Implement plugin/feature toggle
Implement plugin/feature toggle [message #1774014] Mon, 09 October 2017 08:42 Go to next message
Shane Mills is currently offline Shane MillsFriend
Messages: 9
Registered: May 2014
Junior Member
I would like to decide on startup of the eclipse application whether a certain plugin should be loaded or not based on a property from the config.ini.

The plugin contains a new feature for our eclipse 4 rcp application that is in a beta state. We would like to deactivate the plugin on default, but allow our customers to activate it using a special property in order to test it.

When the property is not set, the plugin should not contribute anything to the application.

What options do I have to realize this feature toggle mechanism?

I have looked into some functions like the BundleActivators for instance, but they do not seem to do what we desire in this case. I know, that throwing an Exception from within the BundleActivator.start() method should lead to the plugin being unloaded, but this also leads to a lot of Stacktraces in the logfiles.

Is there an existing mechanism that would help us with this requirement?
Or are there any ideas on how I could achieve the described behavior?

Thanks in advance for any help and/or ideas :)
Re: Implement plugin/feature toggle [message #1780760 is a reply to message #1774014] Fri, 26 January 2018 16:44 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 431
Registered: July 2009
Senior Member

Hi Shane,

OSGi was build with exactly this in mind [1], HOWEVER, ironically, Eclipse does not support dynamically installing bundles that contain extension points.

Some ideas for you to play with (hopefully not too late):

You can ship the bundles as jar files in a special plugin. Then, when the user flips the button, you can install the jar in your runtime.

    BundleContext c = FrameworkUtil.getBundle(getClass()).getBundleContext();
    Bundle b = c.installBundle("....");


The result is probably not persisted across restarts so you may have to hack and fiddle for optimal results.

You can also use a special bundle from apache that monitors a directory [2]. This works really well but beware the however before.

You can also try to use the dropins directory that P2 provides. Same thing as the apache bundle but not dynamic (requires a restart).

Finally, you can take a look at how P2 installs features from an update site. It looks like you can use the class org.eclipse.equinox.internal.p2.director.app.DirectorApplication for this (I guess you can use the run method with the arguments from [3] here. There also us a UI that you can inspect [4]

Cheers,

Wim



[1] https://en.wikipedia.org/wiki/OSGi
[2] http://felix.apache.org/documentation/subprojects/apache-felix-file-install.html
[3] https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html
[4] https://wiki.eclipse.org/Equinox/p2/Installer
Previous Topic:"Show List" button for parts stack
Next Topic:Change <launcher>.ini File
Goto Forum:
  


Current Time: Wed Sep 19 22:44:01 GMT 2018

Powered by FUDForum. Page generated in 0.01396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top