Bug 165968 - Bug editor assumes comment ordering is such that the description is always the first comment
Summary: Bug editor assumes comment ordering is such that the description is always th...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 0.9   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 2.3   Edit
Assignee: Frank Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 190011 198861 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-11-27 15:43 EST by Nathan Beyer (Cerner) CLA
Modified: 2008-02-28 18:47 EST (History)
5 users (show)

See Also:


Attachments
ImageHyperlink to sort Comments (4.14 KB, patch)
2007-11-30 18:07 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (5.19 KB, application/octet-stream)
2007-11-30 18:07 EST, Frank Becker CLA
no flags Details
sort-down.gif (350 bytes, image/gif)
2007-11-30 18:09 EST, Frank Becker CLA
no flags Details
sort-up.gif (350 bytes, image/gif)
2007-11-30 18:11 EST, Frank Becker CLA
no flags Details
compleate patch (8.81 KB, patch)
2007-12-01 16:41 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (8.67 KB, application/octet-stream)
2007-12-01 16:41 EST, Frank Becker CLA
no flags Details
New Patch (9.29 KB, patch)
2008-01-24 17:08 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (11.13 KB, application/octet-stream)
2008-01-24 17:08 EST, Frank Becker CLA
no flags Details
New Patch (17.00 KB, patch)
2008-01-25 15:49 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (14.33 KB, application/octet-stream)
2008-01-25 15:50 EST, Frank Becker CLA
no flags Details
Followup Patch (5.96 KB, patch)
2008-01-27 09:51 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (15.40 KB, application/octet-stream)
2008-01-27 09:52 EST, Frank Becker CLA
no flags Details
sort-down-gray.gif (275 bytes, image/gif)
2008-01-27 09:55 EST, Frank Becker CLA
no flags Details
sort-up-gray.gif (275 bytes, image/gif)
2008-01-27 09:56 EST, Frank Becker CLA
no flags Details
sorting icon (610 bytes, image/gif)
2008-01-28 00:33 EST, Eugene Kuleshov CLA
no flags Details
jUnit Test (3.84 KB, patch)
2008-01-28 21:34 EST, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (20.36 KB, application/octet-stream)
2008-01-28 21:34 EST, Frank Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Beyer (Cerner) CLA 2006-11-27 15:43:38 EST
Build ID: M20060921-0945

Steps To Reproduce:
1. Goto Bugzilla
2. Open User Preferences
3. Goto General Preferences
4. Change comment ordering to "Newest to Oldest"
5. Run Eclipse with Mylar
6. Open any bug in the Mylar bug editor using the same user credentials as used with preference changes.
7. The Description field will contain the text of the last comment entered (chronologically) instead of the first.


More information:
I'm running against a Bugzilla 2.22.1 server.
Comment 1 Eugene Kuleshov CLA 2006-11-27 16:01:24 EST
That is a cool feature. I didn't know you can do that. :-)
Comment 2 Robert Elves CLA 2006-11-28 18:16:36 EST
I don't think that setting is exposed in the config.cgi so we wouldn't be able to adapt to this preference change (unless we add capability to parse user's preferences). Perhaps in the short term we could add an advanced configuration section to the bugzilla repository configuration that would included options such as this (although I cringe at the thought of adding anything else to the configuration page).
Comment 3 Nathan Beyer (Cerner) CLA 2006-12-18 13:19:03 EST
(In reply to comment #2)
> I don't think that setting is exposed in the config.cgi so we wouldn't be able
> to adapt to this preference change (unless we add capability to parse user's
> preferences). Perhaps in the short term we could add an advanced configuration
> section to the bugzilla repository configuration that would included options
> such as this (although I cringe at the thought of adding anything else to the
> configuration page).
> 

Adding this to the repository configuration may be ugly, but it seems necessary as this is a feature that some installations may use.
Comment 4 Eugene Kuleshov CLA 2006-12-18 17:23:39 EST
Rob, can we just sort entries by date?
Comment 5 Robert Elves CLA 2007-01-02 12:57:10 EST
Adding sort capability to the editor would make sense. The only issue being that bugzilla sends the description as comment #0 so unfortunately we would still need to handle this in some fashion.
Comment 6 Eugene Kuleshov CLA 2007-01-02 13:08:00 EST
I meant that you do have date for each comment. Obviously description will be the earliest comment according to its date and not the position in the result returned by bugzilla.
Comment 7 Robert Elves CLA 2007-01-02 13:18:35 EST
Sorry, still waking up from vacation. :) You're right Eugene, we do have the date stamp for all the comments/description so this should be straight forward.
Comment 8 Nathan Beyer (Cerner) CLA 2007-01-02 14:10:01 EST
(In reply to comment #5)
> Adding sort capability to the editor would make sense. The only issue being
> that bugzilla sends the description as comment #0 so unfortunately we would
> still need to handle this in some fashion.
> 

Note, this invalid assumption is the core issue, Bugzilla does NOT always send the description as comment #0. Comment #0 is only the description if ordering is 'Oldest to Newest'.

I apologize if I'm just restating the obvious, but I always like to make sure everything is really clear.
Comment 9 Mik Kersten CLA 2007-01-05 09:01:16 EST
In terms of UI for toggling the sort order on the editor: I suggest using the same button location as the plugin.xml editor's All Extensions section on the Extensions page.  But I think that the full-sized icon is probably bettern than the shrunken one.  
Comment 10 Robert Elves CLA 2007-06-04 14:35:36 EDT
*** Bug 190011 has been marked as a duplicate of this bug. ***
Comment 11 Eugene Kuleshov CLA 2007-08-04 11:43:46 EDT
*** Bug 198861 has been marked as a duplicate of this bug. ***
Comment 12 Frank Becker CLA 2007-08-05 13:22:25 EDT
Is there a way to have access to the Bugzilla preferences so that here is a way to detect if comment 0 or comment n is the description?

 I think it is the correct way to show comments in mylyn in the defined order  of bugzilla pereference.

A sort button is nice but I think a change of the bugzilla perference is for me  the better (clearer) way.
Comment 13 Eugene Kuleshov CLA 2007-08-05 13:53:18 EDT
-1 for using bugzilla preferences for this. Like it been said in comment #6, each comment has timestamp and description is just a comment with the earliest timestamp. 

Also see/vote for bug 195656 that is requesting an option to show comments in reversed order in the task editor.
Comment 14 Mik Kersten CLA 2007-08-13 12:08:18 EDT
Related to bug 195656.  If we consider this we need to consider how this affects other parts of the layout (e.g. Actions section needs to be near New Comment, which needs to be near the last comment).
Comment 15 Eugene Kuleshov CLA 2007-08-13 12:33:27 EDT
(In reply to comment #14)
> e.g. Actions section needs to be near New Comment, which needs to be near the last comment).

I can't find bug report for that, but there should be one about making editor actions vs. editor save story. It could allow to eliminate need in the action section, or move it out of the editor layout, i.e. in a dialog/wizard.
Comment 16 Frank Becker CLA 2007-11-30 18:07:15 EST
Created attachment 84246 [details]
ImageHyperlink to sort Comments

Here is an ImageHyperlink that can sort the Comments.

What do you think about this.

Next I will attache the two new gif files
Comment 17 Frank Becker CLA 2007-11-30 18:07:26 EST
Created attachment 84247 [details]
mylyn/context/zip
Comment 18 Frank Becker CLA 2007-11-30 18:09:29 EST
Created attachment 84248 [details]
sort-down.gif

put the file to /org.eclipse.mylyn.tasks.ui/icons/etool16/sort-down.gif
Comment 19 Frank Becker CLA 2007-11-30 18:11:37 EST
Created attachment 84249 [details]
sort-up.gif

put the file to org.eclipse.mylyn.tasks.ui/icons/etool16/sort-up.gif
Comment 20 Frank Becker CLA 2007-12-01 16:41:20 EST
Created attachment 84263 [details]
compleate patch

the patch from comment#16 did only add an action to the comment section.

This patch show the comments and the description in the right order.

Bugzilla knows the following values for "When viewing a bug, show comments in this order"
-  Site Default (Oldest to Newest)
-  Oldest to Newest
-  Newest to Oldest
-  Newest to Oldest, but keep Description at the top

Before this patch the Description was only correct if the Description is the first in the list of Longdescription. This was not true for the option Newest to Oldest.

BTW feel free to add a more nicely gif for the sortup and sortdown from comment  18 and 19.
Comment 21 Frank Becker CLA 2007-12-01 16:41:24 EST
Created attachment 84264 [details]
mylyn/context/zip
Comment 22 Robert Elves CLA 2008-01-23 22:00:36 EST
This is very cool Frank. A few nits:

* Task Comment number ideally shouldn't  mutable. Is there any way of achieving the same result without adding this new api?
* Sort order button should be disabled when Comments section collapsed (for that matter so should the collapse all button)
* sortComments() assumes sortSection exists but may not due to createCommentLayout() being overridden
* We may also want to make this feature optional (perhaps using a commentsSortable boolean set in implementing editor's constructor.. ideas?)
* sortComments has to got to great lengths to get the proper composites to move. Ideally this would be factored into Steffen's editor revamp

And as always, the more unit tests we see with patches the easier to verify. In the very least we could test that comments in a retrieved bug report are indeed in the correct order considering the changes made to comment construction in SaxMultiBugReportContentHandler.

Comment 23 Robert Elves CLA 2008-01-23 22:57:33 EST
Steffen, adding you to the cc here since it would be great if you could include the comment ordering concern in your ongoing decomposition of the Task Editor. See comment#23. 
Comment 24 Steffen Pingel CLA 2008-01-24 00:33:28 EST
Thanks. From a quick glance at the patch it looks like it should be straight forward to port to the new architecture so I am fine with going ahead here. I have added a note to bug 179254.
Comment 25 Frank Becker CLA 2008-01-24 16:10:57 EST
 (In reply to comment #22)
> This is very cool Frank. A few nits:
> 
> * Task Comment number ideally shouldn't  mutable. Is there any way of achieving
> the same result without adding this new api?
If we have no TaskComment.setNumber we must clone all longDescs in SaxMultiBugReportContentHandler.endElement because only the constructor can set the number.
> * Sort order button should be disabled when Comments section collapsed (for that
> matter so should the collapse all button)
Why? Actually you can change the order while all comments are collapsed . If you then expand the show up in the expected order.
> * sortComments() assumes sortSection exists but may not due to
> createCommentLayout() being overridden
Patch for this is comming soon.
> * We may also want to make this feature optional (perhaps using a
> commentsSortable boolean set in implementing editor's constructor.. ideas?)
Patch for this is comming soon. What's about protected boolean supportsCommentSort() used for this?
> * sortComments has to got to great lengths to get the proper composites to move.
> Ideally this would be factored into Steffen's editor revamp
> 
> And as always, the more unit tests we see with patches the easier to verify. In
> the very least we could test that comments in a retrieved bug report are indeed
> in the correct order considering the changes made to comment construction in
> SaxMultiBugReportContentHandler.
What is the rigth way to implement tests? Should I use the http://mylyn.eclipse.org/bugs30 ore can I use an xml file. 
If xml file where should I store it?
Comment 26 Frank Becker CLA 2008-01-24 17:08:04 EST
Created attachment 87813 [details]
New Patch

see comment#25
Comment 27 Frank Becker CLA 2008-01-24 17:08:11 EST
Created attachment 87814 [details]
mylyn/context/zip
Comment 28 Robert Elves CLA 2008-01-24 17:29:42 EST
 (In reply to comment #25)
> (In reply to comment #22)
> > This is very cool Frank. A few nits:
> >
> > * Task Comment number ideally shouldn't  mutable. Is there any way of
> achieving
> > the same result without adding this new api?
> If we have no TaskComment.setNumber we must clone all longDescs in
> SaxMultiBugReportContentHandler.endElement because only the constructor can set
> the number.

Hmmm yes... this is a problem. Lets go with your current implementation.

> > * Sort order button should be disabled when Comments section collapsed (for
> that
> > matter so should the collapse all button)
> Why? Actually you can change the order while all comments are collapsed . If you
> then expand the show up in the expected order.
The user should see the result of their action. So we should either enable/disable the button, or expand the section upon pressing the direction button if the section was not already opened.  

> > * We may also want to make this feature optional (perhaps using a
> > commentsSortable boolean set in implementing editor's constructor.. ideas?)
> Patch for this is comming soon. What's about protected boolean
> supportsCommentSort() used for this?
That could work.

> > And as always, the more unit tests we see with patches the easier to verify.
> In
> > the very least we could test that comments in a retrieved bug report are
> indeed
> > in the correct order considering the changes made to comment construction in
> > SaxMultiBugReportContentHandler.
> What is the rigth way to implement tests? Should I use the
> http://mylyn.eclipse.org/bugs30 
I'd just create a bug with a few comments and write a test against it.

Comment 29 Robert Elves CLA 2008-01-24 17:40:18 EST
Patch is looking good Frank. One final point in addition to those in my previous comment. We should store the chosen sort direction in a TasksUiPlugin preference.  The preference should likely be connector kind specific as well so you can have two different defaults for Trac and Bugzilla for example.  So a preference key along the lines of:

"org.eclipse.mylyn.editor.comments.sortDirection."+taskData.getRepositoryKind();

...would get set. Thoughts?
Comment 30 Frank Becker CLA 2008-01-25 15:49:56 EST
Created attachment 87910 [details]
New Patch

With this patch I include the following items.

- store sortdirection in preferences (comment#29)
- supportsCommentSort() for enable/disable the sort (comment#28)
- disable sortbutton if comments are not shown (comment#28)
Comment 31 Frank Becker CLA 2008-01-25 15:50:01 EST
Created attachment 87911 [details]
mylyn/context/zip
Comment 32 Robert Elves CLA 2008-01-26 23:29:48 EST
Great Frank. Patch applied, and ip log updated.  I had to make supportsCommentSort() return false by default and moved creation of the hyperlink around so that we don't get npes when there are no comments on the bug report. Enabled comment sorting on Bugzilla's editor. 

Steffen, you may want to consider making use of this for Trac and Jira.

Mik, the buttons provided for this action look reasonable but you may want to iterate on them.
Comment 33 Steffen Pingel CLA 2008-01-27 01:10:06 EST
Cool stuff! I'll hold off on making this available for other connectors until bug 179254 is resolved.
Comment 34 Steffen Pingel CLA 2008-01-27 02:45:39 EST
 (In reply to comment #30)
> - disable sortbutton if comments are not shown (comment#28)

The button is disabled but there is no indication that it is not clickable which is a bit odd. I would suggest to either remove it or to grey it out when the section is collapsed.
Comment 35 Frank Becker CLA 2008-01-27 09:51:59 EST
Created attachment 87968 [details]
Followup Patch

This pach include the gray out as described in comment 34.

Two new gif icon follows as seperated attachments.

Rob in comment 28 you wrote:
> I'd just create a bug with a few comments and write a test against it.
Can you tell me where I can find this test. I want to look at tiis, so that I can write tests by my on in future.
Comment 36 Frank Becker CLA 2008-01-27 09:52:12 EST
Created attachment 87969 [details]
mylyn/context/zip
Comment 37 Frank Becker CLA 2008-01-27 09:55:18 EST
Created attachment 87970 [details]
sort-down-gray.gif

put the file to /org.eclipse.mylyn.tasks.ui/icons/etool16/sort-down-gray.gif
Comment 38 Frank Becker CLA 2008-01-27 09:56:24 EST
Created attachment 87971 [details]
sort-up-gray.gif

put the file to /org.eclipse.mylyn.tasks.ui/icons/etool16/sort-up-gray.gif
Comment 39 Eugene Kuleshov CLA 2008-01-28 00:25:39 EST
(In reply to comment #32)
> Great Frank. Patch applied, and ip log updated.  I had to make
> supportsCommentSort() return false by default

Rob, I wonder what was the rationale for disabling sorting comments? If this operation is there, why not have it always enabled, which would make it consistent across connectors and also reduce the api?
Comment 40 Eugene Kuleshov CLA 2008-01-28 00:33:35 EST
Created attachment 87983 [details]
sorting icon

Maybe it is better to use icon along the lines with this one? It came from one of the platform plugins.
Comment 41 Robert Elves CLA 2008-01-28 13:36:22 EST
 (In reply to comment #35)
> Rob in comment 28 you wrote:
> > I'd just create a bug with a few comments and write a test against it.
> Can you tell me where I can find this test. I want to look at tiis, so that I
> can write tests by my on in future.
You could add to a test like BugzillaTaskDataHandlerTest or whatever test class is most appropriate (or create  a new one and add it to AllBugzillaTests.java). 
I've applied your patch Frank and updated the ip log. You will notice I've also switched up the default direction variable so that when the preference is first read the sort direction isn't up by default.


 (In reply to comment #39)
> Rob, I wonder what was the rationale for disabling sorting comments? If this
> operation is there, why not have it always enabled, which would make it
> consistent across connectors and also reduce the api?
We will take this into account when refactoring the editor. I added this as a precautionary measure since if createCommentLayout is overridden and the sort 
hyperlink never created, with the current code this will result in an eventual NPE.


 (In reply to comment #40)
> Created an attachment (id=87983)
> sorting icon
> 
> Maybe it is better to use icon along the lines with this one? It came from one
> of the platform plugins.
I've committed Frank's icons for now and anticipate Mik will use some platform flook&feel icons as you suggest Eugene.


Comment 42 Frank Becker CLA 2008-01-28 21:34:09 EST
Created attachment 88084 [details]
jUnit Test

> > Rob in comment 28 you wrote:
> > > I'd just create a bug with a few comments and write a test against it.
> > Can you tell me where I can find this test. I want to look at tiis, so that I
> > can write tests by my on in future.
> You could add to a test like BugzillaTaskDataHandlerTest or whatever test class
> is most appropriate (or create  a new one and add it to AllBugzillaTests.java). 

I start with a simple test.

Now I want to open the editor from that test to force method sortComments of AbstractRepositoryTaskEditor but didn't get this work.

How can help?
Comment 43 Frank Becker CLA 2008-01-28 21:34:12 EST
Created attachment 88085 [details]
mylyn/context/zip
Comment 44 Mik Kersten CLA 2008-01-29 02:10:41 EST
I can create the icons.  Nice work Frank!

The question I have about the status of this feature for 2.3, is what impact it has on the rest of the task editor UI.  While we have always discussed the idea of reversing the order, we have accepted that it has other implications (e.g. New Comment and actions should appear near the last comment).  So I'm wondering how those using this and trying it out are using the feature.  Are you keeping comments in reverse order?  Does it make sense for us to release this without touching the other affected parts of the interaction?  I'm not saying that the answer is no, since the button is very obvious and unobtrusive.  But clicking it triggers a serious UI change that has other implications that I would like to understand before we release it.
Comment 45 Frank Becker CLA 2008-01-29 16:21:04 EST
 (In reply to comment #44)
> I can create the icons.  Nice work Frank!
> 
> The question I have about the status of this feature for 2.3, is what impact it
> has on the rest of the task editor UI.  While we have always discussed the idea
> of reversing the order, we have accepted that it has other implications (e.g.
> New Comment and actions should appear near the last comment).
What is with the original Bugzilla code? Layout is the following New Comment, radiobutton actions, description and the comments. 
But this meen with the default order the latest comment is at the button of the page. So that new comment can be fare away.

The option "Newest to Oldest, but keep Description on the Top" is for my the only one where new comment, newest comment and description are close together.

For Mylyn this can be done if we change layout to Description, new Comment, Comments. But where we the place Actions and People.
For me Description, new Comment,  Actions and People, Comments could work. What do you think?

>  So I'm wondering
> how those using this and trying it out are using the feature.  Are you keeping
> comments in reverse order?
No comment are in the original order only the Control array is changed by the method 
org.eclipse.swt.widgets.Control.moveAbove(org.eclipse.swt.widgets.Control)

>  Does it make sense for us to release this without
> touching the other affected parts of the interaction?  I'm not saying that the
> answer is no, since the button is very obvious and unobtrusive.  But clicking it
> triggers a serious UI change that has other implications that I would like to
> understand before we release it.

I use the reverse order if I want to know if the latest comment  and the description are related. In some Tasks I found that over a number of comments the direction was changed so that the latest comment did not longer match to the description.

If I have stuff that is related to an comment (latest or not) I do most of the time use the reply button and delete the commented text after I insert my new text.
Comment 46 Frank Becker CLA 2008-01-29 16:27:13 EST
BTW, what do you think about to have a sizable scroller control that hold the whole Comment Group. With this it is possible to use the lowest possible space to show up what the user expect to see. 
Comment 47 Steffen Pingel CLA 2008-01-29 17:04:31 EST
I find the reverse comment ordering particularly useful when browsing incoming changes. Now I have to scroll less often to get to new comments. Rob and I have discussed further optimizations, e.g. putting people next to attributes and moving down attachments but it will require some experimentation to find a good layout that also works well on small screens.

On the downside I got confused a few times when a bug had no incomings. Being so used to the standard ordering I looked I scrolled down to the last comment in the list and only notice after reading that it wasn't what I was looking for. I am not sure if it is helpful to have the option to reverse the comment ordering in the task editor or if that should be a global option to always have a predictable order when opening the editor.

 (In reply to comment #44)
> The question I have about the status of this feature for 2.3, is what impact it
> has on the rest of the task editor UI.  While we have always discussed the idea
> of reversing the order, we have accepted that it has other implications (e.g.
> New Comment and actions should appear near the last comment).  So I'm wondering
> how those using this and trying it out are using the feature.  

I would like us to hold off with any changes of that sort until the editor code is refactored for 3.0. Since the time frame until 2.3 might be too short to converge on the UI we could also make the comment ordering a sandbox option. That would give us the opportunity to gather more feedback before releasing it to a larger user base (after that it's going to be more difficult to change the way the feature works).
Comment 48 Eugene Kuleshov CLA 2008-01-29 17:51:19 EST
 (In reply to comment #47)
> I find the reverse comment ordering particularly useful when browsing incoming
> changes. Now I have to scroll less often to get to new comments. 

There was an idea to not show collapsed entries and only show expanded entries with the new comments (i.e. have actions on "Comments" section header like "show new", "show last N", "show all".

What bugs me about reversed comment order is that it breaks the chronological order and if there is more then one new comment you have to read from the bottom, which doesn't really encourage the reader to understand entire discussion.
Comment 49 Robert Elves CLA 2008-02-28 18:47:20 EST
fyi Frank, I've disabled comment ordering in the Bugzilla task editor for the 2.3 release. We need to sort out the ui layout issues befor general release. We'll iterate on these as early as possible in the 3.0. I'll make it a sandbox enabled feature in the short term (i.e. install mylyn sandbox and comment ordering becomes enabled in the Bugzilla task editor).