DESCRIPTION

Synchronize View: show 'Add To Index' only when applicable

Also add 'Remove From Index', and make the menu entry order the same
for IResources and for GitModelObjects. Change the ResourceStateFactory
to work not only for IResource but also for java.io.File.

To handle unstaged deletions, propagate isMissing() through
IResourceState. (This fixes the _display_ of menu entries, but 'Add to
Index' doesn't work on unstaged deletions -- that's bug 483404.)

Bug: 355809
Change-Id: I2b111dd7be58c0b73d200278aa7f0fe2aaaccda9
Signed-off-by: Alayna Houston xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2015-12-05 09:45:09.000000000

Patch Set 6:

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

-------------------------------------
author: Brenden Conley
date: 2015-12-05 10:08:46.000000000

Patch Set 6: Verified+1

Build Successful 

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

-------------------------------------
author: Jayvion Booth
date: 2015-12-06 20:23:05.000000000

Patch Set 6:

(12 comments)

Line:64, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/IResourceState.java -> missing

Line:57, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> should it be public? In case at the caller site we want know if the returned state is not known?
Also I think this should be immutable.

Line:126, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Here and below we should mention we return UNKNOWN_STATE if there is no index diff data available.

Line:190, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> wrong type

Line:202, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> can be moved after line 217

Line:207, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> UNKNOWN_STATE

Line:215, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> UNKNOWN_STATE

Line:222, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> why this? this deserves at least a comment

Line:328, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> private interface is used in public method signatures. Either of two should be changed.

Line:333, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> since resourceitem uses getLocation(), this method should be annotated as nullable and the caller code must check for null.

Line:414, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> in theory we could replace this with the code which uses getFullPath() and tries to resolve it against workspace location even if the resource does not exist (anymore).
If not, this xxx@xxx.xxx and parent interface method too.

Line:124, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitActionContributor.java -> this is never null

-------------------------------------
author: Alayna Houston
date: 2015-12-06 21:06:26.000000000

Patch Set 6:

(12 comments)

Line:64, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/IResourceState.java -> Done

Line:57, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:126, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:190, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:202, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:207, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:215, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:222, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done. Added the commit comment from change Ic3f6e0b as a comment.

Line:328, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done. Method above made private. (That it was public was a copy-paste error.)

Line:333, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> Done

Line:414, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java -> I don't quite get that. The best I could think of is

  IPath path = resource.getLocation();
  if (path != null) {
    return path;
  }
  path = resource.getProject().getLocation();
  if (path != null) {
     return path.append(resource.getFullPath().removeFirstSegments(1));
  }
  return null;

but (a) that is still Nullable (in case the whole project got deleted), and (b) we'd have to do that in numerous other places for it to have an effect here.

Line:124, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitActionContributor.java -> Done

-------------------------------------
author: Gerrit Johnathan Pham
date: 2015-12-06 22:50:27.000000000

Change has been successfully merged into the git repository by Jayvion Booth

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