Bug 11233 - [Dialogs] Add error icon to InputDialog class
Summary: [Dialogs] Add error icon to InputDialog class
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 57169 (view as bug list)
Depends on: 148085
Blocks: 289082
  Show dependency tree
 
Reported: 2002-03-13 05:37 EST by Stefan Matthias Aust CLA
Modified: 2019-09-06 16:14 EDT (History)
4 users (show)

See Also:


Attachments
InputStatusDialog (8.56 KB, patch)
2009-08-12 14:38 EDT, Andrew Gvozdev CLA
no flags Details | Diff
patch 2 (8.76 KB, patch)
2009-09-04 09:49 EDT, Andrew Gvozdev CLA
no flags Details | Diff
current patch with tests (8.36 KB, application/octet-stream)
2009-10-22 19:47 EDT, Susan McCourt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Matthias Aust CLA 2002-03-13 05:37:17 EST
I just found the jface.dialogs.InputDialog class as an easy to use value 
requestor.  This is just a minor improvement suggestion.  Most dialogs and 
wizards show error messages with a leading red-X error icon.  The InputDialog 
does not.  I think, the validator's error message would be easier to spot for 
a user if it also has a red-X error icon.
Comment 1 Kevin Haaland CLA 2002-03-20 14:47:02 EST
Consider as a post 2.0 improvement
Comment 2 Randy Giffen CLA 2002-08-09 15:49:20 EDT
Reopen to investigate
Comment 3 Susan McCourt CLA 2006-07-07 18:37:16 EDT
marking for 3.3.  I hope to clean up the various inconsistent presentations of error messages in the different dialog hierarchies.
Comment 4 Susan McCourt CLA 2006-11-12 14:25:06 EST
*** Bug 57169 has been marked as a duplicate of this bug. ***
Comment 5 Susan McCourt CLA 2007-05-01 18:49:07 EDT
removing milestone...the idea was to provide a common image/message implementation to be used in multiple places, but we missed the API window for this release due to other higher prio items.
Comment 6 Susan McCourt CLA 2007-06-27 16:48:17 EDT
It would be nice to have a common status message area implementation for our dialogs.  See also bug #148085
Comment 7 Susan McCourt CLA 2009-07-09 15:30:50 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 8 Andrew Gvozdev CLA 2009-08-12 14:38:40 EDT
Created attachment 144289 [details]
InputStatusDialog

I'd like to suggest to consider an implementation of input dialog based on StatusDialog which already provides somewhat richer decorations namely error/warning/info icons. Here is possible implementation of such dialog InputStatusDialog. InputDialog and StatusDialog are not exactly compatible as far as interface hence a new class. I think this class is orthogonal to common status message area implementation and would use the common piece if ever developed.
Comment 9 Susan McCourt CLA 2009-08-13 10:12:25 EDT
Thanks for the patch.
Assigning to myself to take a look at this early in 3.6.
Comment 10 Remy Suen CLA 2009-09-03 20:01:11 EDT
(In reply to comment #8)
> Created an attachment (id=144289) [details]
> InputStatusDialog

Hi Andrew, thanks for your contribution. Here are some comments after trying out your patch.

1. You've spec'd IInputStatusValidator to allow null as a return value but an NPE will actually be thrown by InputStatusDialog if you do so. I presume you spec'd null as an allowable return value because you were following the pattern set by IInputValidator. It's not clear to me as to whether having two different return values mean the same thing is a good idea or not. Perhaps Susan can comment on this when she makes her pass over this bug.

java.lang.NullPointerException
	at org.eclipse.jface.dialogs.StatusDialog.updateButtonsEnableState(StatusDialog.java:185)
	at org.eclipse.jface.dialogs.StatusDialog.updateStatus(StatusDialog.java:162)
	at org.eclipse.jface.dialogs.InputStatusDialog.validateInput(InputStatusDialog.java:193)
	at org.eclipse.jface.dialogs.InputStatusDialog$1.modifyText(InputStatusDialog.java:139)

2. Specifying null for the 'dialogMessage' parameter in the constructor causes a runtime exception.

Exception in thread "main" java.lang.IllegalArgumentException: Argument cannot be null
	at org.eclipse.swt.SWT.error(SWT.java:3868)
	at org.eclipse.swt.SWT.error(SWT.java:3802)
	at org.eclipse.swt.SWT.error(SWT.java:3773)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:452)
	at org.eclipse.swt.widgets.Label.setText(Label.java:574)
	at org.eclipse.jface.dialogs.InputStatusDialog.createDialogArea(InputStatusDialog.java:128)
Comment 11 Andrew Gvozdev CLA 2009-09-04 09:49:22 EDT
Created attachment 146500 [details]
patch 2

(In reply to comment #10)
Thanks for the scrutiny, any code intended for Platform of course deserves that.

> 1. You've spec'd IInputStatusValidator to allow null as a return value but an
> NPE will actually be thrown by InputStatusDialog if you do so. I presume you
> spec'd null as an allowable return value because you were following the pattern
> set by IInputValidator. It's not clear to me as to whether having two different
> return values mean the same thing is a good idea or not. Perhaps Susan can
> comment on this when she makes her pass over this bug.
You are absolutely right that I followed copy/paste pattern here trying to be as much consistent with IInputValidator as I could. Looking at this class more closely I note that - while there is a distinction in IInputValidator.isValid() for the null vs empty string return value - there is no distinction in IInputStatusValidator. It seems that the reason would be just convenience. Perhaps misguided. Null is supposed to mean an absence of an object, in this case IStatus. The semantics of absence of IStatus is really not clear and may be confusing. So I suggest to change the specs not to allow null - considering that returning Status.OK_STATUS just as easy. However if somebody comes up with a good reason to use null as a return value I would not object. The change would be trivial.

> 2. Specifying null for the 'dialogMessage' parameter in the constructor causes
> a runtime exception.
Thanks again for catching that. In the updated patch I corrected the problem using empty string as a default value. In this case the semantics of dialogMessage being absent is pretty clear.
Comment 12 Susan McCourt CLA 2009-10-21 20:46:26 EDT
I'm looking at this one now for M3.  (There's something exciting about fixing such a low bug number!)

I agree with you both that it doesn't make sense to allow a null return value from IInputStatusValidator.isValid(String text).

In fact, I think the method name is misleading.  We should probably just call it

IStatus validate(String text)
since the method is not returning a boolean and hence there is no "is" anything.   What do you think?

Did you per chance have any test cases that went along with this dialog?  I will write some tomorrow if not.
Comment 13 Andrew Gvozdev CLA 2009-10-22 08:31:30 EDT
(In reply to comment #12)
> I'm looking at this one now for M3.  (There's something exciting about fixing
> such a low bug number!)
Yes, there is! This submission does not resolve InputDialog problem though.

> I agree with you both that it doesn't make sense to allow a null return value
> from IInputStatusValidator.isValid(String text).
> In fact, I think the method name is misleading.  We should probably just call
> it IStatus validate(String text)
> since the method is not returning a boolean and hence there is no "is"
> anything.   What do you think?

I think you are right and I like that name better.

> Did you per chance have any test cases that went along with this dialog?  I
> will write some tomorrow if not.

No. I am not sure how you write test cases like that and could use a good example.
Comment 14 Susan McCourt CLA 2009-10-22 19:47:33 EDT
Created attachment 150326 [details]
current patch with tests

Here's what I've got right now based on our discussion.  Plus some test cases.
Also, I opted to handle a null message value the same way that InputDialog does.  Rather than make the value an empty string, I check for null before creating the label.  Otherwise you'll get extra empty space in the input dialog when there is no message.

However, I'm not sure I want to release a new class.  The other approach would be to move InputDialog underneath StatusDialog, provide a second constructor that takes an IInputStatusValidator, and map the IInputValidator to an internal IInputStatusValidator.  This would give existing InputDialog clients a way to get the error icon for free.

But I have to think about what that means according to our compatibility rules.  (Does this break binary compatibility?)
For that reason i want to move this to M4 (this is my last day to work on M4 stuff) and pick this up again.
Comment 15 Susan McCourt CLA 2009-10-22 20:13:55 EDT
> For that reason i want to move this to M4 (this is my last day to work on M4
> stuff) and pick this up again.

I meant to say this is my last day to work on M3.
Comment 16 Susan McCourt CLA 2009-10-22 20:23:45 EDT
Need to look at http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html section 13.4.4 when my brain is not already full.
Comment 17 Susan McCourt CLA 2009-11-24 11:20:36 EST
Hi, Andrew.  We discussed this issue briefly in a UI status call.  

- We don't want to introduce this behavior "for free" in InputDialog because it introduces new visuals for products that may not want to adopt them.  So there's no gain in putting binary compatibility at risk by changing the structure of something that's so stable/old.
- Adding a new dialog, then, to JFace is of marginal value unless there is significant need/use in the SDK itself, or unless we see a bunch of copies of this dialog floating around the release train components.

I realize there's a chicken/egg problem here.  Adoption won't happen if the dialog is not there, but we would like to see some momentum from SDK components who wish to adopt this dialog before adding it.  So I'm removing the milestone for now.  

Thanks for sharing the work you did.
Comment 18 Eclipse Webmaster CLA 2019-09-06 16:14:14 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.