Bug 268189 - UI polish for compare viewer switcher
Summary: UI polish for compare viewer switcher
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords: polish
Depends on:
Blocks:
 
Reported: 2009-03-11 14:45 EDT by Markus Keller CLA
Modified: 2009-03-25 07:09 EDT (History)
2 users (show)

See Also:


Attachments
Patch v01 (3.02 KB, patch)
2009-03-17 10:16 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (49.81 KB, application/octet-stream)
2009-03-17 10:16 EDT, Tomasz Zarna CLA
no flags Details
Patch v02 (12.11 KB, patch)
2009-03-23 09:16 EDT, Tomasz Zarna CLA
no flags Details | Diff
Patch v03 (11.45 KB, patch)
2009-03-25 06:53 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2009-03-11 14:45:14 EDT
I20090311-0100

When looking at the new dropdown menu to switch compare editor view, I found a few UI issues:
- default entry should have the radio checkmark initially
- "Default" label does not match other labels I've seen in the menu ("Text Compare", "Image Compare"). Could the default be changed to "Default Compare")?
- tooltip "Switch" is a bit terse. Maybe "Switch Compare Viewer" or "Switch Presentation"?
- the menu should open on mouse down, not on mouse up. Until bug 193318 is fixed, you can do this using a mouse listener on the toolbar, see e.g. org.eclipse.jface.dialogs.PopupDialog.createDialogMenu(Composite)
Comment 1 Tomasz Zarna CLA 2009-03-17 10:15:00 EDT
(In reply to comment #0)
> - default entry should have the radio checkmark initially

The default entry is not checked initially by design. The checkmark indicates that the item next to it has been selected by user. Let me explain it using a hypothetical example:
Consider you have content merge viewers for xml and exsd files (let's call them XML and Schema Compare). When comparing two folders with xml schema (*.exsd) files you'll get Compare Editor with Structure Compare on top. When you select an xml file the XML Compare will open below. The new dropdown menu will allow you to switch to Text Compare if you wish. The default entry (XML Compare) won't be checked as you mentioned in comment 0.

If you now click on the schema file in Structure Compare the Schema Compare will open since it's the default viewer for these files. Options available in the dropdown menu would be: Schema Compare (bold, not checked), XML Compare, Text Compare. However, if you clicked the Default Compare (or Text Compare and then went back to Default, which is XML) then when opened the schema file you would get XML Compare as this is what you selected. Options available in the dropdown menu would be: Schema Compare (bold), XML Compare (checked), Text Compare.
Comment 2 Tomasz Zarna CLA 2009-03-17 10:16:01 EDT
Created attachment 129086 [details]
Patch v01

Patch addresses other UI issues mentioned by Markus.
Comment 3 Tomasz Zarna CLA 2009-03-17 10:16:08 EDT
Created attachment 129087 [details]
mylyn/context/zip
Comment 4 Markus Keller CLA 2009-03-17 15:11:03 EDT
(In reply to comment #1)
I see. It still feels a bit strange that I cannot switch back to default any more after I selected a specific compare. And making the default item bold is also slightly abusive: Bolding the default item is usually just for the default action on a *context* menu, and it's not used to show a default *state* but to mark the default *action* that's invoked when the item is doubleclicked or Enter is pressed.

Maybe you could add an explicit 'Default Compare' menu item that can also have the radio and that is checked initially?
Comment 5 Tomasz Zarna CLA 2009-03-18 06:57:44 EDT
(In reply to comment #4)
> Maybe you could add an explicit 'Default Compare' menu item that can also have the radio and that is checked initially?

You're right Markus, here is a couple of scenarios that came to my mind with the default item applied (I'm referring to the same hypothetical example from comment 1, obvious cases omitted):

=== scenario #4 (compatible selection)
open exsd >
[v Default*]
------------
[  Schema* ]
[  XML     ]
[  Text    ]

select XML >
[  Default*]
------------
[  Schema* ]
[v XML     ]
[  Text    ]

open XML >
[  Default*]
------------
[v XML*    ] <= XML selected (by user), not Default
[  Text    ]

open Schema >
[  Default*]
------------
[  Schema* ]
[v XML     ]
[  Text    ]

=== scenario #5 (incompatible selection)
open exsd >
[v Default*]
------------
[  Schema* ]
[  XML     ]
[  Text    ]

select Schema >
[  Default*]
------------
[v Schema* ]
[  XML     ]
[  Text    ]

open XML >
[  Default*]
------------
[v XML*    ] <= XML selected (a fallback from Schema selected by user), not Default
[  Text    ]

open Schema >
[  Default*]
------------
[v Schema* ]
[  XML     ]
[  Text    ]

Would this work for you?
Comment 6 Tomasz Zarna CLA 2009-03-18 07:01:24 EDT
Forgot the legend: 
v indicates selection
* means that the same content merge viewer would be used when selected
------------ is a separator between menu items
Comment 7 Tomasz Zarna CLA 2009-03-18 07:07:52 EDT
Scenarios from comment 5 look fine to me, but adding the explicit 'Default' item would not allow us follow the steps from comment 1 (select XML Compare, go back to Schema with XML Compare selected):

=== scenario #6 (no label provided)
open exsd >
[v Default*]
------------
[  Schema* ]
<= no label for XML content merge viewer, not in the menu
[  Text    ]

open xml >
[v Default*]
------------
[  Current*] <= it's XML but we have no label to show
[  Text    ]

select Current >
[  Default*]
------------
[v Current*]
[  Text    ]

open Schema >
[  Default*]
------------
[  Schema* ]
[v Current*] <= cannot display the item with no label, thus cannot be selected
[  Text    ]

I guess we can get away with dropping this scenario.
Comment 8 Markus Keller CLA 2009-03-18 08:10:31 EDT
Sounds good. For the case where the label is missing, I think it would be better to just "invent" a name than taking the merge viewer completely away from the user just because the label is missing.

The invented name could be something like "Unnamed Compare" (with "Unnamed Compare 2" etc. if there are multiple), or even "Compare (*.exsd)" where stuff in parenthesis is taken from the contentMergeViewers contribution's viewer>extensions attribute or the name of the contentTypeBinding>contentTypeId.
Comment 9 Tomasz Zarna CLA 2009-03-20 06:38:23 EDT
Szymon pointed out that in scenario #5 from comment 5 we do not distinguish between situations when XML has been selected by user and it's the result of an incompatible selection made previously. In consequence the user cannot predict what will happen if he open schema comparison again. Szymon suggested to fallback to the "Default Compare" option in such cases.
Comment 10 Tomasz Zarna CLA 2009-03-23 09:16:28 EDT
Created attachment 129590 [details]
Patch v02

This patch contains changes made in Patch v01 
+discovering label for merge viewers which don't provide any (as suggested by Markus in comment 8) 
+fallback to the Default Compare option in situations described in comment 9
Comment 11 Tomasz Zarna CLA 2009-03-23 09:22:30 EDT
Patch v02 adds a new method called findContentTypeOrExtensionName which duplicates a lot of code from findContentViewerDescriptor, I should at least extract methods from the common parts.
Comment 12 Tomasz Zarna CLA 2009-03-25 06:53:07 EDT
Created attachment 129823 [details]
Patch v03

Updated version of Patch v02.
Comment 13 Tomasz Zarna CLA 2009-03-25 07:04:58 EDT
(In reply to comment #11)
> Patch v02 adds a new method called findContentTypeOrExtensionName which
> duplicates a lot of code from findContentViewerDescriptor, I should at least
> extract methods from the common parts.

=> bug 269959
Comment 14 Tomasz Zarna CLA 2009-03-25 07:09:05 EDT
Released to HEAD, with a minor change (renamed findContentTypeOrExtensionName to findContentTypeNameOrType). Available in builds >N20090324-2000. 

Thanks for your comments Markus. If there is still anything you would like me to improve feel free to open a new bug.