DESCRIPTION

Add ICommitMessageProvider2 for caret positioning in commit messages

The caret in the CommitMessageComponent is placed, according to the
value of getCaretPosition() of the first implementation of
ICommitMessageProvider2, that was discovered. In case there are multiple
implementations available, 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-05-26 11:06:51.000000000

Uploaded patch set 5: Patch Set 4 was rebased.

-------------------------------------
author: Brenden Conley
date: 2017-05-26 11:06:57.000000000

Patch Set 5:

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

-------------------------------------
author: Brenden Conley
date: 2017-05-26 11:07:34.000000000

Patch Set 5: Verified-1

Build Failed 

https://hudson.eclipse.org/egit/job/egit.gerrit/9887/ : FAILURE

-------------------------------------
author: Brenden Conley
date: 2017-05-30 09:36:22.000000000

Patch Set 5: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2017-05-30 10:00:59.000000000

Patch Set 5: Verified+1

Build Successful 

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

-------------------------------------
author: Alayna Houston
date: 2017-06-04 14:27:16.000000000

Patch Set 5: Code-Review-1

(14 comments)

Line:1, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Missing copyright header.

Line:17, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> It is in general bad practice to have Javadoc comments without description but only tags. Should have at least one sentence (including the final period) explaining what this method does.

Line:18, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> This needs an explanation what those resources are.

Line:27, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> ?? We don't xxx@xxx.xxx tags anyway. Just put a descriptive comment.

Line:67, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> How about

  return Objects.hashCode(message, Integer.valueOf(desiredCaretPosition));

?

Line:82, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Please supply the missing curly braces.

Line:91, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> How about

  return desiredCaretPosition == other.desiredCaretPosition &&
      Objects.equals(message, other.message);

?

Line:58, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponentStateManager.java -> This *must* be backwards compatible and also work with with old saved states that do not have that caret position.

Line:1, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Missing copyright header.

Line:80, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> This separation is awkward and results in our calling the ICommitMessageProvider2 twice, which is unnecessary since it already returns both the message and the desired caret position in the first call.

Line:111, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Why this underscore?

Line:121, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Why did you push this logic of when to add a separator down here? It makes much more sense in the loop that assembles the various commit messages.

Line:148, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> I would log a warning only.

Line:219, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> ResourceUtil has operations for this.

-------------------------------------
author: James Mcgee
date: 2017-06-06 11:44:01.000000000

Patch Set 5:

(14 comments)

Do you want me to implement some SWTBot tests?

I might probably need some assistance as a kickstart. A first short question:
How can I dynamically add a plugin (-> ICommitMessageProvider2) to a test runtime?

Line:1, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Done

Line:17, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Done

Line:18, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> javadoc was copied from the getMessage() in ICommitMessageProvider. I improved the docs.

Line:27, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Done

Line:67, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Done

Line:82, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Done

Line:91, org.eclipse.egit.ui/src/org/eclipse/egit/ui/ICommitMessageProvider2.java -> Done

Line:58, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponentStateManager.java -> Done

Line:1, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

Line:80, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> I found it more readable. I changed the code to avoid the duplicate call

Line:111, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

Line:121, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> I found it more readable to extract the details of appending MESSAGE_SEPARATOR to a separate method.

Line:148, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

Line:219, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculator.java -> Done

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