Add headless capability to existing eclipse plugin

寵の児 提交于 2019-12-05 23:54:08

It depends on how you plan to use this plugin and the main question: is there a case, where your UI dependencies will not be available, i.e. whether there is a bundle configuration without SWT and RCP bundles?

No UI available

In this case, you'll need to extract the headless part of your plugin into new plugin, which then registers the headless entry point to it. The UI part of the plugin will depend on the new plugin and just delegate UI requests to the appropriate API in the headless part.

In order to provide headless application, you should take a look at org.eclipse.equinox.app.IApplication interface and respectively org.eclipse.equinox.applications extension point. When you've defined the application, you launch it by simply invoking:

eclipse -application <app-id> <app-param>

More information can be found in Eclipse Help.

UI available

The simpler case. Only the headless entry point needs to be specified and everything will work as previously.

My experience, however, shows that sooner or later, the case arise where the plugin needs to be split and depending on its complexity it might cause more trouble than it would have been if it was split earlier.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!