I'm trying to write my first Atlassian plugin, and I found it pretty easy to get started, but now I'm stuck. I suspect someone with more experience can quickly point me in the right direction.
I'm writing a GutterRenderer plugin for Crucible. I want to display information in the diff gutter which I've stored in a database elsewhere, and which is keyed on the review ID. The GutterRenderer interface allows me to find the repository, the file paths, and the file revisions, but it doesn't provide any information about the review. (We use pre-push reviews, so I can't rely on all files having meaningful revisions).
How can I determine that my renderer is being invoked in the context of a code review, and not just a diff, and how can I discover details about the review?
Hi Peter,
it seems that there's a long standing issue to provide some context (including the review id) to gutter renderers - https://jira.atlassian.com/browse/FE-1363. Please vote for it and add a comment abou the features you'd like to see.
Without the context, I think your best bet is using com.atlassian.sal.api.web.context.HttpContext to retrieve the current request, and determine the current review based on the requests's url. Reviews urls will generally have /cru/REVIEW-PERM-ID in their url.
Thanks for the suggestion. I figured out how to wire an HttpContext into my plugin, but sadly the requesteURL() doesn't include the CR identifier:
http://crucible34.example.com:3990/fecru/WEB-INF/jsp/crucible/review/monolithic/displayFrxInnerDiv.jsp
It looks like the referer header does include the number:
http://crucible34.example.com:3990/fecru/cru/CR-2
I'm going to use this for now, but I'm reluctant to rely on referer URLs, as there's little guarantee that the referer header will be accurate.
Crucible must be communicating this information to the child page somehow, but I don't yet see how. Perhaps it's stashed away in an Atlassian session object somewhere.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.