Link to project default dashboard and project info from ChangeScreen

At the moment the project name that is displayed in the ChangeInfoBlock
on the ChangeScreen links to a project search, that queries for all
changes of that project that have the same state as the displayed
change.

There are two things that are inconvinient about this:
1. The query that is executed depends on the change state.
   E.g. after submitting a change it now delivers the closed changes
   of that project, but maybe the user rather wants to continue looking
   at the open changes of the project to submit the next change.

2. The project screens get more important since more data is made
   available there (e.g. the clone URL for the project, the project
   dashboards etc.) and users want to navigate to the project screens
   from a change. Actually many users might expect to reach the project
   screen by clicking on the project name.

Make the links for the project more convinient by having
1. the search icon in front of the project name that links to the
   default dashboard of the project
2. the project name link to the project info

This is consistent with the links in the project list.

Change-Id: I7df7eb09995031d13630b5d4cd873366a248c8d6
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/PageLinks.java b/gerrit-common/src/main/java/com/google/gerrit/common/PageLinks.java
index 6be3a1c..67eb834 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/PageLinks.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/PageLinks.java
@@ -57,6 +57,10 @@
     return "/c/" + ps.getParentKey() + "/" + ps.get();
   }
 
+  public static String toProject(final Project.NameKey p) {
+    return ADMIN_PROJECTS + p.get();
+  }
+
   public static String toProjectAcceess(final Project.NameKey p) {
     return "/admin/projects/" + p.get() + ",access";
   }
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
index b250446..11cbcb2 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
@@ -21,15 +21,13 @@
 import com.google.gerrit.client.projects.ProjectMap;
 import com.google.gerrit.client.rpc.ScreenLoadCallback;
 import com.google.gerrit.client.ui.InlineHyperlink;
+import com.google.gerrit.client.ui.ProjectSearchLink;
 import com.google.gerrit.client.ui.ProjectsTable;
 import com.google.gerrit.client.ui.Screen;
 import com.google.gerrit.common.PageLinks;
-import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.History;
 import com.google.gwt.user.client.ui.Anchor;
 import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
 
 public class ProjectListScreen extends Screen {
   private ProjectsTable projects;
@@ -83,7 +81,7 @@
       @Override
       protected void populate(final int row, final ProjectInfo k) {
         FlowPanel fp = new FlowPanel();
-        fp.add(createSearchLink(k));
+        fp.add(new ProjectSearchLink(k.name_key()));
         fp.add(new InlineHyperlink(k.name(), link(k)));
         table.setWidget(row, 1, fp);
         table.setText(row, 2, k.description());
@@ -95,17 +93,6 @@
 
         setRowItem(row, k);
       }
-
-      private Widget createSearchLink(final ProjectInfo projectInfo) {
-        Image image = new Image(Gerrit.RESOURCES.queryProjectLink());
-        InlineHyperlink h = new InlineHyperlink(" ",
-            PageLinks.toProjectDashboard(projectInfo.name_key(), "default"));
-        h.setTitle(Util.C.projectListQueryLink());
-        DOM.insertBefore(h.getElement(), image.getElement(),
-            DOM.getFirstChild(h.getElement()));
-
-        return h;
-      }
     };
     projects.setSavePointerId(PageLinks.ADMIN_PROJECTS);
 
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java
index 5e2eda4..2faf857 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java
@@ -21,7 +21,8 @@
 import com.google.gerrit.client.ui.AccountLink;
 import com.google.gerrit.client.ui.BranchLink;
 import com.google.gerrit.client.ui.CommentedActionDialog;
-import com.google.gerrit.client.ui.ProjectLink;
+import com.google.gerrit.client.ui.InlineHyperlink;
+import com.google.gerrit.client.ui.ProjectSearchLink;
 import com.google.gerrit.common.PageLinks;
 import com.google.gerrit.common.data.AccountInfoCache;
 import com.google.gerrit.common.data.ChangeDetail;
@@ -34,6 +35,7 @@
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Grid;
 import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
+import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Image;
 import com.google.gwt.user.client.ui.InlineLabel;
 import com.google.gwt.user.client.ui.TextBox;
@@ -101,7 +103,13 @@
     table.setWidget(R_CHANGE_ID, 1, changeIdLabel);
 
     table.setWidget(R_OWNER, 1, AccountLink.link(acc, chg.getOwner()));
-    table.setWidget(R_PROJECT, 1, new ProjectLink(chg.getProject(), chg.getStatus()));
+
+    final HorizontalPanel p = new HorizontalPanel();
+    p.add(new ProjectSearchLink(chg.getProject()));
+    p.add(new InlineHyperlink(chg.getProject().get(),
+        PageLinks.toProject(chg.getProject())));
+    table.setWidget(R_PROJECT, 1, p);
+
     table.setWidget(R_BRANCH, 1, new BranchLink(dst.getShortName(), chg
         .getProject(), chg.getStatus(), dst.get(), null));
     table.setWidget(R_TOPIC, 1, topic(chg));
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectSearchLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectSearchLink.java
new file mode 100644
index 0000000..bedf17b
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectSearchLink.java
@@ -0,0 +1,33 @@
+// Copyright (C) 2012 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.ui;
+
+import com.google.gerrit.client.Gerrit;
+import com.google.gerrit.client.admin.Util;
+import com.google.gerrit.common.PageLinks;
+import com.google.gerrit.reviewdb.client.Project;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Image;
+
+public class ProjectSearchLink extends InlineHyperlink {
+
+  public ProjectSearchLink(Project.NameKey projectName) {
+    super(" ", PageLinks.toProjectDashboard(projectName, "default"));
+    setTitle(Util.C.projectListQueryLink());
+    final Image image = new Image(Gerrit.RESOURCES.queryProjectLink());
+    DOM.insertBefore(getElement(), image.getElement(),
+        DOM.getFirstChild(getElement()));
+  }
+}