In change screen extension get change ID from provided change info
Instead of the change ID the Gerrit client now provides the change
info object to extension panels.
Change-Id: I0b3f4ee50b37e2c93660751e1327671f2d16d156
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/cookbook/HelloForm.gwt.xml b/src/main/java/com/googlesource/gerrit/plugins/cookbook/HelloForm.gwt.xml
index d056c5d..954f97b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/cookbook/HelloForm.gwt.xml
+++ b/src/main/java/com/googlesource/gerrit/plugins/cookbook/HelloForm.gwt.xml
@@ -22,8 +22,6 @@
<inherits name="com.google.gerrit.Plugin"/>
<inherits name="com.google.gwt.http.HTTP"/>
<inherits name="com.google.gwt.json.JSON"/>
- <inherits name='com.google.gwtexpui.clippy.Clippy'/>
- <inherits name='com.google.gwtexpui.globalkey.GlobalKey'/>
<!-- Using GWT built-in themes adds a number of static -->
<!-- resources to the plugin. No theme inherits lines were -->
<!-- added in order to make this plugin as simple as possible -->
diff --git a/src/main/java/com/googlesource/gerrit/plugins/cookbook/client/CookBookChangeScreenExtension.java b/src/main/java/com/googlesource/gerrit/plugins/cookbook/client/CookBookChangeScreenExtension.java
index e45c50d..faf4c0e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/cookbook/client/CookBookChangeScreenExtension.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/cookbook/client/CookBookChangeScreenExtension.java
@@ -15,6 +15,7 @@
package com.googlesource.gerrit.plugins.cookbook.client;
import com.google.gerrit.client.GerritUiExtensionPoint;
+import com.google.gerrit.client.info.ChangeInfo;
import com.google.gerrit.plugin.client.extension.Panel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.VerticalPanel;
@@ -34,15 +35,16 @@
}
CookBookChangeScreenExtension(Panel panel) {
+ ChangeInfo change =
+ panel.getObject(GerritUiExtensionPoint.Key.CHANGE_INFO).cast();
+
Grid g = new Grid(1, 2);
g.addStyleName("infoBlock");
CellFormatter fmt = g.getCellFormatter();
g.setText(0, 0, "Numeric Change ID");
fmt.addStyleName(0, 0, "header");
- g.setWidget(0, 1,
- new CopyableLabel(Integer.toString(panel.getInt(
- GerritUiExtensionPoint.Key.CHANGE_ID, -1))));
+ g.setWidget(0, 1, new CopyableLabel(Integer.toString(change._number())));
add(g);
fmt.addStyleName(0, 0, "topmost");