Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 248057

Summary: consider removing Current subsection
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Steffen Pingel <steffen.pingel>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: david.shepherd, jingweno, mik.kersten
Version: unspecified   
Target Milestone: 3.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 238038    
Attachments:
Description Flags
a patch that fixed the proposition comment #2
none
Patch to progressively expand the comments when the expand all button is pressed.
none
mylyn/context/zip
none
Patch to change the behaviour of +
none
mylyn/context/zip
none
Patch to change the + behaviour
none
mylyn/context/zip
none
Patch v3 to change + behavior
none
mylyn/context/zip
none
screenshot of the new comment group strategy (bug 238038)
none
shared file none

Description Steffen Pingel CLA 2008-09-20 17:54:09 EDT
I find that having the "Current" subsection under Comments offers little value but takes up space. How about this:

 - Group comments under Current directly under the Comments section
 - Modify the behavior of the "+" button on the comment section to expand all current comments on first click and all comments on subsequent clicks

In addition to taking up less space this change would get rid of the "+" and "-" buttons on the subsection which I sometimes find easy to confuse with the buttons on the section header.
Comment 1 Mik Kersten CLA 2008-10-01 22:45:14 EDT
I have no idea until I get a chance to use it, so will wait until it's in HEAD before commenting.
Comment 2 David Shepherd CLA 2008-10-21 18:52:13 EDT
Related to this bug:
I just pressed the + button on all comments when the comments were showing recent and current.  This behaved as expected, expanding all comments.  However, pressing - to fold all comments still leaves each section (recent and current) expanded, which is not what I expected.  I would prefer if the global - folded everything, not just the comments.  Is this the intended behaviour?  Just wanted to give some feedback... looks cool otherwise!
Comment 3 Jingwen 'Owen' Ou CLA 2008-10-21 20:09:13 EDT
Created attachment 115766 [details]
a patch that fixed the proposition comment #2

Great point David! This is something we didn't cover before. The initial intention was to keep the existing way: the "old" collapse all only close the comments without closing the section. So now we only close all the comments without closing the subsections.

Steffen, in this patch, I implemented to close all the subsections when pressing the collapse all button. Another proposition would be to only close the "older" & the "recent" and leave "current" inacative, since our goal is to always keep "current" open?
Comment 4 Steffen Pingel CLA 2008-10-27 23:34:39 EDT
Sorry Owen, I missed that change. I have just committed a change that removes the current section. We'll need to figure out how to adjust the behavior of the expand buttons based on these changes.
Comment 5 Jingwen 'Owen' Ou CLA 2008-10-28 20:27:51 EDT
(In reply to comment #4)
> Sorry Owen, I missed that change. I have just committed a change that removes
> the current section. We'll need to figure out how to adjust the behavior of the
> expand buttons based on these changes.

n/m. I think it makes sense to collapse all subsections when clicking the "collapse-all" button though.

removing the current section will definitely make the design simpler. But programmers couldn't expend-all current comments at once (maybe add another button on the main section toolbar). Besides, when all subsections + comments are expended, there are no boundary between the "recent" comments and the "current" comments. Thats a bit confusing.
Comment 6 David Shepherd CLA 2008-11-05 17:10:37 EST
I think that the expand all button should first expand all current comments on the first click and then on a second click expand all comments.   Otherwise users can't expand all current comments, and expanding all comments is too expensive in terms of screen size.
Comment 7 David Shepherd CLA 2008-11-06 12:17:12 EST
Created attachment 117227 [details]
Patch to progressively expand the comments when the expand all button is pressed.

First click expands current, second click expands recent, third expands older.  Expansion is sensitive to the current expansion state of the comments.  Unfortunately, there is no clean way to access the Recent and Older sections and so the code to get these sections is not as clean as it should be.
Comment 8 David Shepherd CLA 2008-11-06 12:17:17 EST
Created attachment 117228 [details]
mylyn/context/zip
Comment 9 Steffen Pingel CLA 2008-11-07 01:28:55 EST
I had to make a few changes to the current implementation to improve performance. Generally the button should work based on the state of the UI and not rely on particular sections to be present. Have you tried iterating over the widgets to check if all comments in the current section are expanded to determine the behavior of the button? I would prefer that over keeping separate state in an integer which is tricky to synchronize when the user collapses or expands comment/sections manually. 
Comment 10 David Shepherd CLA 2008-11-07 11:41:05 EST
(In reply to comment #9)
> I had to make a few changes to the current implementation to improve
> performance. 
The pre-patch implementation? or was the patch causing performance problems?
> Generally the button should work based on the state of the UI and
> not rely on particular sections to be present. 
The button does work based on the state of the UI, I can work on making it not rely on particular sections.
> Have you tried iterating over the
> widgets to check if all comments in the current section are expanded to
> determine the behavior of the button? 
This is very similar to what the code does.  The code checks the state of the UI when the button is pushed by checking the expansion state of the "older" and "recent" sections.  It does not check individual comments, however, only the section.
> I would prefer that over keeping separate
> state in an integer which is tricky to synchronize when the user collapses or
> expands comment/sections manually.
The state is not "kept" in an integer, it is recalculated each time the button is pushed by examining the expansion state of the UI. 

From you comments, it seems the main complaint is having the code rely on the presence of certain sections.  If I make the code more generic by removing references to these sections will you have any other issues with the patch?  If so, what (so I can address them at the same time).
Comment 11 David Shepherd CLA 2008-11-07 13:08:22 EST
Created attachment 117345 [details]
Patch to change the behaviour of +

Try #2, should be more generic.
Comment 12 David Shepherd CLA 2008-11-07 13:08:25 EST
Created attachment 117346 [details]
mylyn/context/zip
Comment 13 David Shepherd CLA 2008-11-07 13:09:00 EST
On a related note, we should also change the behaviour of -, but waiting until I get this patch through before working on that one..
Comment 14 Steffen Pingel CLA 2008-11-07 13:59:38 EST
The performance changes were unrelated to the patch. I just noticed slowness when I tested expanding comments. Patch looks good, I misread the first patch you submitted not realizing the the integer state is recalculated each time the button is pressed.

One thing I noticed with the latest patch is that it expands all comments if I click the button when the Comments section is collapsed.
Comment 15 David Shepherd CLA 2008-11-07 14:43:17 EST
Created attachment 117359 [details]
Patch to change the + behaviour
Comment 16 David Shepherd CLA 2008-11-07 14:43:25 EST
Created attachment 117360 [details]
mylyn/context/zip
Comment 17 Steffen Pingel CLA 2008-11-07 17:27:02 EST
I think you should only count a section as expanded if all comments in that section are expanded. The counting should also be based on the same assumption that is made in expandAllComments(), i.e. sections are counted bottom up.

Consider this scenario for instance: Collapse all and expand the Older section, then press the button. As a result of pressing the expand button Older will be collapsed and Recent and all current comments will be expanded.
Comment 18 David Shepherd CLA 2008-11-10 19:52:33 EST
Created attachment 117503 [details]
Patch v3 to change + behavior

Should fix some of the issues we discussed.  However, this code is starting to grow more complex as there are several special cases and it is not easy to access the UI widgets directly.  As Steffen suggested, this class should be put on the list of classes to refactor in the near future.
Comment 19 David Shepherd CLA 2008-11-10 19:52:37 EST
Created attachment 117504 [details]
mylyn/context/zip
Comment 20 Steffen Pingel CLA 2008-11-10 23:47:43 EST
The patch looks good. I am hesitant to apply it though as it tracks comment groupings by number ranges. After looking at the class I now believe that it would be better to refactor the data structures first which currently don't capture the mapping between the data model (attributes) and UI representation (subsections, comment editors etc.). This would also help with other e.g. model-based search, bug 242969).
Comment 21 David Shepherd CLA 2008-11-12 11:35:58 EST
I agree that tracking the comment groupings by number ranges is not desirable.  What would it take to refactor the data structures, in terms of time and effort?  
Comment 22 David Shepherd CLA 2008-11-13 14:12:48 EST
Steffen?
Comment 23 Steffen Pingel CLA 2008-11-13 15:34:26 EST
I think this will be straight forward. I have a drawing on my white board :). Let's talk about it today.
Comment 24 Steffen Pingel CLA 2008-11-13 22:53:56 EST
I have refactored the class and implemented incremental collapse / expand of comments. Please open a new bug if further enhancements are needed.
Comment 25 David Shepherd CLA 2008-11-14 11:42:28 EST
Great!  I just tested it out and it seems to perform a lot faster as well, did you do any profiling?  For a bug with 90 comments it used to take ~10 seconds to expand and now it takes 0.5 seconds.  Nice!

I also noticed that the "-" button is the inverse of the "+" button now, good.
Comment 26 Jingwen 'Owen' Ou CLA 2008-11-14 14:12:26 EST
(In reply to comment #24)
> I have refactored the class and implemented incremental collapse / expand of
> comments. Please open a new bug if further enhancements are needed.
> 

Cool stuff guys! Nice hack in TaskEditorCommentPart.expandAllComments()! 

Just curious: is the user story changed? now the "current" group takes the last 12 comments instead of taking the comments since current user's last comment...
Comment 27 Steffen Pingel CLA 2008-11-14 15:48:18 EST
The current strategy will still only show the comments since the user last commented or the last 12 (whichever number is lower).
Comment 28 Jingwen 'Owen' Ou CLA 2008-11-14 17:14:23 EST
Created attachment 117956 [details]
screenshot of the new comment group strategy (bug 238038)

But it seems "showing the last 12 comments" overshadow "showing the comments since the user last commented" (always showing the last 12 comments)? In the screenshot, should it only display comment #70 and #71 instead of the last 12 comments (comments since the user last commented has a higher priority)?
Comment 29 Steffen Pingel CLA 2008-11-14 17:18:57 EST
Good point. That looks like a bug. Time to write test cases :).
Comment 30 Jingwen 'Owen' Ou CLA 2008-11-17 17:30:43 EST
(In reply to comment #29)
> Good point. That looks like a bug. Time to write test cases :).

see bug 244371
Comment 31 David Shepherd CLA 2008-11-18 18:03:13 EST
Created attachment 118208 [details]
shared file

A shared file created from: new.png in folder 248057