Community
Participate
Working Groups
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
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 ;)
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.
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.
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.
(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.
Verified in I20090429-0100.