Reorganize some classes after CS1 was removed

Some of these were shared between CS1 and the unified screen or
CS2. Now that CS1 is gone the "changes" package is mostly about
listing one or more changes in dashboards or search results.

Move code to "patches" (for unified) or "change" (for CS2).

Change-Id: Ia87183e1e8d105ea3894bb426432b10153205a6f
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java
index 5ebf7b0..36823ad 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java
@@ -25,10 +25,8 @@
 import com.google.gerrit.reviewdb.client.Project;
 import com.google.gwt.event.logical.shared.CloseEvent;
 import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FocusWidget;
 import com.google.gwt.user.client.ui.PopupPanel;
 
-
 class CherryPickAction {
   static void call(final Button b, final ChangeInfo info, final String revision,
       String project, final String commitMessage) {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DraftActions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DraftActions.java
index 8654a62..634190a2 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DraftActions.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DraftActions.java
@@ -16,7 +16,6 @@
 
 import com.google.gerrit.client.Gerrit;
 import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.SubmitFailureDialog;
 import com.google.gerrit.client.rpc.GerritCallback;
 import com.google.gerrit.common.PageLinks;
 import com.google.gerrit.reviewdb.client.Change;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java
index c93c4e3..d11cf7e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java
@@ -16,7 +16,6 @@
 
 import com.google.gerrit.client.Gerrit;
 import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.SubmitFailureDialog;
 import com.google.gerrit.client.rpc.GerritCallback;
 import com.google.gerrit.common.PageLinks;
 import com.google.gerrit.reviewdb.client.Change;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java
index 31e43fe..09d3476 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java
@@ -19,7 +19,6 @@
 import com.google.gerrit.client.changes.ChangeApi;
 import com.google.gerrit.client.changes.ChangeInfo;
 import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.changes.SubmitFailureDialog;
 import com.google.gerrit.client.changes.SubmitInfo;
 import com.google.gerrit.client.rpc.GerritCallback;
 import com.google.gerrit.common.PageLinks;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/SubmitFailureDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitFailureDialog.java
similarity index 81%
rename from gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/SubmitFailureDialog.java
rename to gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitFailureDialog.java
index bd97790..c9ac2cb 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/SubmitFailureDialog.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitFailureDialog.java
@@ -12,19 +12,20 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.google.gerrit.client.changes;
+package com.google.gerrit.client.change;
 
 import com.google.gerrit.client.ErrorDialog;
+import com.google.gerrit.client.changes.Util;
 import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
 import com.google.gwtjsonrpc.client.RemoteJsonException;
 
-public class SubmitFailureDialog extends ErrorDialog {
-  public static boolean isConflict(Throwable err) {
+class SubmitFailureDialog extends ErrorDialog {
+  static boolean isConflict(Throwable err) {
     return err instanceof RemoteJsonException
         && 409 == ((RemoteJsonException) err).getCode();
   }
 
-  public SubmitFailureDialog(String msg) {
+  SubmitFailureDialog(String msg) {
     super(new SafeHtmlBuilder().append(msg.trim()).wikify());
     setText(Util.C.submitFailed());
   }
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java
index c03d4c3..efeb2ec 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java
@@ -19,7 +19,6 @@
 import com.google.gerrit.client.account.AccountInfo;
 import com.google.gerrit.client.changes.CommentApi;
 import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.changes.PatchTable;
 import com.google.gerrit.client.rpc.GerritCallback;
 import com.google.gerrit.client.ui.CommentLinkProcessor;
 import com.google.gerrit.client.ui.CommentPanel;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/CommitMessageBlock.java
similarity index 91%
rename from gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java
rename to gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/CommitMessageBlock.java
index 391e2f7..f336382 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/CommitMessageBlock.java
@@ -12,9 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.google.gerrit.client.changes;
+package com.google.gerrit.client.patches;
 
 import com.google.gerrit.client.Gerrit;
+import com.google.gerrit.client.changes.StarredChanges;
+import com.google.gerrit.client.changes.Util;
 import com.google.gerrit.client.ui.ChangeLink;
 import com.google.gerrit.client.ui.CommentLinkProcessor;
 import com.google.gerrit.reviewdb.client.Change;
@@ -33,10 +35,8 @@
 import com.google.gwtexpui.safehtml.client.SafeHtml;
 import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
 
-public class CommitMessageBlock extends Composite {
-  interface Binder extends UiBinder<HTMLPanel, CommitMessageBlock> {
-  }
-
+class CommitMessageBlock extends Composite {
+  interface Binder extends UiBinder<HTMLPanel, CommitMessageBlock> {}
   private static final Binder uiBinder = GWT.create(Binder.class);
 
   private KeyCommandSet keysAction;
@@ -50,21 +50,21 @@
   @UiField
   PreElement commitBodyPre;
 
-  public CommitMessageBlock() {
+  CommitMessageBlock() {
     initWidget(uiBinder.createAndBindUi(this));
   }
 
-  public CommitMessageBlock(KeyCommandSet keysAction) {
+  CommitMessageBlock(KeyCommandSet keysAction) {
     this.keysAction = keysAction;
     initWidget(uiBinder.createAndBindUi(this));
   }
 
-  public void display(String commitMessage,
+  void display(String commitMessage,
       CommentLinkProcessor commentLinkProcessor) {
     display(null, null, null, commitMessage, commentLinkProcessor);
   }
 
-  public void display(final PatchSet.Id patchSetId, final String revision,
+  void display(final PatchSet.Id patchSetId, final String revision,
       Boolean starred, final String commitMessage,
       CommentLinkProcessor commentLinkProcessor) {
     starPanel.clear();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/CommitMessageBlock.ui.xml
similarity index 100%
rename from gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.ui.xml
rename to gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/CommitMessageBlock.ui.xml
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java
index 74b714f..2a04c38 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java
@@ -16,7 +16,6 @@
 
 import com.google.gerrit.client.Gerrit;
 import com.google.gerrit.client.WebLinkInfo;
-import com.google.gerrit.client.changes.PatchTable;
 import com.google.gerrit.client.changes.Util;
 import com.google.gerrit.client.ui.ChangeLink;
 import com.google.gerrit.client.ui.InlineHyperlink;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchBrowserPopup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchBrowserPopup.java
index 9af1aa3..e60ce76 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchBrowserPopup.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchBrowserPopup.java
@@ -15,7 +15,6 @@
 package com.google.gerrit.client.patches;
 
 import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.PatchTable;
 import com.google.gerrit.client.changes.Util;
 import com.google.gerrit.reviewdb.client.Patch;
 import com.google.gwt.event.logical.shared.ResizeEvent;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchTable.java
similarity index 94%
rename from gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java
rename to gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchTable.java
index 940b044..218a6c3 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchTable.java
@@ -12,10 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.google.gerrit.client.changes;
+package com.google.gerrit.client.patches;
 
 import com.google.gerrit.client.Dispatcher;
 import com.google.gerrit.client.Gerrit;
+import com.google.gerrit.client.changes.Util;
 import com.google.gerrit.client.ui.InlineHyperlink;
 import com.google.gerrit.client.ui.ListenableAccountDiffPreference;
 import com.google.gerrit.client.ui.NavigationTable;
@@ -51,8 +52,8 @@
 import java.util.List;
 import java.util.Map;
 
-public class PatchTable extends Composite {
-  public interface PatchValidator {
+class PatchTable extends Composite {
+  interface PatchValidator {
     /**
      * @param patch
      * @return true if patch is valid.
@@ -60,7 +61,7 @@
     boolean isValid(Patch patch);
   }
 
-  public final PatchValidator PREFERENCE_VALIDATOR =
+  final PatchValidator PREFERENCE_VALIDATOR =
       new PatchValidator() {
         @Override
         public boolean isValid(Patch patch) {
@@ -86,17 +87,17 @@
   private boolean active;
   private boolean registerKeys;
 
-  public PatchTable(ListenableAccountDiffPreference prefs) {
+  PatchTable(ListenableAccountDiffPreference prefs) {
     listenablePrefs = prefs;
     myBody = new FlowPanel();
     initWidget(myBody);
   }
 
-  public PatchTable() {
+  PatchTable() {
     this(new ListenableAccountDiffPreference());
   }
 
-  public int indexOf(Patch.Key patch) {
+  int indexOf(Patch.Key patch) {
     Integer i = patchMap().get(patch);
     return i != null ? i : -1;
   }
@@ -111,7 +112,7 @@
     return patchMap;
   }
 
-  public void display(PatchSet.Id base, PatchSetDetail detail) {
+  void display(PatchSet.Id base, PatchSetDetail detail) {
     this.base = base;
     this.detail = detail;
     this.patchList = detail.getPatches();
@@ -127,19 +128,19 @@
     }
   }
 
-  public PatchSet.Id getBase() {
+  PatchSet.Id getBase() {
     return base;
   }
 
-  public void setSavePointerId(final String id) {
+  void setSavePointerId(final String id) {
     savePointerId = id;
   }
 
-  public boolean isLoaded() {
+  boolean isLoaded() {
     return myTable != null;
   }
 
-  public void onTableLoaded(final Command cmd) {
+  void onTableLoaded(final Command cmd) {
     if (myTable != null) {
       cmd.execute();
     } else {
@@ -147,7 +148,7 @@
     }
   }
 
-  public void addClickHandler(final ClickHandler clickHandler) {
+  void addClickHandler(final ClickHandler clickHandler) {
     if (myTable != null) {
       myTable.addClickHandler(clickHandler);
     } else {
@@ -158,27 +159,27 @@
     }
   }
 
-  public void setRegisterKeys(final boolean on) {
+  void setRegisterKeys(final boolean on) {
     registerKeys = on;
     if (myTable != null) {
       myTable.setRegisterKeys(on);
     }
   }
 
-  public void movePointerTo(final Patch.Key k) {
+  void movePointerTo(final Patch.Key k) {
     if (myTable != null) {
       myTable.movePointerTo(k);
     }
   }
 
-  public void setActive(boolean active) {
+  void setActive(boolean active) {
     this.active = active;
     if (myTable != null) {
       myTable.setActive(active);
     }
   }
 
-  public void notifyDraftDelta(final Patch.Key k, final int delta) {
+  void notifyDraftDelta(final Patch.Key k, final int delta) {
     if (myTable != null) {
       myTable.notifyDraftDelta(k, delta);
     }
@@ -212,7 +213,7 @@
   /**
    * @return a link to the previous file in this patch set, or null.
    */
-  public InlineHyperlink getPreviousPatchLink(int index) {
+  InlineHyperlink getPreviousPatchLink(int index) {
     int previousPatchIndex = getPreviousPatch(index, PREFERENCE_VALIDATOR);
     if (previousPatchIndex < 0) {
       return null;
@@ -224,7 +225,7 @@
   /**
    * @return a link to the next file in this patch set, or null.
    */
-  public InlineHyperlink getNextPatchLink(int index) {
+  InlineHyperlink getNextPatchLink(int index) {
     int nextPatchIndex = getNextPatch(index, false, PREFERENCE_VALIDATOR);
     if (nextPatchIndex < 0) {
       return null;
@@ -239,7 +240,7 @@
    * @param before A string to display at the beginning of the href text
    * @param after A string to display at the end of the href text
    */
-  public PatchLink createLink(int index, SafeHtml before, SafeHtml after) {
+  PatchLink createLink(int index, SafeHtml before, SafeHtml after) {
     Patch patch = patchList.get(index);
     Patch.Key thisKey = patch.getKey();
     PatchLink link;
@@ -276,11 +277,11 @@
     return fileName;
   }
 
-  public static String getDisplayFileName(Patch patch) {
+  static String getDisplayFileName(Patch patch) {
     return getDisplayFileName(patch.getKey());
   }
 
-  public static String getDisplayFileName(Patch.Key patchKey) {
+  static String getDisplayFileName(Patch.Key patchKey) {
     if (Patch.COMMIT_MSG.equals(patchKey.get())) {
       return Util.C.commitMessage();
     }
@@ -290,13 +291,13 @@
   /**
    * Update the reviewed status for the given patch.
    */
-  public void updateReviewedStatus(Patch.Key patchKey, boolean reviewed) {
+  void updateReviewedStatus(Patch.Key patchKey, boolean reviewed) {
     if (myTable != null) {
       myTable.updateReviewedStatus(patchKey, reviewed);
     }
   }
 
-  public ListenableAccountDiffPreference getPreferences() {
+  ListenableAccountDiffPreference getPreferences() {
     return listenablePrefs;
   }
 
@@ -374,7 +375,7 @@
     }
 
     /** Activates / Deactivates the key navigation and the highlighting of the current row for this table */
-    public void setActive(boolean active) {
+    void setActive(boolean active) {
       if (active) {
         if(activeRow > 0 && getCurrentRow() != activeRow) {
           super.movePointerTo(activeRow);
@@ -832,7 +833,7 @@
    *        true
    * @return index of next valid patch, or -1 if no valid patches
    */
-  public int getNextPatch(int currentIndex, boolean loopAround,
+  int getNextPatch(int currentIndex, boolean loopAround,
       PatchValidator... validators) {
     return getNextPatchHelper(currentIndex, loopAround, detail.getPatches()
         .size(), validators);
@@ -866,7 +867,7 @@
   /**
    * @return the index to the previous patch
    */
-  public int getPreviousPatch(int currentIndex, PatchValidator... validators) {
+  int getPreviousPatch(int currentIndex, PatchValidator... validators) {
     for (int i = currentIndex - 1; i >= 0; i--) {
       Patch patch = detail.getPatches().get(i);
       if (patch != null && patchIsValid(patch, validators)) {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java
index 7665b73..ea36c18 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java
@@ -16,9 +16,8 @@
 
 import com.google.gerrit.client.Gerrit;
 import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.changes.PatchTable;
-import com.google.gerrit.client.changes.PatchTable.PatchValidator;
 import com.google.gerrit.client.changes.Util;
+import com.google.gerrit.client.patches.PatchTable.PatchValidator;
 import com.google.gerrit.client.rpc.RestApi;
 import com.google.gerrit.client.ui.ChangeLink;
 import com.google.gerrit.client.ui.InlineHyperlink;
@@ -35,10 +34,9 @@
 import com.google.gwtexpui.safehtml.client.SafeHtml;
 import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
 
-public class ReviewedPanels {
-
-  public final FlowPanel top;
-  public final FlowPanel bottom;
+class ReviewedPanels {
+  final FlowPanel top;
+  final FlowPanel bottom;
 
   private Patch.Key patchKey;
   private PatchTable fileList;
@@ -46,13 +44,13 @@
   private CheckBox checkBoxTop;
   private CheckBox checkBoxBottom;
 
-  public ReviewedPanels() {
+  ReviewedPanels() {
     this.top = new FlowPanel();
     this.bottom = new FlowPanel();
     this.bottom.setStyleName(Gerrit.RESOURCES.css().reviewedPanelBottom());
   }
 
-  public void populate(Patch.Key pk, PatchTable pt, int patchIndex) {
+  void populate(Patch.Key pk, PatchTable pt, int patchIndex) {
     patchKey = pk;
     fileList = pt;
     reviewedLink = createReviewedLink(patchIndex);
@@ -86,16 +84,16 @@
     return checkBox;
   }
 
-  public boolean getValue() {
+  boolean getValue() {
     return checkBoxTop.getValue();
   }
 
-  public void setValue(final boolean value) {
+  void setValue(final boolean value) {
     checkBoxTop.setValue(value);
     checkBoxBottom.setValue(value);
   }
 
-  public void setReviewedByCurrentUser(boolean reviewed) {
+  void setReviewedByCurrentUser(boolean reviewed) {
     if (fileList != null) {
       fileList.updateReviewedStatus(patchKey, reviewed);
     }
@@ -124,7 +122,7 @@
     }
   }
 
-  public void go() {
+  void go() {
     if (reviewedLink != null) {
       setReviewedByCurrentUser(true);
       reviewedLink.go();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java
index 57d8953..a5c1484 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java
@@ -19,8 +19,6 @@
 import com.google.gerrit.client.Gerrit;
 import com.google.gerrit.client.RpcStatus;
 import com.google.gerrit.client.WebLinkInfo;
-import com.google.gerrit.client.changes.CommitMessageBlock;
-import com.google.gerrit.client.changes.PatchTable;
 import com.google.gerrit.client.diff.DiffApi;
 import com.google.gerrit.client.diff.DiffInfo;
 import com.google.gerrit.client.projects.ConfigInfoCache;