Bug 386673 - Show warning messages in launch configuration dialog
Summary: Show warning messages in launch configuration dialog
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.3 M3   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2012-08-06 07:51 EDT by Mohamed Hussein CLA
Modified: 2012-10-30 23:53 EDT (History)
2 users (show)

See Also:


Attachments
Add extension interface and support warning in dialog (4.19 KB, patch)
2012-08-06 07:55 EDT, Mohamed Hussein CLA
no flags Details | Diff
Handle feedback (4.53 KB, patch)
2012-08-11 03:05 EDT, Mohamed Hussein CLA
no flags Details | Diff
Handle feedback - add example usage (8.00 KB, patch)
2012-08-23 11:10 EDT, Mohamed Hussein CLA
Michael_Rennie: iplog+
Michael_Rennie: review+
Details | Diff
Warning message in PDA example (41.64 KB, image/png)
2012-08-23 11:11 EDT, Mohamed Hussein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mohamed Hussein CLA 2012-08-06 07:51:31 EDT
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.updateMessage() only allows showing Error or normal messages from tabs, though the setMessage method has by default a WARNING level.

I will post a small patch that allows launch configuration tabs to supply warning messages that gets displayed as warnings in the dialog.
Comment 1 Mohamed Hussein CLA 2012-08-06 07:55:39 EDT
Created attachment 219586 [details]
Add extension interface and support warning in dialog

Add extension interface org.eclipse.debug.ui.ILaunchConfigurationTab2 to be implemented by tabs that want to provide warning messages.

Warning messages take priority over normal messages.
Comment 2 Pawel Piech CLA 2012-08-06 12:02:13 EDT
Sounds like a reasonable request.  Mike, has this come up before?
Comment 3 Michael Rennie CLA 2012-08-07 12:06:21 EDT
No requests like this in the past. Couple of nit-picks:

1. Don't need the null check -> if (tab != null && tab instanceof ILaunchConfigurationTab2)
2. need to update the copyright for LaunchConfigurationTabGroupViewer
3. Unless you want to attribute the code to IBM, you should update the copyright for ILaunchConfigureationTab2 :)
4. There are no @since tags on the new interface + getWarningMessage() method

It might also be nice to implement this in the platform / JDT debug / the examples so people can see a real life example of its use / test it.
Comment 4 Mohamed Hussein CLA 2012-08-11 03:05:37 EDT
Created attachment 219778 [details]
Handle feedback

(In reply to comment #3)
[mhussein] Thanks a lot for your comments, please find an updated patch handling them, see details below.

> No requests like this in the past. Couple of nit-picks:
> 
> 1. Don't need the null check -> if (tab != null && tab instanceof
> ILaunchConfigurationTab2)
[mhussein] Done.

> 2. need to update the copyright for LaunchConfigurationTabGroupViewer
[mhussein] Done.

> 3. Unless you want to attribute the code to IBM, you should update the
> copyright for ILaunchConfigureationTab2 :)
[mhussein] I wouldn't mind doing so, we are all in the same boat :)
Updated it, thanks for the note.

> 4. There are no @since tags on the new interface + getWarningMessage() method
[mhussein] Added to the interface.

> 
> It might also be nice to implement this in the platform / JDT debug / the
> examples so people can see a real life example of its use / test it.
[mhussein] To do this I need a place that logically has a warning message that is currently either displayed as error or normal, do you know of any?
I tried to look at usages of getErrorMessage, but mostly are exceptions or real errors.

I can add a get/set to AbstractLaunchConfigurationTab like normal and error if this will make it more obvious to implementors. Please let me know if you want me to do so.
Comment 5 Michael Rennie CLA 2012-08-20 12:06:36 EDT
(In reply to comment #4) 

Hmm, for some reason I cannot apply either of the patches - Git is complaining they are not valid patch formats...

Looking at the code you should have ILaunchConfigurationTab2 extend ILaunchConfigurationTab.

> [mhussein] To do this I need a place that logically has a warning message
> that is currently either displayed as error or normal, do you know of any?
> I tried to look at usages of getErrorMessage, but mostly are exceptions or
> real errors.

You could add a new tab / logic to the PDA example in org.eclipse.debug.examples.ui

> 
> I can add a get/set to AbstractLaunchConfigurationTab like normal and error
> if this will make it more obvious to implementors. Please let me know if you
> want me to do so.

Yes that would be good since we encourage people to use the abstract class. You should also add a change that AbstractLaunchConfigurationTab implements the new interface - which will still be binary compatible: http://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_Classes

It might also be a good idea to go through the backlog of bugs to see if there are any other requests to extend ILaunchConfigurationTab that we could include in the new extension.
Comment 6 Mohamed Hussein CLA 2012-08-23 11:10:12 EDT
Created attachment 220202 [details]
Handle feedback - add example usage

(In reply to comment #5)
> (In reply to comment #4) 
> 
> Hmm, for some reason I cannot apply either of the patches - Git is
> complaining they are not valid patch formats...
> 
[mhussein] I have recreated my local branch, please check the new patch and let me know if you have any issues.

> Looking at the code you should have ILaunchConfigurationTab2 extend
> ILaunchConfigurationTab.
> 
[mhussein] Done.

> > [mhussein] To do this I need a place that logically has a warning message
> > that is currently either displayed as error or normal, do you know of any?
> > I tried to look at usages of getErrorMessage, but mostly are exceptions or
> > real errors.
> 
> You could add a new tab / logic to the PDA example in
> org.eclipse.debug.examples.ui
> 
[mhussein] I added a warning message to the existing tab in case the program is not a file, will attach a screenshot.
Do I need to change the example instructions to ask users to do the same?

> > 
> > I can add a get/set to AbstractLaunchConfigurationTab like normal and error
> > if this will make it more obvious to implementors. Please let me know if you
> > want me to do so.
> 
> Yes that would be good since we encourage people to use the abstract class.
> You should also add a change that AbstractLaunchConfigurationTab implements
> the new interface - which will still be binary compatible:
> http://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_Classes
> 
[mhussein] Done. Thanks for the link.

> It might also be a good idea to go through the backlog of bugs to see if
> there are any other requests to extend ILaunchConfigurationTab that we could
> include in the new extension.
[mhussein] I tried quick search and only found
https://bugs.eclipse.org/bugs/show_bug.cgi?id=160016
https://bugs.eclipse.org/bugs/show_bug.cgi?id=136115
With my inexperienced eye, I don't think they are relevant at all. Please let me know if you think otherwise.
Comment 7 Mohamed Hussein CLA 2012-08-23 11:11:26 EDT
Created attachment 220203 [details]
Warning message in PDA example
Comment 8 Pawel Piech CLA 2012-09-19 11:10:28 EDT
Moving out to next milestone.
Comment 9 Michael Rennie CLA 2012-10-15 20:20:07 EDT
Comment on attachment 220202 [details]
Handle feedback - add example usage

Patch works nicely.
Comment 10 Michael Rennie CLA 2012-10-15 20:22:06 EDT
Pushed patch with minor copyright / version updates to: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=231ef131428719fb986eaa67511186dd9ec341fb

Thank you very much for this cool new feature Mohamed!
Comment 11 Pawel Piech CLA 2012-10-30 23:53:14 EDT
Verified with I20121029-0800

Interestingly, the warning message does not prevent you from launching, which seems correct.