Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328295

Summary: Launch button disabled after failed launch
Product: [Eclipse Project] Platform Reporter: Ben Vitale <bvitale3002>
Component: DebugAssignee: Platform-Debug-Inbox <platform-debug-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, gergely.nagy
Version: 3.6.1   
Target Milestone: 3.6.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Bundle that shows the problem
none
patch none

Description Ben Vitale CLA 2010-10-20 16:33:48 EDT
Build Identifier: 20100917-0705

If an exception is thrown by a LaunchConfigurationDelegate during a background launch, and the exception has an associated status, AND the status has an associated handler, the launch configurations dialog is opened and the status is handled.

In Eclipse 3.5, the launch button ("Debug") was enabled once the dialog appeared.

In Eclipse 3.6.1, (and probably 3.6), the launch button is disabled once the dialog appears. I don't think this is intended. It looks like this was potentially broken by the same changes that resulted in bug 321850. The logic to enable the launch button is never executed.

Workaround: Trigger the configuration to be validated (e.g. select another tab) which will enable the button if all is well.

Reproducible: Always

Steps to Reproduce:
1. Create a custom status handler
2. Throw a CoreException with the associated status from a launch delegate
3. Run a launch which triggers the exception.
4. Attempt to re-launch immediately by clicking the launch button for the configuration that is displayed as a result of the failed launch.

Expected: The button is enabled and you can re-launch.
Actual: The button is disabled.
Comment 1 Darin Wright CLA 2010-10-21 14:24:43 EDT
I'm not seeing the problem. I hacked a Java Application to throw a handled exception. The dialog opened with the "Debug" button enabled.
Comment 2 Ben Vitale CLA 2010-10-21 15:21:15 EDT
Created attachment 181437 [details]
Bundle that shows the problem

In the attached bundle, I defined a dummy launch config type with a single tab. Here's what I'm seeing:

1. If I launch Eclipse and create a new config of this type, the Debug button is disabled.
2. If I change the title of the config, the button becomes enabled. If I subsequently launch, it triggers my exception, which gets handled by showing a message. When returned to the configuration dialog, the button is disabled again.

It's possible that I initially overcomplicated the problem definition; I think #1 is a simplified version of the problem.
Comment 3 Darin Wright CLA 2010-10-21 17:24:22 EDT
Created attachment 181451 [details]
patch

My example triggered "ILCD.updateButtons()", and so the button was enabled. The example shown here does not trigger updateButtons(). It can be called after the tabs are set up/updated for a newly selected config.
Comment 4 Darin Wright CLA 2010-10-22 09:57:21 EDT
Fixed in 3.6.2 and HEAD
Comment 5 Gergely Nagy CLA 2011-01-28 07:18:34 EST
(In reply to comment #4)
> Fixed in 3.6.2 and HEAD

Thank you! 

I have run into a slightly different bug that seems to have been fixed by this as well: 
 * create a new launch config
 * make it invalid -> error msg is set, buttons disabled
 * close & reopen dialog
 * click on the launch config -> error msg is not there, even thought it's still invalid
(Small print: you need a launch TabGroup that does not include CommonTab: that one hides the problem by calling scheduleDialogJob(). You can e.g. org.eclipse.externaltools.ui/ProgramTabGroup, remove CommonTab and launch in self-hosted mode)

So this 1-line change (updateButtons()) seem to fix my bug as well.
1) could you confirm that's the case
2) should I raise a separate bug for this scenario?