Bug 386705 - expand patch set when hyperlink clicked
Summary: expand patch set when hyperlink clicked
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 2.0   Edit
Assignee: Miles Parker CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on:
Blocks:
 
Reported: 2012-08-06 15:52 EDT by Sam Davis CLA
Modified: 2013-02-05 18:16 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Davis CLA 2012-08-06 15:52:16 EDT
When clicking https://gerrit.example.com/#/c/411/3 patch set 3 should be expanded.
Comment 1 Miles Parker CLA 2013-01-30 19:17:46 EST
You mean *instead* of opening the relevant web page?
Comment 2 Sam Davis CLA 2013-01-30 19:32:02 EST
If you have the connector installed and the repository set up, it doesn't open a web page, it opens the review editor. This bug is about also expanding the patch set.
Comment 3 Miles Parker CLA 2013-01-30 19:57:57 EST
Thanks for the clarification. I had actually clicked on your example review url above. ;)
Comment 4 Miles Parker CLA 2013-01-30 21:50:34 EST
Proposed solution:

https://git.eclipse.org/r/#/c/10057/
Comment 5 Steffen Pingel CLA 2013-01-31 12:10:59 EST
This is a great suggestion. Miles, the forms API provides FormPage.selectReveal() for this purpose. You can take a look at TaskEditorAttachmentPart for instance to see an example implementation.
Comment 6 Miles Parker CLA 2013-01-31 13:03:43 EST
(In reply to comment #5)
> This is a great suggestion. Miles, the forms API provides
> FormPage.selectReveal() for this purpose. You can take a look at
> TaskEditorAttachmentPart for instance to see an example implementation.

Thanks for the reference. Looks like TaskEditorAttachmentPart uses it's own implementation. It's also using a CommonFormUtil#setExpanded hack because (as I also discovered) expandable composite doesn't seem to provide a good way to programmatically alter the expansion state *and* fire the notification, which the PatchSetSection relies on to lazily create the contents. I went with another approach which was to simply call the same code when we expanded programmatically.

 I missed the "selection" part of the reveal. I'm going to add that. Otherwise, do you see any problem w/ the way it is implemented as is?
Comment 7 Steffen Pingel CLA 2013-01-31 13:12:10 EST
(In reply to comment #6)
> (In reply to comment #5)
> > This is a great suggestion. Miles, the forms API provides
> > FormPage.selectReveal() for this purpose. You can take a look at
> > TaskEditorAttachmentPart for instance to see an example implementation.
> 
> Thanks for the reference. Looks like TaskEditorAttachmentPart uses it's own
> implementation. It's also using a CommonFormUtil#setExpanded hack because (as I
> also discovered) expandable composite doesn't seem to provide a good way to
> programmatically alter the expansion state *and* fire the notification, which
> the PatchSetSection relies on to lazily create the contents. 

Yes, I would prefer if we used the same approach consistently.

> I missed the "selection" part of the reveal. I'm going to add that. Otherwise,
> do you see any problem w/ the way it is implemented as is?

I am not sure we need the section manager abstraction. I would prefer if the section simply expanded itself.
Comment 8 Miles Parker CLA 2013-01-31 14:11:28 EST
(In reply to comment #7)
> I am not sure we need the section manager abstraction. I would prefer if the
> section simply expanded itself.

Yep. By using the CommonFormUtil hack that forces the toggle notification, we're able to do away with all of that.  Please see https://git.eclipse.org/r/#/c/10057/4.
Comment 9 Steffen Pingel CLA 2013-02-01 08:58:16 EST
It looks like the code doesn't use FormPage.selectReveal(). Can you comment why you decided against using that?
Comment 10 Miles Parker CLA 2013-02-01 14:45:06 EST
(In reply to comment #9)
> It looks like the code doesn't use FormPage.selectReveal(). Can you comment why
> you decided against using that?

Tried it, but it didn't work. I don't think setting the input is the appropriate thing to do here. Then I looked at the pattern in AbstractTaskEditorAttributeSection#selectReveal that used CommonFormUtil.setExpanded(getSection(), true); it worked perfectly, so I went with that. I didn't use the  EditorUtil.reveal(..) part of that because there are some unneccesary calls and the scroll to sport was off -- not sure why, but I'm thinking maybe because we're actually revealing a sub section.. (?)

I want to change the name of the method to reveal at Sam's suggestion but I'll hold on that to see if there are any other changes. I'm also going to check if the patch set is already expanded.
Comment 11 Miles Parker CLA 2013-02-01 17:12:11 EST
Okay please see latest review. Steffen, there are some additional notes on why I chose the reveal strategy I did.
Comment 12 Steffen Pingel CLA 2013-02-02 18:21:56 EST
(In reply to comment #11)
> Okay please see latest review. Steffen, there are some additional notes on why I
> chose the reveal strategy I did.

Okay, sounds reasonable. I have rebased the change against the latest master. Under 4.3 the scrolling to the section didn't work but this might be a bug in 4.3 which is behaving in funny ways with the editors (haven't verified on other versions). Let me know if it works for you and we can merge.
Comment 13 Miles Parker CLA 2013-02-04 15:16:16 EST
(In reply to comment #12)
> Okay, sounds reasonable. I have rebased the change against the latest master.
> Under 4.3 the scrolling to the section didn't work but this might be a bug in
> 4.3 which is behaving in funny ways with the editors (haven't verified on other
> versions). Let me know if it works for you and we can merge.

It works fine here, but I'm running 3.8. :) I can get a 4.2/4.3 setup going if you think that makes sense. I'm also wondering if it might be a Linux thing, in which case we obviously need to address it. Do you see it on earlier versions? 

I'm also getting an annoying thing happening.  Originally, I had the scroll to scroll the section such that it was at the top of the view port, but this code just scrolls the minimum extent needed to reveal. The scroll to works fine initially - it scrolls up to uncover the complete patch set, but then after the patch set is actually downloaded the controls look like they are layed out again, adding an additional 10pxs or so. That then puts the button bottoms slightly below the view port, which is kind of ugly.

I'm not quite ready to merge yet in any case. I want to add a bit of test coverage for the URL handling.
Comment 14 Miles Parker CLA 2013-02-04 16:15:19 EST
(In reply to comment #13)
> I'm not quite ready to merge yet in any case. I want to add a bit of test
> coverage for the URL handling.

I've taken care of that. Note that I have put a small fix into the connector getTaskUrl code as well. I hope it's okay to put that into this patch, but it is neccessary to make the tests work properly.
Comment 15 Steffen Pingel CLA 2013-02-05 18:15:46 EST
The change was merged into master. Thanks very much for the contribution!