From 0d74e7fa07e70a95df0ee91c62065f3ca64ac885 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 16 Feb 2009 13:27:40 -0800 Subject: [PATCH] Make Gerrit.getVersion public for other code to use This may be useful to embed into a URL, such as to ensure that the URL is loaded at least once per application version seen by a browser. Signed-off-by: Shawn O. Pearce --- .../java/com/google/gerrit/client/Gerrit.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/google/gerrit/client/Gerrit.java b/src/main/java/com/google/gerrit/client/Gerrit.java index 5e709d9539..8ebadcb02b 100644 --- a/src/main/java/com/google/gerrit/client/Gerrit.java +++ b/src/main/java/com/google/gerrit/client/Gerrit.java @@ -57,6 +57,7 @@ public class Gerrit implements EntryPoint { public static final GerritIcons ICONS = GWT.create(GerritIcons.class); public static final SystemInfoService SYSTEM_SVC; + private static String myVersion; private static Account myAccount; private static final ArrayList signedInListeners = new ArrayList(); @@ -232,18 +233,25 @@ public class Gerrit implements EntryPoint { private static void populateBottomMenu() { final RootPanel btmmenu = RootPanel.get("gerrit_btmmenu"); - final String vs; - if (GWT.isScript()) { - final GerritVersion v = GWT.create(GerritVersion.class); - vs = v.version(); - } else { - vs = "dev"; - } + final String vs = getVersion(); final HTML version = new HTML(M.poweredBy(vs)); version.setStyleName("gerrit-version"); btmmenu.add(version); } + /** @return version number of the Gerrit application software */ + public static String getVersion() { + if (myVersion == null) { + if (GWT.isScript()) { + final GerritVersion v = GWT.create(GerritVersion.class); + myVersion = v.version(); + } else { + myVersion = "dev"; + } + } + return myVersion; + } + private void onModuleLoad2() { if (Cookies.getCookie(ACCOUNT_COOKIE) != null || Common.getGerritConfig().getLoginType() == SystemConfig.LoginType.HTTP) {