Merge "SubmittedTogether: Only show tab if there is more than one change"
diff --git a/Documentation/cmd-create-project.txt b/Documentation/cmd-create-project.txt
index 31b4538..d1108b5 100644
--- a/Documentation/cmd-create-project.txt
+++ b/Documentation/cmd-create-project.txt
@@ -21,7 +21,7 @@
   [--empty-commit]
   [--max-object-size-limit <N>]
   [--plugin-config <PARAM> ...]
-  { <NAME> | --name <NAME> }
+  { <NAME> }
 --
 
 == DESCRIPTION
@@ -49,11 +49,6 @@
 	Required; name of the new project to create.  If name ends
 	with `.git` the suffix will be automatically removed.
 
---name::
--n::
-	Deprecated alias for the <NAME> argument. This option may
-	be removed in a future release.
-
 --branch::
 -b::
 	Name of the initial branch(es) in the newly created project.
diff --git a/Documentation/config-themes.txt b/Documentation/config-themes.txt
index 5c3a448..b165e37 100644
--- a/Documentation/config-themes.txt
+++ b/Documentation/config-themes.txt
@@ -133,9 +133,6 @@
 block in the header or footer will execute before Gerrit has defined
 the function and is ready to register the hook callback.
 
-The function `gerrit_addHistoryHook` is deprecated and may be
-removed in a future release.
-
 GERRIT
 ------
 Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index c0464e1..d752c85 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -3948,25 +3948,25 @@
 === CommitInfo
 The `CommitInfo` entity contains information about a commit.
 
-[options="header",cols="1,6"]
-|==========================
-|Field Name    |Description
-|`commit`      |The commit ID.
-|`parents`     |
+[options="header",cols="1,^1,5"]
+|===========================
+|Field Name    ||Description
+|`commit`      ||The commit ID.
+|`parents`     ||
 The parent commits of this commit as a list of
 link:#commit-info[CommitInfo] entities. In each parent
 only the `commit` and `subject` fields are populated.
-|`author`      |The author of the commit as a
+|`author`      ||The author of the commit as a
 link:#git-person-info[GitPersonInfo] entity.
-|`committer`   |The committer of the commit as a
+|`committer`   ||The committer of the commit as a
 link:#git-person-info[GitPersonInfo] entity.
-|`subject`     |
+|`subject`     ||
 The subject of the commit (header line of the commit message).
-|`message`     |The commit message.
+|`message`     ||The commit message.
 |`web_links`   |optional|
 Links to the commit in external sites as a list of
 link:#web-link-info[WebLinkInfo] entities.
-|==========================
+|===========================
 
 [[diff-content]]
 === DiffContent
diff --git a/gerrit-gwtexpui/BUCK b/gerrit-gwtexpui/BUCK
index 99f1c4c..189445a 100644
--- a/gerrit-gwtexpui/BUCK
+++ b/gerrit-gwtexpui/BUCK
@@ -7,6 +7,7 @@
   resources = [
     SRC + 'clippy/client/clippy.css',
     SRC + 'clippy/client/clippy.swf',
+    SRC + 'clippy/client/CopyableLabelText.properties',
   ],
   provided_deps = ['//lib/gwt:user'],
   deps = [
@@ -84,6 +85,7 @@
   name = 'UserAgent',
   srcs = glob([SRC + 'user/client/*.java']),
   gwt_xml = SRC + 'user/User.gwt.xml',
+  resources = [SRC + 'user/client/tooltip.css'],
   provided_deps = ['//lib/gwt:user'],
   visibility = ['PUBLIC'],
 )
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyCss.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyCss.java
index 68495e8..05a1861 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyCss.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/ClippyCss.java
@@ -18,5 +18,6 @@
 
 public interface ClippyCss extends CssResource {
   String label();
-  String control();
+  String copier();
+  String swf();
 }
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java
index e34814f..5da8b1e 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java
@@ -16,6 +16,7 @@
 
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Display;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
 import com.google.gwt.event.dom.client.ClickEvent;
@@ -24,9 +25,12 @@
 import com.google.gwt.event.dom.client.KeyPressHandler;
 import com.google.gwt.event.dom.client.KeyUpEvent;
 import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
 import com.google.gwt.http.client.URL;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.HasText;
@@ -35,6 +39,7 @@
 import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwtexpui.safehtml.client.SafeHtml;
 import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
+import com.google.gwtexpui.user.client.Tooltip;
 import com.google.gwtexpui.user.client.UserAgent;
 
 /**
@@ -71,6 +76,7 @@
   private int visibleLen;
   private Label textLabel;
   private TextBox textBox;
+  private Button copier;
   private Element swf;
 
   public CopyableLabel() {
@@ -111,7 +117,32 @@
       });
       content.add(textLabel);
     }
-    embedMovie();
+
+    if (UserAgent.hasJavaScriptClipboard()) {
+      copier = new Button("&#x1f4cb;"); // CLIPBOARD
+      copier.setStyleName(ClippyResources.I.css().copier());
+      Tooltip.addStyle(copier);
+      Tooltip.setLabel(copier, CopyableLabelText.I.tooltip());
+      copier.addClickHandler(new ClickHandler() {
+        @Override
+        public void onClick(ClickEvent event) {
+          copy();
+        }
+      });
+      copier.addMouseOutHandler(new MouseOutHandler() {
+        @Override
+        public void onMouseOut(MouseOutEvent event) {
+          Tooltip.setLabel(copier, CopyableLabelText.I.tooltip());
+        }
+      });
+
+      FlowPanel p = new FlowPanel();
+      p.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
+      p.add(copier);
+      content.add(p);
+    } else {
+      embedMovie();
+    }
   }
 
   /**
@@ -127,12 +158,13 @@
   }
 
   private void embedMovie() {
-    if (flashEnabled && UserAgent.hasFlash && text.length() > 0) {
+    if (copier == null && flashEnabled && !text.isEmpty()
+        && UserAgent.Flash.isInstalled()) {
       final String flashVars = "text=" + URL.encodeQueryString(getText());
       final SafeHtmlBuilder h = new SafeHtmlBuilder();
 
       h.openElement("div");
-      h.setStyleName(ClippyResources.I.css().control());
+      h.setStyleName(ClippyResources.I.css().swf());
 
       h.openElement("object");
       h.setWidth(SWF_WIDTH);
@@ -236,4 +268,35 @@
     }
     textLabel.setVisible(true);
   }
+
+  private void copy() {
+    TextBox t = new TextBox();
+    try {
+      t.setText(getText());
+      content.add(t);
+      t.selectAll();
+
+      boolean ok = execCommand("copy");
+      Tooltip.setLabel(copier, ok
+          ? CopyableLabelText.I.copied()
+          : CopyableLabelText.I.failed());
+      if (!ok) {
+        // Disable JavaScript clipboard and try flash movie in another instance.
+        UserAgent.disableJavaScriptClipboard();
+      }
+    } finally {
+      t.removeFromParent();
+    }
+  }
+
+  private static boolean execCommand(String command) {
+    try {
+      return nativeExec(command);
+    } catch (Exception e) {
+      return false;
+    }
+  }
+
+  private static native boolean nativeExec(String c)
+  /*-{ return !! $doc.execCommand(c) }-*/;
 }
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/DialogVisibleHandler.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabelText.java
similarity index 60%
rename from gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/DialogVisibleHandler.java
rename to gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabelText.java
index d242db6..4d1b837 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/DialogVisibleHandler.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabelText.java
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 The Android Open Source Project
+// Copyright (C) 2015 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.
@@ -12,10 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package com.google.gwtexpui.user.client;
+package com.google.gwtexpui.clippy.client;
 
-import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.Constants;
 
-public interface DialogVisibleHandler extends EventHandler {
-  public void onDialogVisible(DialogVisibleEvent event);
+interface CopyableLabelText extends Constants {
+  static final CopyableLabelText I = GWT.create(CopyableLabelText.class);
+
+  String tooltip();
+  String copied();
+  String failed();
 }
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabelText.properties b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabelText.properties
new file mode 100644
index 0000000..cf93bfa
--- /dev/null
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabelText.properties
@@ -0,0 +1,3 @@
+tooltip = Copy to clipboard
+copied = Copied
+failed = Failed !
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clippy.css b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clippy.css
index b962df3..b25e006 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clippy.css
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/clippy.css
@@ -16,10 +16,24 @@
 .label {
   vertical-align: top;
 }
-.control {
+.swf, .copier {
   margin-left: 5px;
-  display: inline-block !important;
   height: 14px;
   width: 14px;
+}
+.swf {
+  display: inline-block !important;
   overflow: hidden;
 }
+.copier {
+  display: inline-block;
+  font-size: 12px;
+  vertical-align: top;
+  padding: 0;
+  border: 0;
+  background-color: inherit;
+  cursor: pointer;
+}
+.copier:focus {
+  outline: none;
+}
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java
index 191ffd7..a85d704 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java
@@ -28,9 +28,9 @@
 import com.google.gwt.user.client.ui.Grid;
 import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwtexpui.safehtml.client.SafeHtml;
 import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -42,7 +42,7 @@
 import java.util.Map;
 
 
-public class KeyHelpPopup extends PluginSafePopupPanel implements
+public class KeyHelpPopup extends PopupPanel implements
     KeyPressHandler, KeyDownHandler {
   private final FocusPanel focus;
 
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/AutoCenterDialogBox.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/AutoCenterDialogBox.java
index 78ea8d6..54d8eca 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/AutoCenterDialogBox.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/AutoCenterDialogBox.java
@@ -18,9 +18,10 @@
 import com.google.gwt.event.logical.shared.ResizeHandler;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.DialogBox;
 
 /** A DialogBox that automatically re-centers itself if the window changes */
-public class AutoCenterDialogBox extends PluginSafeDialogBox {
+public class AutoCenterDialogBox extends DialogBox {
   private HandlerRegistration recenter;
 
   public AutoCenterDialogBox() {
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/DialogVisibleEvent.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/DialogVisibleEvent.java
deleted file mode 100644
index 74218b4..0000000
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/DialogVisibleEvent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (C) 2013 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.gwtexpui.user.client;
-
-import com.google.gwt.event.shared.GwtEvent;
-import com.google.gwt.user.client.ui.Widget;
-
-public class DialogVisibleEvent extends GwtEvent<DialogVisibleHandler> {
-  private static Type<DialogVisibleHandler> TYPE;
-
-  public static Type<DialogVisibleHandler> getType() {
-    if (TYPE == null) {
-      TYPE = new Type<>();
-    }
-    return TYPE;
-  }
-
-  private final Widget parent;
-  private final boolean visible;
-
-  DialogVisibleEvent(Widget w, boolean visible) {
-    this.parent = w;
-    this.visible = visible;
-  }
-
-  public boolean contains(Widget c) {
-    for (; c != null; c = c.getParent()) {
-      if (c == parent) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  public boolean isVisible() {
-    return visible;
-  }
-
-  @Override
-  public Type<DialogVisibleHandler> getAssociatedType() {
-    return getType();
-  }
-
-  @Override
-  protected void dispatch(DialogVisibleHandler handler) {
-    handler.onDialogVisible(this);
-  }
-}
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/PluginSafeDialogBox.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/PluginSafeDialogBox.java
deleted file mode 100644
index 80bfba1..0000000
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/PluginSafeDialogBox.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2009 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.gwtexpui.user.client;
-
-import com.google.gwt.user.client.ui.DialogBox;
-
-/**
- * A DialogBox that can appear over Flash movies and Java applets.
- * <p>
- * Some browsers have issues with placing a &lt;div&gt; (such as that used by
- * the DialogBox implementation) over top of native UI such as that used by the
- * Flash plugin. Often the native UI leaks over top of the &lt;div&gt;, which is
- * not the desired behavior for a dialog box.
- * <p>
- * This implementation hides the native resources by setting their display
- * property to 'none' when the dialog is shown, and restores them back to their
- * prior setting when the dialog is hidden.
- * */
-public class PluginSafeDialogBox extends DialogBox {
-  public PluginSafeDialogBox() {
-    this(false);
-  }
-
-  public PluginSafeDialogBox(final boolean autoHide) {
-    this(autoHide, true);
-  }
-
-  public PluginSafeDialogBox(final boolean autoHide, final boolean modal) {
-    super(autoHide, modal);
-  }
-
-  @Override
-  public void setVisible(final boolean show) {
-    UserAgent.fireDialogVisible(this, show);
-    super.setVisible(show);
-  }
-
-  @Override
-  public void show() {
-    UserAgent.fireDialogVisible(this, true);
-    super.show();
-  }
-
-  @Override
-  public void hide(final boolean autoClosed) {
-    UserAgent.fireDialogVisible(this, false);
-    super.hide(autoClosed);
-  }
-}
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/PluginSafePopupPanel.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/PluginSafePopupPanel.java
deleted file mode 100644
index 1ed8f99..0000000
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/PluginSafePopupPanel.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2009 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.gwtexpui.user.client;
-
-import com.google.gwt.user.client.ui.PopupPanel;
-
-/**
- * A PopupPanel that can appear over Flash movies and Java applets.
- * <p>
- * Some browsers have issues with placing a &lt;div&gt; (such as that used by
- * the PopupPanel implementation) over top of native UI such as that used by the
- * Flash plugin. Often the native UI leaks over top of the &lt;div&gt;, which is
- * not the desired behavior for a dialog box.
- * <p>
- * This implementation hides the native resources by setting their display
- * property to 'none' when the dialog is shown, and restores them back to their
- * prior setting when the dialog is hidden.
- * */
-public class PluginSafePopupPanel extends PopupPanel {
-  public PluginSafePopupPanel() {
-    this(false);
-  }
-
-  public PluginSafePopupPanel(final boolean autoHide) {
-    this(autoHide, true);
-  }
-
-  public PluginSafePopupPanel(final boolean autoHide, final boolean modal) {
-    super(autoHide, modal);
-  }
-
-  @Override
-  public void setVisible(final boolean show) {
-    UserAgent.fireDialogVisible(this, show);
-    super.setVisible(show);
-  }
-
-  @Override
-  public void show() {
-    UserAgent.fireDialogVisible(this, true);
-    super.show();
-  }
-
-  @Override
-  public void hide(final boolean autoClosed) {
-    UserAgent.fireDialogVisible(this, false);
-    super.hide(autoClosed);
-  }
-}
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/Tooltip.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/Tooltip.java
new file mode 100644
index 0000000..e3ab034
--- /dev/null
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/Tooltip.java
@@ -0,0 +1,80 @@
+// Copyright (C) 2015 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.gwtexpui.user.client;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.user.client.ui.UIObject;
+
+/** Displays custom tooltip message below an element. */
+public class Tooltip {
+  interface Resources extends ClientBundle {
+    static final Resources I = GWT.create(Resources.class);
+
+    @Source("tooltip.css")
+    Css css();
+  }
+
+  interface Css extends CssResource {
+    String tooltip();
+  }
+
+  static {
+    Resources.I.css().ensureInjected();
+  }
+
+  /**
+   * Add required supporting style to enable custom tooltip rendering.
+   *
+   * @param o widget whose element should display a tooltip on hover.
+   */
+  public static void addStyle(UIObject o) {
+    addStyle(o.getElement());
+  }
+
+  /**
+   * Add required supporting style to enable custom tooltip rendering.
+   *
+   * @param e element that should display a tooltip on hover.
+   */
+  public static void addStyle(Element e) {
+    e.addClassName(Resources.I.css().tooltip());
+  }
+
+  /**
+   * Set the text displayed on hover.
+   *
+   * @param o widget whose hover text is being set.
+   * @param text message to display on hover.
+   */
+  public static void setLabel(UIObject o, String text) {
+   setLabel(o.getElement(), text);
+  }
+
+  /**
+   * Set the text displayed on hover.
+   *
+   * @param e element whose hover text is being set.
+   * @param text message to display on hover.
+   */
+  public static void setLabel(Element e, String text) {
+    e.setAttribute("aria-label", text != null ? text : "");
+  }
+
+  private Tooltip() {
+  }
+}
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/UserAgent.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/UserAgent.java
index c654902..2ffa7c5d 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/UserAgent.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/UserAgent.java
@@ -15,11 +15,7 @@
 package com.google.gwtexpui.user.client;
 
 import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.event.shared.SimpleEventBus;
 import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Widget;
 
 /**
  * User agent feature tests we don't create permutations for.
@@ -31,36 +27,101 @@
  * trivial compared to the time developers lose building their application.
  */
 public class UserAgent {
-  /** Does the browser have ShockwaveFlash plugin enabled? */
-  public static final boolean hasFlash = hasFlash();
-  private static final EventBus bus = new SimpleEventBus();
+  private static boolean jsClip = guessJavaScriptClipboard();
 
-  public static HandlerRegistration addDialogVisibleHandler(
-      DialogVisibleHandler handler) {
-    return bus.addHandler(DialogVisibleEvent.getType(), handler);
+  public static boolean hasJavaScriptClipboard() {
+    return jsClip;
   }
 
-  static void fireDialogVisible(Widget w, boolean visible) {
-    bus.fireEvent(new DialogVisibleEvent(w, visible));
+  public static void disableJavaScriptClipboard() {
+    jsClip = false;
   }
 
-  private static native boolean hasFlash()
-  /*-{
-    if (navigator.plugins && navigator.plugins.length) {
-      if (navigator.plugins['Shockwave Flash'])     return true;
-      if (navigator.plugins['Shockwave Flash 2.0']) return true;
+  private static native boolean nativeHasCopy()
+  /*-{ return $doc['queryCommandSupported'] && $doc.queryCommandSupported('copy') }-*/;
 
-    } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
-      var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];
-      if (mimeType && mimeType.enabledPlugin) return true;
-
-    } else {
-      try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7'); return true; } catch (e) {}
-      try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); return true; } catch (e) {}
-      try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash');   return true; } catch (e) {}
+  private static boolean guessJavaScriptClipboard() {
+    String ua = Window.Navigator.getUserAgent();
+    int chrome = major(ua, "Chrome/");
+    if (chrome > 0) {
+      return 42 <= chrome;
     }
+
+    int ff = major(ua, "Firefox/");
+    if (ff > 0) {
+      return 41 <= ff;
+    }
+
+    int opera = major(ua, "OPR/");
+    if (opera > 0) {
+      return 29 <= opera;
+    }
+
+    int msie = major(ua, "MSIE ");
+    if (msie > 0) {
+      return 9 <= msie;
+    }
+
+    if (nativeHasCopy()) {
+      // Firefox 39.0 lies and says it supports copy, then fails.
+      // So we try this after the browser specific test above.
+      return true;
+    }
+
+    // Safari is not planning to support document.execCommand('copy').
+    // Assume the browser does not have the feature.
     return false;
-  }-*/;
+  }
+
+  private static int major(String ua, String product) {
+    int entry = ua.indexOf(product);
+    if (entry >= 0) {
+      String s = ua.substring(entry + product.length());
+      String p = s.split("[ /;,.)]", 2)[0];
+      try {
+        return Integer.parseInt(p);
+      } catch (NumberFormatException nan) {
+      }
+    }
+    return -1;
+  }
+
+  public static class Flash {
+    private static boolean checked;
+    private static boolean installed;
+
+    /**
+     * Does the browser have ShockwaveFlash plugin installed?
+     * <p>
+     * This method may still return true if the user has disabled Flash or set
+     * the plugin to "click to run".
+     */
+    public static boolean isInstalled() {
+      if (!checked) {
+        installed = hasFlash();
+        checked = true;
+      }
+      return installed;
+    }
+
+    private static native boolean hasFlash()
+    /*-{
+      if (navigator.plugins && navigator.plugins.length) {
+        if (navigator.plugins['Shockwave Flash'])     return true;
+        if (navigator.plugins['Shockwave Flash 2.0']) return true;
+
+      } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
+        var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];
+        if (mimeType && mimeType.enabledPlugin) return true;
+
+      } else {
+        try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7'); return true; } catch (e) {}
+        try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); return true; } catch (e) {}
+        try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash');   return true; } catch (e) {}
+      }
+      return false;
+    }-*/;
+  }
 
   /**
    * Test for and disallow running this application in an &lt;iframe&gt;.
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/tooltip.css b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/tooltip.css
new file mode 100644
index 0000000..1aeb015
--- /dev/null
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/user/client/tooltip.css
@@ -0,0 +1,54 @@
+/* Copyright (C) 2015 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.
+ */
+
+.tooltip {
+  position: relative;
+}
+
+.tooltip:hover:before {
+  position: absolute;
+  z-index: 51;
+  border: solid;
+  border-color: #333 transparent;
+  border-width: 0 4px 4px 4px;
+  pointer-events: none;
+  content: "";
+
+  top: auto;
+  right: 50%;
+  bottom: -5px;
+  margin-right: -5px;
+}
+
+.tooltip:hover:after {
+  position: absolute;
+  z-index: 50;
+  font: normal normal 11px/1.5 Helvetica, arial, sans-serif;
+  text-align: center;
+  white-space: pre;
+  pointer-events: none;
+  background: rgba(0,0,0,.7);
+  color: #fff;
+  border-radius: 3px;
+  padding: 5px;
+  content: attr(aria-label);
+
+  top: 100%;
+  right: 50%;
+  margin-top: 5px;
+  -webkit-transform: translateX(50%);
+  -ms-transform: translateX(50%);
+  transform: translateX(50%)
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java
index 700c701..a5c5659 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java
@@ -26,13 +26,13 @@
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 import com.google.gwtjsonrpc.client.RemoteJsonException;
 
 /** A dialog box showing an error message, when bad things happen. */
-public class ErrorDialog extends PluginSafePopupPanel {
+public class ErrorDialog extends PopupPanel {
   private final Label text;
   private final FlowPanel body;
   private final Button closey;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java
index 83c32cd..a372f03 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java
@@ -26,10 +26,9 @@
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 /** A dialog box telling the user they are not signed in. */
-public class NotSignedInDialog extends PluginSafePopupPanel implements CloseHandler<PopupPanel> {
+public class NotSignedInDialog extends PopupPanel implements CloseHandler<PopupPanel> {
   private Button signin;
   private boolean buttonClicked;
 
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java
index 1220a37..29d1b63 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java
@@ -22,10 +22,10 @@
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
-public class UserPopupPanel extends PluginSafePopupPanel {
+public class UserPopupPanel extends PopupPanel {
   interface Binder extends UiBinder<Widget, UserPopupPanel> {}
   private static final Binder binder = GWT.create(Binder.class);
 
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java
index 6867bab..a4cfd21 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java
@@ -37,6 +37,7 @@
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Grid;
 import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwtexpui.user.client.UserAgent;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -136,16 +137,19 @@
     legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
     muteCommonPathPrefixes = new CheckBox(Util.C.muteCommonPathPrefixes());
 
-    final Grid formGrid = new Grid(11, 2);
+    boolean flashClippy = !UserAgent.hasJavaScriptClipboard() && UserAgent.Flash.isInstalled();
+    final Grid formGrid = new Grid(10 + (flashClippy ? 1 : 0), 2);
 
     int row = 0;
     formGrid.setText(row, labelIdx, "");
     formGrid.setWidget(row, fieldIdx, showSiteHeader);
     row++;
 
-    formGrid.setText(row, labelIdx, "");
-    formGrid.setWidget(row, fieldIdx, useFlashClipboard);
-    row++;
+    if (flashClippy) {
+      formGrid.setText(row, labelIdx, "");
+      formGrid.setWidget(row, fieldIdx, useFlashClipboard);
+      row++;
+    }
 
     formGrid.setText(row, labelIdx, "");
     formGrid.setWidget(row, fieldIdx, copySelfOnEmails);
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java
index e4a5446..05cc173 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java
@@ -30,7 +30,6 @@
     ActionContext.init();
     HtmlTemplate.init();
     Plugin.init();
-    addHistoryHook();
   }
 
   private static native void init0() /*-{
@@ -203,14 +202,6 @@
     };
   }-*/;
 
-  /** Install deprecated {@code gerrit_addHistoryHook()} function. */
-  private static native void addHistoryHook() /*-{
-    $wnd.gerrit_addHistoryHook = function(h) {
-      var p = @com.google.gwt.user.client.Window.Location::getPath()();
-      $wnd.Gerrit.on('history', function(t) { h(p + "#" + t) })
-     };
-  }-*/;
-
   private static void install(JavaScriptObject cb, Plugin p) throws Exception {
     try {
       pluginName = p.name();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java
index 95d010c..5f28e14 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java
@@ -22,7 +22,6 @@
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 class PopupHelper {
   static PopupHelper popup(ActionContext ctx, Element panel) {
@@ -34,7 +33,7 @@
 
   private final ActionButton activatingButton;
   private final FlowPanel panel;
-  private PluginSafePopupPanel popup;
+  private PopupPanel popup;
 
   PopupHelper(ActionButton button, Element child) {
     activatingButton = button;
@@ -44,7 +43,7 @@
   }
 
   void show() {
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true);
+    final PopupPanel p = new PopupPanel(true);
     p.setStyleName(Resources.I.style().popup());
     p.addAutoHidePartner(activatingButton.getElement());
     p.addCloseHandler(new CloseHandler<PopupPanel>() {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java
index c560f6d..28943ab 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java
@@ -30,7 +30,6 @@
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
 import com.google.gwtexpui.globalkey.client.NpTextArea;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 abstract class ActionMessageBox extends Composite {
   interface Binder extends UiBinder<HTMLPanel, ActionMessageBox> {}
@@ -41,7 +40,7 @@
   }
 
   private final Button activatingButton;
-  private PluginSafePopupPanel popup;
+  private PopupPanel popup;
 
   @UiField Style style;
   @UiField NpTextArea message;
@@ -62,7 +61,7 @@
       return;
     }
 
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true);
+    final PopupPanel p = new PopupPanel(true);
     p.setStyleName(style.popup());
     p.addAutoHidePartner(activatingButton.getElement());
     p.addCloseHandler(new CloseHandler<PopupPanel>() {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java
index 3a3ffe2..b2cac89 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java
@@ -21,7 +21,6 @@
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 class AddFileAction {
   private final Change.Id changeId;
@@ -54,7 +53,7 @@
     }
     addBox.clearPath();
 
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true);
+    final PopupPanel p = new PopupPanel(true);
     p.setStyleName(style.replyBox());
     p.addAutoHidePartner(addButton.getElement());
     p.addCloseHandler(new CloseHandler<PopupPanel>() {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java
index ce17013..c00644c 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java
@@ -21,7 +21,6 @@
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 class DeleteFileAction {
   private final Change.Id changeId;
@@ -51,7 +50,7 @@
     }
     deleteBox.clearPath();
 
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true);
+    final PopupPanel p = new PopupPanel(true);
     p.setStyleName(style.replyBox());
     p.addAutoHidePartner(deleteButton.getElement());
     p.addCloseHandler(new CloseHandler<PopupPanel>() {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java
index dbc0620..7f4fb59 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java
@@ -228,9 +228,11 @@
           new TabChangeListCallback(Tab.SAME_TOPIC, info.project(), revision));
     } else {
       // TODO(sbeller): show only on latest revision
-      ChangeApi.change(info.legacyId().get()).view("submitted_together")
-          .get(new TabChangeListCallback(Tab.SUBMITTED_TOGETHER,
-              info.project(), revision));
+      if (info.status().isOpen()) {
+        ChangeApi.change(info.legacyId().get()).view("submitted_together")
+            .get(new TabChangeListCallback(Tab.SUBMITTED_TOGETHER,
+                info.project(), revision));
+      }
     }
   }
 
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java
index d4b6c42..ded427a 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java
@@ -21,7 +21,6 @@
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 class RenameFileAction {
   private final Change.Id changeId;
@@ -51,7 +50,7 @@
     }
     renameBox.clearPath();
 
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true);
+    final PopupPanel p = new PopupPanel(true);
     p.setStyleName(style.replyBox());
     p.addAutoHidePartner(renameButton.getElement());
     p.addCloseHandler(new CloseHandler<PopupPanel>() {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java
index cccab34..303bb47 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java
@@ -28,7 +28,6 @@
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 class ReplyAction {
   private final PatchSet.Id psId;
@@ -105,7 +104,7 @@
       replyBox.replyTo(msg);
     }
 
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true, false);
+    final PopupPanel p = new PopupPanel(true, false);
     p.setStyleName(style.replyBox());
     p.addAutoHidePartner(replyButton.getElement());
     p.addAutoHidePartner(quickApproveButton.getElement());
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java
index 1bf6f6c..a3b16f9 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java
@@ -23,7 +23,6 @@
 import com.google.gwt.user.client.ui.UIObject;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.PluginSafePopupPanel;
 
 abstract class RightSidePopdownAction {
   private final ChangeScreen.Style style;
@@ -49,7 +48,7 @@
       return;
     }
 
-    final PluginSafePopupPanel p = new PluginSafePopupPanel(true) {
+    final PopupPanel p = new PopupPanel(true) {
       @Override
       public void setPopupPosition(int left, int top) {
         top -= Document.get().getBodyOffsetTop();
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 e60ce76..2962fb1 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
@@ -22,14 +22,14 @@
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.DialogBox;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
 import com.google.gwt.user.client.ui.ScrollPanel;
 import com.google.gwtexpui.globalkey.client.GlobalKey;
 import com.google.gwtexpui.globalkey.client.HidePopupPanelCommand;
-import com.google.gwtexpui.user.client.PluginSafeDialogBox;
 
-class PatchBrowserPopup extends PluginSafeDialogBox implements
+class PatchBrowserPopup extends DialogBox implements
     PositionCallback, ResizeHandler {
   private final Patch.Key callerKey;
   private final PatchTable fileList;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java
index dc27790..86c31f2 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java
@@ -25,6 +25,7 @@
 import com.google.gwt.event.dom.client.KeyUpHandler;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Label;
@@ -33,12 +34,11 @@
 import com.google.gwtexpui.globalkey.client.GlobalKey;
 import com.google.gwtexpui.globalkey.client.HidePopupPanelCommand;
 import com.google.gwtexpui.globalkey.client.NpTextBox;
-import com.google.gwtexpui.user.client.PluginSafeDialogBox;
 
 /** A popup containing all projects. */
 public class ProjectListPopup {
   private HighlightingProjectsTable projectsTab;
-  private PluginSafeDialogBox popup;
+  private DialogBox popup;
   private NpTextBox filterTxt;
   private HorizontalPanel filterPanel;
   private String match;
@@ -155,7 +155,7 @@
       }
     });
 
-    popup = new PluginSafeDialogBox();
+    popup = new DialogBox();
     popup.setModal(false);
     popup.setText(popupText);
   }
diff --git a/gerrit-plugin-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs b/gerrit-plugin-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
index 8667cfd..5a0ad22 100644
--- a/gerrit-plugin-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
+++ b/gerrit-plugin-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
@@ -1,3 +1,2 @@
-#Tue Sep 02 16:59:24 PDT 2008
 eclipse.preferences.version=1
 line.separator=\n
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/gerrit-plugin-gwt-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index 56e5873..3c3508c 100644
--- a/gerrit-plugin-gwt-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -59,7 +59,12 @@
       <include>lib/gerrit/BUCK</include>
       <include>lib/gwt/BUCK</include>
       <excludes>
+        <exclude>**/client/</exclude>
+        <exclude>**/public/</exclude>
+        <exclude>**/*.css</exclude>
+        <exclude>**/*.png</exclude>
         <exclude>**/*.java</exclude>
+        <exclude>**/*.gwt.xml</exclude>
       </excludes>
     </fileSet>
 
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
index 8667cfd..5a0ad22 100644
--- a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
@@ -1,3 +1,2 @@
-#Tue Sep 02 16:59:24 PDT 2008
 eclipse.preferences.version=1
 line.separator=\n
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/BUCK b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/BUCK
index b19312c..b224bf6 100644
--- a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/BUCK
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/BUCK
@@ -10,7 +10,6 @@
     'Gerrit-ApiType: plugin',
     'Gerrit-ApiVersion: ${gerritApiVersion}',
     'Gerrit-Module: ${package}.Module',
-    'Gerrit-SshModule: ${package}.SshModule',
     'Gerrit-HttpModule: ${package}.HttpModule',
   ],
 )
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/lib/ow2/BUCK b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/lib/ow2/BUCK
new file mode 100644
index 0000000..db6c76c
--- /dev/null
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/lib/ow2/BUCK
@@ -0,0 +1,32 @@
+include_defs('//bucklets/maven_jar.bucklet')
+
+VERSION = '5.0.3'
+
+maven_jar(
+  name = 'ow2-asm',
+  id = 'org.ow2.asm:asm:' + VERSION,
+  sha1 = 'dcc2193db20e19e1feca8b1240dbbc4e190824fa',
+  license = 'ow2',
+)
+
+maven_jar(
+  name = 'ow2-asm-analysis',
+  id = 'org.ow2.asm:asm-analysis:' + VERSION,
+  sha1 = 'c7126aded0e8e13fed5f913559a0dd7b770a10f3',
+  license = 'ow2',
+)
+
+maven_jar(
+  name = 'ow2-asm-tree',
+  id = 'org.ow2.asm:asm-tree:' + VERSION,
+  sha1 = '287749b48ba7162fb67c93a026d690b29f410bed',
+  license = 'ow2',
+)
+
+maven_jar(
+  name = 'ow2-asm-util',
+  id = 'org.ow2.asm:asm-util:' + VERSION,
+  sha1 = '1512e5571325854b05fb1efce1db75fcced54389',
+  license = 'ow2',
+)
+
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/resources/Documentation/build.md b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/resources/Documentation/build.md
index 4c56ed6..e225bab 100644
--- a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/resources/Documentation/build.md
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/resources/Documentation/build.md
@@ -30,8 +30,12 @@
   cd @PLUGIN@ && ln -s bucklets/buckversion .buckversion
 ```
 
-To build the plugin, issue the following command:
+Add link to the .watchmanconfig file:
+```
+  cd @PLUGIN@ && ln -s bucklets/watchmanconfig .watchmanconfig
+```
 
+To build the plugin, issue the following command:
 
 ```
   buck build plugin
diff --git a/gerrit-plugin-js-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs b/gerrit-plugin-js-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
index 8667cfd..5a0ad22 100644
--- a/gerrit-plugin-js-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
+++ b/gerrit-plugin-js-archetype/src/main/resources/archetype-resources/.settings/org.eclipse.core.runtime.prefs
@@ -1,3 +1,2 @@
-#Tue Sep 02 16:59:24 PDT 2008
 eclipse.preferences.version=1
 line.separator=\n
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java
index 6c4ec5e..d231767 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/GetCapabilities.java
@@ -59,10 +59,6 @@
 import java.util.Set;
 
 class GetCapabilities implements RestReadView<AccountResource> {
-  @Deprecated
-  @Option(name = "--format", usage = "(deprecated) output format")
-  private OutputFormat format;
-
   @Option(name = "-q", metaVar = "CAP", usage = "Capability to inspect")
   void addQuery(String name) {
     if (query == null) {
@@ -142,22 +138,9 @@
       }
     }
 
-    if (format == OutputFormat.TEXT) {
-      StringBuilder sb = new StringBuilder();
-      for (Map.Entry<String, Object> e : have.entrySet()) {
-        sb.append(e.getKey());
-        if (!(e.getValue() instanceof Boolean)) {
-          sb.append(": ");
-          sb.append(e.getValue().toString());
-        }
-        sb.append('\n');
-      }
-      return BinaryResult.create(sb.toString());
-    } else {
-      return OutputFormat.JSON.newGson().toJsonTree(
-        have,
-        new TypeToken<Map<String, Object>>() {}.getType());
-    }
+    return OutputFormat.JSON.newGson().toJsonTree(
+      have,
+      new TypeToken<Map<String, Object>>() {}.getType());
   }
 
   private boolean want(String name) {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/SuggestAccounts.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/SuggestAccounts.java
index d181c35..837e1ed 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/SuggestAccounts.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/SuggestAccounts.java
@@ -45,6 +45,7 @@
 
   private final AccountControl accountControl;
   private final AccountLoader accountLoader;
+  private final AccountCache accountCache;
   private final ReviewDb db;
   private final boolean suggest;
   private final int suggestFrom;
@@ -71,10 +72,12 @@
   @Inject
   SuggestAccounts(AccountControl.Factory accountControlFactory,
       AccountLoader.Factory accountLoaderFactory,
+      AccountCache accountCache,
       ReviewDb db,
       @GerritServerConfig Config cfg) {
     accountControl = accountControlFactory.get();
     accountLoader = accountLoaderFactory.create(true);
+    this.accountCache = accountCache;
     this.db = db;
     this.suggestFrom = cfg.getInt("suggest", null, "from", 0);
 
@@ -111,12 +114,12 @@
     Map<Account.Id, String> queryEmail = new HashMap<>();
 
     for (Account p : db.accounts().suggestByFullName(a, b, limit)) {
-      addSuggestion(matches, p.getId());
+      addSuggestion(matches, p);
     }
     if (matches.size() < limit) {
       for (Account p : db.accounts()
           .suggestByPreferredEmail(a, b, limit - matches.size())) {
-        addSuggestion(matches, p.getId());
+        addSuggestion(matches, p);
       }
     }
     if (matches.size() < limit) {
@@ -149,11 +152,20 @@
     return m;
   }
 
-  private boolean addSuggestion(Map<Account.Id, AccountInfo> map, Account.Id id) {
+  private boolean addSuggestion(Map<Account.Id, AccountInfo> map, Account a) {
+    if (!a.isActive()) {
+      return false;
+    }
+    Account.Id id = a.getId();
     if (!map.containsKey(id) && accountControl.canSee(id)) {
       map.put(id, accountLoader.get(id));
       return true;
     }
     return false;
   }
+
+  private boolean addSuggestion(Map<Account.Id, AccountInfo> map, Account.Id id) {
+    Account a = accountCache.get(id).getAccount();
+    return addSuggestion(map, a);
+  }
 }
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProjectCommand.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProjectCommand.java
index 7dc558e..3ad5156 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProjectCommand.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProjectCommand.java
@@ -46,15 +46,6 @@
 @RequiresCapability(GlobalCapability.CREATE_PROJECT)
 @CommandMetaData(name = "create-project", description = "Create a new project and associated Git repository")
 final class CreateProjectCommand extends SshCommand {
-  @Option(name = "--name", aliases = {"-n"}, metaVar = "NAME", usage = "name of project to be created (deprecated option)")
-  void setProjectNameFromOption(String name) {
-    if (projectName != null) {
-      throw new IllegalArgumentException("NAME already supplied");
-    } else {
-      projectName = name;
-    }
-  }
-
   @Option(name = "--suggest-parents", aliases = {"-S"}, usage = "suggest parent candidates, "
       + "if this option is used all other options and arguments are ignored")
   private boolean suggestParent;
@@ -129,16 +120,8 @@
       usage = "plugin configuration parameter with format '<plugin-name>.<parameter-name>=<value>'")
   private List<String> pluginConfigValues;
 
-  private String projectName;
-
   @Argument(index = 0, metaVar = "NAME", usage = "name of project to be created")
-  void setProjectNameFromArgument(String name) {
-    if (projectName != null) {
-      throw new IllegalArgumentException("--name already supplied");
-    } else {
-      projectName = name;
-    }
-  }
+  private String projectName;
 
   @Inject
   private GerritApi gApi;
diff --git a/plugins/download-commands b/plugins/download-commands
index 334f725..99e61fb 160000
--- a/plugins/download-commands
+++ b/plugins/download-commands
@@ -1 +1 @@
-Subproject commit 334f7253855551bea40f0f27b68e3d7aa71fe4af
+Subproject commit 99e61fb06a4505a9558c23a56213cb32ceaa9cca