Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316143 - LaunchUtils#enableActivity has a UI dependency breaking headless launching
Summary: LaunchUtils#enableActivity has a UI dependency breaking headless launching
Status: RESOLVED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-08 10:32 EDT by James Blackburn CLA
Modified: 2010-06-08 11:51 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Blackburn CLA 2010-06-08 10:32:52 EDT
I have a simple headless IApplication that allows running Eclipse launches (CDI based) from the command line.  It seems this is broken in 7 due to the workbench capabilities being added to Launch:

Caused by: java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
	at org.eclipse.cdt.launch.LaunchUtils.enableActivity(LaunchUtils.java:127)
	at org.eclipse.cdt.launch.AbstractCLaunchDelegate.<init>(AbstractCLaunchDelegate.java:128)
	at com.broadcom.cdt.debug.launch.Launch.<init>(Launch.java:49)
	at com.broadcom.cdt.debug.launch.GDBLaunch.<init>(GDBLaunch.java:54)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
Comment 1 James Blackburn CLA 2010-06-08 10:44:34 EDT
There seem to be a whole bunch of new UI dependencies, including status handlers for save before launch, etc.

I'll put together a patch.
Comment 2 James Blackburn CLA 2010-06-08 11:01:17 EDT
Sigh. I'm a little behind HEAD. I see that in 1.70 ken removed #enableActivity call in the AbstractCLaunchDelegate constructor.
Seems like there's no CDT specific change required.
Comment 3 John Cortell CLA 2010-06-08 11:44:54 EDT
(In reply to comment #1)
> There seem to be a whole bunch of new UI dependencies, including status
> handlers for save before launch, etc.
> 
> I'll put together a patch.

James, the launch plugin has had dependency on UI plugins for quite some time, so there are no build-time guards against adding a UI call in a particular part of the plugin. If there was a code path that was UI-free in the past, and we can reasonably keep it that way, then we should try to. But, again, there's no practical/easy way to guarantee those paths remain UI-free going forward other than to refactor the launch plugin into core and ui plugins.
Comment 4 James Blackburn CLA 2010-06-08 11:51:51 EDT
(In reply to comment #3)
> James, the launch plugin has had dependency on UI plugins for quite some time,

I guess before 7 we've been lucky.

We could always add the headless launch IApp to CDT if that's of interest to anyone else.