inger
inger

Reputation: 20184

Open Eclipse View in RCP headless mode?

I have headless (CLI) RCP app, normally handling command line options, but i'd occasionally need to show parts of the a gui anyway. Is there a way to open a view part standalone(detached is fine) when PlatformUI/Workbench is not running?

WorkbenchPage.showView(the one I'd normally use to open the view) normally throws "workbench is not running" exception, which is expected of course in headless mode.

Is there some reasonable hack to do this? I tried running the RCP workbench with the event loop - the problem is that it's blocking execution and it seems too heavyweight.

I know I can create new Shell embedding the widget of the view, for it but then I'd miss the toolbars/menus that come with the proper view.

Upvotes: 0

Views: 385

Answers (2)

Georgian
Georgian

Reputation: 8960

Exclude the concept of RCP, and work with SWT/JFace components only.

Build some factory methods that simulate PlatformUI.createandRunWorkbench. Instead, they will create Shells and run the event loops themselves.

To me, this seems like a bit of an overkill if the app is going to be large. It it's not THAT enterprise-ish, then I guess you could do without the workbench framework. Be careful for dangling resources, though.

Upvotes: 1

greg-449
greg-449

Reputation: 111142

All the UI code is completely dependent on the workbench running. The workbench must be started with PlatformUI.createandRunWorkbench. So it is not possible to show a UI without doing this.

The simple SWT only Shell seems the easiest way.

Upvotes: 2

Related Questions