Allow plugins to refresh Gerrit's menu bar

Change-Id: Id908ebe23a07f2ae45e131a9b8a98c24f4a9cf74
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2014-04-15 11:26:23 +02:00
parent d3e10a9724
commit 049c35574d
5 changed files with 15 additions and 0 deletions

View File

@ -872,6 +872,10 @@ Gerrit.screen(pattern, callback);
=== Gerrit.refresh()
Redisplays the current web UI view, refreshing all information.
[[Gerrit_refreshMenuBar]]
=== Gerrit.refreshMenuBar()
Refreshes Gerrit's menu bar.
[[Gerrit_url]]
=== Gerrit.url()
Returns the URL of the Gerrit Code Review server. If invoked with

View File

@ -37,6 +37,7 @@ public class ActionContext extends JavaScriptObject {
Gerrit.ActionContext.prototype = {
go: Gerrit.go,
refresh: Gerrit.refresh,
refreshMenuBar: Gerrit.refreshMenuBar,
showError: Gerrit.showError,
br: function(){return doc.createElement('br')},

View File

@ -62,6 +62,7 @@ public class ApiGlue {
go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
refresh: @com.google.gerrit.client.api.ApiGlue::refresh(),
refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
on: function (e,f){(this.events[e] || (this.events[e]=[])).push(f)},
@ -189,6 +190,10 @@ public class ApiGlue {
Gerrit.display(History.getToken());
}
private static final void refreshMenuBar() {
Gerrit.refreshMenuBar();
}
private static final void showError(String message) {
new ErrorDialog(message).center();
}

View File

@ -52,6 +52,7 @@ final class Plugin extends JavaScriptObject {
getPluginName: function(){return this.name},
go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
refresh: @com.google.gerrit.client.api.ApiGlue::refresh(),
refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
on: function(e,f){G.on(e,f)},
onAction: function(t,n,c){G._onAction(this.name,t,n,c)},

View File

@ -50,6 +50,10 @@ public final class Plugin extends JavaScriptObject {
public final native void refresh()
/*-{ return this.refresh() }-*/;
/** Refresh Gerrit's menu bar. */
public final native void refreshMenuBar()
/*-{ return this.refreshMenuBar() }-*/;
/** Show message in Gerrit's ErrorDialog. */
public final native void showError(String message)
/*-{ return this.showError(message) }-*/;