This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 374ae3d398 Show Apache Hop version in Hop GUI and Hop Web window 
titles (#7226)
374ae3d398 is described below

commit 374ae3d3987b611c9e7c93a39b7027ceab66eee2
Author: Lance <[email protected]>
AuthorDate: Mon Jun 15 19:36:53 2026 +0800

    Show Apache Hop version in Hop GUI and Hop Web window titles (#7226)
    
    Signed-off-by: lance <[email protected]>
---
 .../main/java/org/apache/hop/ui/hopgui/HopWeb.java | 25 ++++++++++++++++++++--
 .../main/java/org/apache/hop/ui/hopgui/HopGui.java | 20 ++++++++++++++++-
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java 
b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java
index 904c635e14..f266535d01 100644
--- a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java
+++ b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java
@@ -35,6 +35,7 @@ import org.apache.batik.transcoder.image.PNGTranscoder;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hop.core.Const;
+import org.apache.hop.core.HopVersionProvider;
 import org.apache.hop.core.exception.HopRuntimeException;
 import org.apache.hop.core.gui.plugin.GuiRegistry;
 import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarItem;
@@ -56,6 +57,24 @@ public class HopWeb implements ApplicationConfiguration {
 
   public static final String CONST_LIGHT = "light";
 
+  private static final String WEB_PAGE_TITLE = "Apache Hop Web";
+
+  /**
+   * Returns the browser page title for Hop Web, including the Apache Hop 
version when it is
+   * available from the runtime manifest ({@link HopVersionProvider}). If no 
implementation version
+   * is present, only {@link #WEB_PAGE_TITLE} is returned.
+   *
+   * @return page title such as {@code Apache Hop Web - 2.19.0-SNAPSHOT}, or 
{@code Apache Hop Web}
+   *     when the version is unknown
+   */
+  private static String getWebPageTitle() {
+    String version = new HopVersionProvider().getVersion()[0];
+    if (StringUtils.isNotEmpty(version)) {
+      return WEB_PAGE_TITLE + " - " + version;
+    }
+    return WEB_PAGE_TITLE;
+  }
+
   @Override
   public void configure(Application application) {
 
@@ -149,14 +168,16 @@ public class HopWeb implements ApplicationConfiguration {
     application.addStyleSheet("dark", 
"org/apache/hop/ui/hopgui/dark-mode.css");
     application.addStyleSheet(CONST_LIGHT, 
"org/apache/hop/ui/hopgui/light-mode.css");
 
+    String webPageTitle = getWebPageTitle();
+
     Map<String, String> propertiesLight = new HashMap<>();
-    propertiesLight.put(WebClient.PAGE_TITLE, "Apache Hop Web");
+    propertiesLight.put(WebClient.PAGE_TITLE, webPageTitle);
     propertiesLight.put(WebClient.FAVICON, "ui/images/logo_icon.png");
     propertiesLight.put(WebClient.THEME_ID, CONST_LIGHT);
     propertiesLight.put(WebClient.HEAD_HTML, 
readTextFromResource("head.html"));
 
     Map<String, String> propertiesDark = new HashMap<>();
-    propertiesDark.put(WebClient.PAGE_TITLE, "Apache Hop Web");
+    propertiesDark.put(WebClient.PAGE_TITLE, webPageTitle);
     propertiesDark.put(WebClient.FAVICON, "ui/images/logo_icon.png");
     propertiesDark.put(WebClient.THEME_ID, "dark");
     propertiesDark.put(WebClient.HEAD_HTML, readTextFromResource("head.html"));
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java 
b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
index 8cda297211..d80202514f 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
@@ -40,6 +40,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.hop.core.Const;
 import org.apache.hop.core.DbCache;
 import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.HopVersionProvider;
 import org.apache.hop.core.Props;
 import org.apache.hop.core.config.DescribedVariablesConfigFile;
 import org.apache.hop.core.config.HopConfig;
@@ -446,6 +447,23 @@ public class HopGui
     }
   }
 
+  /**
+   * Returns the main window title, including the Apache Hop version when it 
is available from the
+   * runtime manifest ({@link HopVersionProvider}). If no implementation 
version is present (for
+   * example when running from the IDE classpath), only the localized 
application name is returned.
+   *
+   * @return window title such as {@code Hop - 2.19.0}, or {@code Hop} when 
the version is unknown
+   */
+  protected String getApplicationWindowTitle() {
+    String appName = BaseMessages.getString(PKG, "HopGui.Application.Name");
+    String version = new HopVersionProvider().getVersion()[0];
+    if (StringUtils.isNotEmpty(version)) {
+      return appName + " - " + version;
+    }
+
+    return appName;
+  }
+
   /** Build the shell */
   protected void open() {
     // Hand Windows a multi-resolution icon set so it can pick the right size 
for each slot
@@ -475,7 +493,7 @@ public class HopGui
 
     PropsUi.setLook(shell);
 
-    shell.setText(BaseMessages.getString(PKG, "HopGui.Application.Name"));
+    shell.setText(getApplicationWindowTitle());
     addMainMenu();
     addMainToolbar();
     addStatusToolbar();

Reply via email to