Bug 267916 - [toString] Template edit dialog has usability issues
Summary: [toString] Template edit dialog has usability issues
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2009-03-10 13:11 EDT by Dani Megert CLA
Modified: 2009-04-29 05:38 EDT (History)
1 user (show)

See Also:


Attachments
fix for first point (1009 bytes, patch)
2009-03-14 13:20 EDT, Mateusz Matela CLA
no flags Details | Diff
new template edit dialog (21.18 KB, patch)
2009-03-18 18:22 EDT, Mateusz Matela CLA
markus.kell.r: iplog+
markus.kell.r: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2009-03-10 13:11:21 EDT
I20090310-0100.

Th toString Template edit dialog usability is bad:
- switching templates via drop down discards all my edits (lost work)
- I can delete the default template (but in fact it's not deleted)
- each click on the 'New' button inserts a template - all named the same
- each click on 'Delete' deletes a template without asking and
Comment 1 Mateusz Matela CLA 2009-03-14 13:07:36 EDT
Since it's my fault these things don't work, I'd like to provide a fix. But I have some questions first.

(In reply to comment #0)
> I20090310-0100.
> 
> Th toString Template edit dialog usability is bad:
> - switching templates via drop down discards all my edits (lost work)
Ops, a stupid mistake in code.
> - I can delete the default template (but in fact it's not deleted)
This was intentional - I thought it should be possible to delete (or rename) the default template. On the other hand, there must be at least one template, so when user deletes them all and clicks OK, the default template is added automatically (but it is deleted properly if there's another template). Do you suggest the default template should be 'read-only'?
> - each click on the 'New' button inserts a template - all named the same
I didn't consider this to be a problem, since for me the templates are identified by position on the drop=down list. I can change it to check if 'New template' already exists and if so, try 'New template (2)', 'New template (3)' and so on.
BTW, do you think it shouldn't be allowed to name two templates the same? It would require additional mechanism for checking this condition every time a template is renamed...
> - each click on 'Delete' deletes a template without asking and
Did you consider that the deleted templates come back after you click Cancel? This let's you avoid unintentional loss of data, so I don't think additional question is necessary. Although I might be wrong ;)
Comment 2 Mateusz Matela CLA 2009-03-14 13:20:24 EDT
Created attachment 128828 [details]
fix for first point

This should fix the problem with template selection in templates editor window. I post it now because this problem is the most annoying and yet easy to fix, while the rest of the problems require some discussion.
Comment 3 Dani Megert CLA 2009-03-16 05:00:51 EDT
Duplicate names are an issue. The default template must either be read-only or you must handle its deletion better. Creating a default again without asking the user is not good.

>- each click on 'Delete' deletes a template without asking
Maybe it's not needed to ask but at least when deleting the last one you need to update (disable) the Apply and OK buttons.
Comment 4 Mateusz Matela CLA 2009-03-18 18:22:37 EDT
Created attachment 129301 [details]
new template edit dialog

OK, I completely redesigned the template edition dialog. Now it is more similar to other template editors that can be found in Eclipse preferences window. Now user is not allowed to remove all templates or name two templates the same. The only thing I see that might be a problem is that the edition of a template is done in a new dialog, which leads to 3 dialogs opened simultaneously. I hope it's not too many.

This should also resolve bug 267912.
Comment 5 Markus Keller CLA 2009-03-27 14:50:00 EDT
(In reply to comment #4)

Thanks, I released this patch with a few changes:
- Fixed traverse listener for Ctrl+Enter in template text field: It used to close the dialog for every Ctrl+* traversal, e.g. also for Ctrl+ArrowLeft (already broken before this patch).
- Rewrote createNewTemplateName(). We cannot use code like "(" + copyCount + ")" for strings that must be translated.
- When the user modified the name of a template and then reverted to the original name, the dialog didn't allow to press OK.
- Made the Edit Template dialog resizable, fixed vertical resizing, and made space for the content assist lightbulb.
Comment 6 Dani Megert CLA 2009-04-29 05:38:33 EDT
Verified in I20090429-0100.