DESCRIPTION

Extract ProjectReference as separate class

This enables the use of ProjectReference to keep the configurations of a
project set as collection of suitable data objects and not just strings.
Needed by bug 309578.

Change-Id: I5259b7b23095fcdc4cd7205d648f4714e9458b47
Signed-off-by: Jade Pennington xxx@xxx.xxx

COMMENTS

author: Brenden Conley
date: 2011-08-29 20:20:37.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2011-08-29 20:31:24.000000000

Patch Set 1: I would prefer that you didn't submit this

Build Unstable 
 
https://hudson.eclipse.org/sandbox/job/egit.gerrit/1562/ : UNSTABLE

-------------------------------------
author: Jade Pennington
date: 2011-08-29 20:31:57.000000000

Patch Set 1:

The test failure doesn't seem to be related to my change (it's in SynchronizeViewGitChangeSetModelTest).

-------------------------------------
author: Ace Duncan
date: 2011-08-29 21:03:50.000000000

Patch Set 1: I would prefer that you didn't submit this

(2 inline comments)



Line:56, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> There is nothing to do here.

Line:101, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> I'm not sure about public modifier here as version field represents reference's implementation details. I doubt consumers would be really interested in it.

I would leave it private (or even remove it) unless there is a real usecase that requires access to its value. Making it private later would be hard (due to API breakage), we can make it public later without any problems.

-------------------------------------
author: Ace Duncan
date: 2011-08-29 21:23:03.000000000

Patch Set 1: (1 inline comment)



Line:62, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Should anyone be able to create a new instance of reference instead of GitProjectSetCapability? I would rather make it package-level.

-------------------------------------
author: Danika Greer
date: 2011-08-29 21:28:10.000000000

Patch Set 1: I would prefer that you didn't submit this

(4 inline comments)



Line:56, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java -> I'd also move this to ProjectReference. This way, GitProjectSetCapability will only depend on ProjectReference and not vice versa.

Line:69, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java -> Should we refactor this to an equals method in ProjectReference (and hashCode of course)?

It would make its usage easier, you could just use a HashSet instead of having to remember to use this comparator.

Line:66, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Change the message key to ProjectReference_InvalidTokensCount.

Line:96, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> getOrigin is not used in GitProjectSetCapability, it should be removed (unless you plan to use it). The same comments about API apply as with getVersion below.

-------------------------------------
author: Ace Duncan
date: 2011-08-29 22:13:30.000000000

Patch Set 1: (2 inline comments)



Line:56, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java -> Good catch, Robin. +1

Line:96, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> +1 for removal

-------------------------------------
author: Jade Pennington
date: 2011-08-30 22:33:41.000000000

Patch Set 1: (2 inline comments)



Line:96, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> I'm planning to use it, so i want to leave it there.

Line:101, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Ok, but that way i would have to delete version, because it would be an unused private member, which causes an error with the current JDT properties. But since it isn't used at the moment (and i don't plan it to use), that would be no further problem for me, and if we need it later, we still can add it.
What do you suggest in that case?

-------------------------------------
author: Ace Duncan
date: 2011-08-31 15:05:39.000000000

Patch Set 1: (1 inline comment)



Line:101, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Use default level, so this method will be available from org.eclipse.egit.core package only, it's Ok.

Why not removing this field? In line #69 it's obvious what value we expect from the first token. Removing this field you have to document this explicitly somewhere, you have to keep it in sync etc. As there is no better documentation than code itself... please leave it inplace ;-)

-------------------------------------
author: Jade Pennington
date: 2011-08-31 15:22:01.000000000

Patch Set 1: (6 inline comments)



Line:56, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java -> Done

Line:69, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java -> Done

Line:56, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Done

Line:62, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> I want to create instances of ProjectReferences in the egit.mylyn.ui plugin, so i need it public (i guess using the package name org.eclipse.egit.core in the egit.mylyn.ui plugin wouldn't be ok?).

Line:66, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Done

Line:101, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> Done

-------------------------------------
author: Danika Greer
date: 2011-09-01 17:02:11.000000000

Patch Set 1: (1 inline comment)



Line:62, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> If you want to create instances of this, is the String constructor really the right approach? Wouldn't you prefer an API like ProjectReference(String repository, String branch, String projectDir)?

Or if you really want to use the serialized String approach, maybe there should be a method here that returns such a String from an existing ProjectReference (doing the inverse of the constructor).

-------------------------------------
author: Jade Pennington
date: 2011-09-05 08:31:12.000000000

Patch Set 1: (1 inline comment)



Line:62, org.eclipse.egit.core/src/org/eclipse/egit/core/ProjectReference.java -> At the moment i have the string from a project set file, so it's easy for me to call the constructor, because i don't need to split the string. With a method with separate arguments i would have to do it myself. So for me this constructor is the best and easiest way.

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