DESCRIPTION

Add ICommitMessageProvider2 for caret positioning in commit messages

The caret in the CommitMessageComponent is placed, according to the
value of getDesiredCaretPosition() of the first implementation of
ICommitMessageProvider2, that provides caret position. In case there are
multiple implementations available, which provide a defined caret
position, they are ignored.
Commit messages are not trimmed anymore, to ensure consistency between a
provided message and the provided caret position.

Bug: 516867
Change-Id: I1b0ffd33ef37196d53077d09774672c2b033835f
Signed-off-by: James Mcgee xxx@xxx.xxx

COMMENTS

author: James Mcgee
date: 2017-06-08 11:40:53.000000000

Uploaded patch set 9.

-------------------------------------
author: Brenden Conley
date: 2017-06-08 11:40:59.000000000

Patch Set 9:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/9913/

-------------------------------------
author: Brenden Conley
date: 2017-06-08 12:04:45.000000000

Patch Set 9: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/9913/ : SUCCESS

-------------------------------------
author: James Mcgee
date: 2017-06-08 12:42:33.000000000

Patch Set 9:

> (10 comments)
 > 
 > > How can I dynamically add a plugin (-> ICommitMessageProvider2)
 > to a test runtime?
 > 
 > That's going to be difficult without injection and without mocking.
 > Probably the best you can do is provide one statically in the test
 > bundle via an executable extension factory that itself delegates to
 > some singleton factory that creates the provider. That singleton
 > factory can be known to the test class, and the test class can
 > enable it just for its tests and disable it afterwards. The
 > singleton factory would return a no-op commit message provider if
 > disabled, and a test provider that does implement ICommitMessageProvider2
 > when enabled.
 > 
 > Just an idea; perhaps there's an easier way, but I can't think of
 > one off the top of my head.

I never worked with SWTBot and am not very familiar with Eclipse RCP API.
Can you explain in more detail, where and how I could create such an executable extension, and how I can make the runtime aware of it?

Thanks!!!

-------------------------------------
author: Alayna Houston
date: 2017-06-09 07:38:45.000000000

Patch Set 9:

(3 comments)

Line:150, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> I would store this in a local variable, makes this code much easier to read.

Line:157, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> This might return null.

Line:159, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Maybe 0 here? It's equivalent since we handled the NO_POSITION (-1) case above, but

* I find zero more logical here since we're testing whether the returned position is within the returned message.
* It avoids an implicit dependency on NO_POSITION being -1. This code would fail if NO_POSITION were -2 and the provider returned -1 as position.

-------------------------------------
author: James Mcgee
date: 2017-06-12 08:50:04.000000000

MISMATCHED INLINE COMMENT
Line:150, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

-------------------------------------
author: James Mcgee
date: 2017-06-12 08:50:04.000000000

MISMATCHED INLINE COMMENT
Line:157, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

-------------------------------------
author: James Mcgee
date: 2017-06-12 08:50:04.000000000

MISMATCHED INLINE COMMENT
Line:159, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

-------------------------------------
