Best approach for a codereview plugin

I'd like to write a plugin that allows me to email code reviews to other
developers. The email would consist of a diff between my working version
and the CVS version of one or more files that I've been working on. My question
is, what would be the easiest way to go about implementing this? Ideally
I'd like to have a dialog very similar to the "Commit Changes" dialog (or
even better, I'd add functionality to that dialog directly) that lets me
select which files (or changelists) to email off for review. I'm not sure
how easy that would be though since I know virtually nothing about the OpenAPI.

Can someone who has a bit of knowledge in this area please let me know whether
my idea is even feasible, or if not what might be a better approach to take?

Many thanks,
Chris


4 comments

Hello Chris,

CM> I'd like to write a plugin that allows me to email code reviews to
CM> other developers. The email would consist of a diff between my
CM> working version and the CVS version of one or more files that I've
CM> been working on. My question is, what would be the easiest way to go
CM> about implementing this? Ideally I'd like to have a dialog very
CM> similar to the "Commit Changes" dialog (or even better, I'd add
CM> functionality to that dialog directly) that lets me select which
CM> files (or changelists) to email off for review. I'm not sure how
CM> easy that would be though since I know virtually nothing about the
CM> OpenAPI.
CM>
CM> Can someone who has a bit of knowledge in this area please let me
CM> know whether my idea is even feasible, or if not what might be a
CM> better approach to take?

If you are targeting IDEA 6.0 beta, you can integrate directly into the Commit
Changes dialog. You'll need to provide an implementation of the CommitExecutor
interface and register it using ChangeListManager.getInstance().registerCommitExecutor().
You'll receive the list of files being checked in through your implementation
of CommitSession.execute(), which you will return from CommitExecutor.createCommitSession().

If you have any more specific questions, feel free to ask.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hi Dmitry,

Yes I'll be writing it for IDEA 6.0. Thanks for your comments, I'll have
a go using the approach you suggest. It sounds like you're suggesting I override
the action performed by the "Commit" button though. I don't want that functionality
to change, rather I want something like an extra button "Code Review" next
to "Commit" that emails the diffs rather than commits them to CVS. That's
because where I'm working we often perform codereviews as a separate step
before anything is committed to the codestore.

Anyway, I guess I really just need to jump in and start playing with the
API and it should start to become clear. Many thanks for your pointers.

Chris

Hello Chris,

CM>> I'd like to write a plugin that allows me to email code reviews to
CM>> other developers. The email would consist of a diff between my
CM>> working version and the CVS version of one or more files that I've
CM>> been working on. My question is, what would be the easiest way to
CM>> go about implementing this? Ideally I'd like to have a dialog very
CM>> similar to the "Commit Changes" dialog (or even better, I'd add
CM>> functionality to that dialog directly) that lets me select which
CM>> files (or changelists) to email off for review. I'm not sure how
CM>> easy that would be though since I know virtually nothing about the
CM>> OpenAPI.
CM>>
CM>> Can someone who has a bit of knowledge in this area please let me
CM>> know whether my idea is even feasible, or if not what might be a
CM>> better approach to take?
CM>>

If you are targeting IDEA 6.0 beta, you can integrate directly into
the Commit Changes dialog. You'll need to provide an implementation of
the CommitExecutor interface and register it using
ChangeListManager.getInstance().registerCommitExecutor(). You'll
receive the list of files being checked in through your implementation
of CommitSession.execute(), which you will return from
CommitExecutor.createCommitSession().

If you have any more specific questions, feel free to ask.



0

Hello Chris,

CM> Yes I'll be writing it for IDEA 6.0. Thanks for your comments, I'll
CM> have a go using the approach you suggest. It sounds like you're
CM> suggesting I override the action performed by the "Commit" button
CM> though. I don't want that functionality to change, rather I want
CM> something like an extra button "Code Review" next to "Commit" that
CM> emails the diffs rather than commits them to CVS.

That's exactly how it works. Buttons for registerd commit executors are displayed
in addition to the standard "Commit" button.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hi Dmitry,

I've finally found some time to start working on this plugin. I've done as you've suggested and I now have a "Code Review" button on the commit dialog. However if my CommitSession implementation returns null for the getAdditionalConfigurationUI() method, IDEA barfs with a NPE when I click the button. If I instead return a JComponent of some sort IDEA displays that component on a DialogWrapper instance with OK/Cancel buttons. The problem is I don't want to display anything at this point, I just want to proceed to my CommitSession.execute() implementation and then display a dialog after the execute() method has done its work so I can show the contents of the email that will be sent (which depends on the changes passed through to execute()).

Should returning null from getAdditionalConfigurationUI() prevent a dialog from being displayed, or should I file a feature request for this?

Chris

0

Please sign in to leave a comment.