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 45426db77c Remember panel widths, fixes #7113 (#7322)
45426db77c is described below

commit 45426db77ca7acb6b33344153503d8c86f167cbc
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Mon Jun 22 07:52:41 2026 +0200

    Remember panel widths, fixes #7113 (#7322)
---
 .../java/org/apache/hop/git/GitPerspective.java    |   7 +-
 .../configuration/ConfigurationPerspective.java    |   3 +-
 .../tabs/ConfigGeneralOptionsTab.java              |   3 +
 .../execution/ExecutionPerspective.java            |  19 +--
 .../perspective/explorer/ExplorerPerspective.java  |   8 +-
 .../perspective/metadata/MetadataPerspective.java  |  67 +-------
 .../hop/ui/hopgui/shared/SashFormMemory.java       | 176 +++++++++++++++++++++
 .../core/dialog/messages/messages_en_US.properties |   4 +-
 8 files changed, 196 insertions(+), 91 deletions(-)

diff --git 
a/plugins/misc/git/src/main/java/org/apache/hop/git/GitPerspective.java 
b/plugins/misc/git/src/main/java/org/apache/hop/git/GitPerspective.java
index d07c3d824f..71016752b7 100644
--- a/plugins/misc/git/src/main/java/org/apache/hop/git/GitPerspective.java
+++ b/plugins/misc/git/src/main/java/org/apache/hop/git/GitPerspective.java
@@ -62,6 +62,7 @@ import 
org.apache.hop.ui.hopgui.perspective.HopPerspectivePlugin;
 import org.apache.hop.ui.hopgui.perspective.IHopPerspective;
 import org.apache.hop.ui.hopgui.perspective.explorer.ExplorerPerspective;
 import org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective;
+import org.apache.hop.ui.hopgui.shared.SashFormMemory;
 import org.apache.hop.ui.util.EnvironmentUtils;
 import org.eclipse.jgit.api.CherryPickResult;
 import org.eclipse.jgit.api.Git;
@@ -267,9 +268,9 @@ public class GitPerspective implements IHopPerspective {
     createFileTree(wSashFormViewer);
     createDiffView(wSashFormViewer);
 
-    wSashForm.setWeights(10, 90);
-    wSashFormCommit.setWeights(70, 30);
-    wSashFormViewer.setWeights(30, 70);
+    SashFormMemory.persist(wSashForm, "git-perspective-tree-width");
+    SashFormMemory.persist(wSashFormCommit, "git-perspective-commit-split", 
70, 30);
+    SashFormMemory.persist(wSashFormViewer, "git-perspective-viewer-split", 
30, 70);
 
     // Restore options
     restorePerspectiveSettings();
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/ConfigurationPerspective.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/ConfigurationPerspective.java
index be9901c5aa..7ec1484189 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/ConfigurationPerspective.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/ConfigurationPerspective.java
@@ -44,6 +44,7 @@ import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
 import org.apache.hop.ui.hopgui.perspective.HopPerspectivePlugin;
 import org.apache.hop.ui.hopgui.perspective.IHopPerspective;
 import 
org.apache.hop.ui.hopgui.perspective.configuration.tabs.ConfigPluginOptionsTab;
+import org.apache.hop.ui.hopgui.shared.SashFormMemory;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CTabFolder;
 import org.eclipse.swt.custom.CTabItem;
@@ -298,7 +299,7 @@ public class ConfigurationPerspective implements 
IHopPerspective {
       categoryTree.setSelection(firstItem);
     }
 
-    sashForm.setWeights(20, 80);
+    SashFormMemory.persist(sashForm, "configuration-perspective-tree-width");
 
     // Register with key handler so activate shortcut (Ctrl+Shift+C / 
Cmd+Shift+C) works
     HopGuiKeyHandler keyHandler = HopGuiKeyHandler.getInstance();
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java
index 4e53f89462..7b6c3cda35 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java
@@ -29,6 +29,7 @@ import org.apache.hop.ui.core.dialog.ErrorDialog;
 import org.apache.hop.ui.core.gui.GuiResource;
 import org.apache.hop.ui.hopgui.HopGui;
 import 
org.apache.hop.ui.hopgui.perspective.configuration.ConfigurationPerspective;
+import org.apache.hop.ui.hopgui.shared.SashFormMemory;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CTabFolder;
 import org.eclipse.swt.custom.CTabItem;
@@ -469,6 +470,8 @@ public class ConfigGeneralOptionsTab {
           // Clear both session and persistent dialog positions
           props.clearSessionScreens();
           props.clearPersistedDialogScreens();
+          // Also reset the remembered perspective tree-panel widths to their 
defaults.
+          SashFormMemory.resetAll();
 
           // Show confirmation message
           org.apache.hop.ui.core.dialog.MessageBox mb =
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/ExecutionPerspective.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/ExecutionPerspective.java
index ae4a3fcdd6..28a30dd754 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/ExecutionPerspective.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/ExecutionPerspective.java
@@ -82,6 +82,7 @@ import 
org.apache.hop.ui.hopgui.perspective.HopPerspectivePlugin;
 import org.apache.hop.ui.hopgui.perspective.IHopPerspective;
 import org.apache.hop.ui.hopgui.perspective.TabClosable;
 import org.apache.hop.ui.hopgui.perspective.TabCloseHandler;
+import org.apache.hop.ui.hopgui.shared.SashFormMemory;
 import org.apache.hop.workflow.WorkflowMeta;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CTabFolder;
@@ -152,9 +153,6 @@ public class ExecutionPerspective implements 
IHopPerspective, TabClosable {
   public static final String FILTER_NAME_DATE_ID = "name - date - ID";
 
   private static final String EXECUTION_AUDIT_TYPE = 
"execution-perspective-gui";
-  private static final String AUDIT_SASH_WEIGHTS = "sash-weights";
-  private static final String AUDIT_SASH_LEFT = "sash-left";
-  private static final String AUDIT_SASH_RIGHT = "sash-right";
   private static final String AUDIT_EXECUTION_TOOLBAR = "toolbar";
   private static final String AUDIT_ONLY_PARENTS = "only-parents";
   private static final String AUDIT_ONLY_FAILED = "only-failed";
@@ -239,7 +237,7 @@ public class ExecutionPerspective implements 
IHopPerspective, TabClosable {
     createTree(sash);
     createTabFolder(sash);
 
-    sash.setWeights(new int[] {30, 70});
+    SashFormMemory.persist(sash, "execution-perspective-tree-width");
 
     restoreState();
 
@@ -1200,11 +1198,6 @@ public class ExecutionPerspective implements 
IHopPerspective, TabClosable {
                   AUDIT_TIME_FILTER,
                   timeFilter.getCode())));
 
-      int[] sashWeights = sash.getWeights();
-      stateMap.add(
-          new AuditState(
-              AUDIT_SASH_WEIGHTS,
-              Map.of(AUDIT_SASH_LEFT, sashWeights[0], AUDIT_SASH_RIGHT, 
sashWeights[1])));
       AuditManager.getActive()
           .saveAuditStateMap(HopNamespace.getNamespace(), 
EXECUTION_AUDIT_TYPE, stateMap);
     } catch (Exception e) {
@@ -1232,14 +1225,6 @@ public class ExecutionPerspective implements 
IHopPerspective, TabClosable {
       String timeFilterName = toolbarState.extractString(AUDIT_TIME_FILTER, 
"");
       timeFilter = IEnumHasCode.lookupCode(LastPeriod.class, timeFilterName, 
LastPeriod.ONE_HOUR);
 
-      AuditState sashState = stateMap.get(AUDIT_SASH_WEIGHTS);
-      if (sashState == null) {
-        sashState = new AuditState();
-      }
-      int left = sashState.extractInteger(AUDIT_SASH_LEFT, 30);
-      int right = sashState.extractInteger(AUDIT_SASH_RIGHT, 70);
-      sash.setWeights(left, right);
-
       updateGui();
       refresh();
     } catch (Exception e) {
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
index 218b12510c..30b02601b9 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
@@ -114,6 +114,7 @@ import 
org.apache.hop.ui.hopgui.perspective.explorer.file.types.FolderFileType;
 import 
org.apache.hop.ui.hopgui.perspective.explorer.file.types.GenericFileType;
 import org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective;
 import org.apache.hop.ui.hopgui.shared.CanvasZoomHelper;
+import org.apache.hop.ui.hopgui.shared.SashFormMemory;
 import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
 import org.apache.hop.ui.util.EnvironmentUtils;
 import org.apache.hop.workflow.WorkflowMeta;
@@ -209,6 +210,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
       "ExplorerPerspective-ContextMenu-10401-CopyPath";
   public static final String CONTEXT_MENU_DELETE = 
"ExplorerPerspective-ContextMenu-90000-Delete";
   private static final String FILE_EXPLORER_TREE = "File explorer tree";
+  private static final String TREE_WIDTH_AUDIT_TYPE = 
"explorer-perspective-tree-width";
   private static final String EXPLORER_AUDIT_TYPE = 
"explorer-perspective-state";
   private static final String STATE_PANEL_VISIBLE_KEY = "panel-visible";
   private static final String STATE_PANEL_VISIBLE_PROP = "visible";
@@ -323,7 +325,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
     createTree(sash);
     createTabFolder(sash);
 
-    sash.setWeights(20, 80);
+    SashFormMemory.persist(sash, TREE_WIDTH_AUDIT_TYPE);
 
     // Set initial file explorer panel visibility from configuration only.
     // Saved state is applied later in applyRestoredState() after startup (and 
project) so
@@ -3499,7 +3501,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
 
     if (fileExplorerPanelVisible) {
       sash.setMaximizedControl(null);
-      sash.setWeights(20, 80);
+      SashFormMemory.restore(sash, TREE_WIDTH_AUDIT_TYPE);
     } else {
       sash.setMaximizedControl(tabFolderWrapper);
     }
@@ -3753,7 +3755,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
       fileExplorerPanelVisible = savedVisibility;
       if (fileExplorerPanelVisible) {
         sash.setMaximizedControl(null);
-        sash.setWeights(20, 80);
+        SashFormMemory.restore(sash, TREE_WIDTH_AUDIT_TYPE);
       } else {
         sash.setMaximizedControl(tabFolderWrapper);
       }
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java
index a1b452f6f1..f6edd319b7 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java
@@ -90,6 +90,7 @@ import org.apache.hop.ui.hopgui.perspective.TabCloseHandler;
 import org.apache.hop.ui.hopgui.perspective.TabItemHandler;
 import org.apache.hop.ui.hopgui.perspective.TabItemReorder;
 import org.apache.hop.ui.hopgui.perspective.explorer.ExplorerPerspective;
+import org.apache.hop.ui.hopgui.shared.SashFormMemory;
 import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
 import org.apache.hop.ui.util.HelpUtils;
 import org.eclipse.swt.SWT;
@@ -151,11 +152,6 @@ public class MetadataPerspective implements 
IHopPerspective, TabClosable, IMetad
 
   private static final String FOLDER_AUDIT_SEPARATOR = "\t";
 
-  /**
-   * Audit-trail key under which the tree-panel sash weights are stored 
(global, not per-project).
-   */
-  private static final String SASH_WEIGHTS_AUDIT_TYPE = 
"metadata-perspective-tree-width";
-
   public static final String GUI_PLUGIN_TOOLBAR_PARENT_ID = 
"MetadataPerspective-Toolbar";
 
   public static final String TOOLBAR_ITEM_NEW_TYPE = 
"MetadataPerspective-Toolbar-09000-NewType";
@@ -222,9 +218,6 @@ public class MetadataPerspective implements 
IHopPerspective, TabClosable, IMetad
   /** Debounced search action so we don't rebuild the tree on every keystroke. 
*/
   private final Runnable filterRunnable = this::applyFilter;
 
-  /** Debounced save of the tree-panel sash weights so we don't write on every 
drag pixel. */
-  private final Runnable sashWeightsSaver = this::saveSashWeights;
-
   private final List<MetadataEditor<?>> editors = new ArrayList<>();
 
   private final MetadataFileType metadataFileType;
@@ -285,10 +278,8 @@ public class MetadataPerspective implements 
IHopPerspective, TabClosable, IMetad
     editorStackLayout.topControl = overview;
     editorArea.layout();
 
-    sash.setWeights(new int[] {20, 80});
     // Restore the saved tree-panel width and persist it whenever the divider 
is dragged.
-    loadSashWeights();
-    editorArea.addListener(SWT.Resize, e -> scheduleSaveSashWeights());
+    SashFormMemory.persist(sash, "metadata-perspective-tree-width");
 
     this.refresh();
     this.updateSelection();
@@ -2065,60 +2056,6 @@ public class MetadataPerspective implements 
IHopPerspective, TabClosable, IMetad
     return Const.NVL(HopNamespace.getNamespace(), 
HopGui.DEFAULT_HOP_GUI_NAMESPACE);
   }
 
-  /** Restores the saved tree-panel sash weights (a global layout preference), 
if any. */
-  private void loadSashWeights() {
-    if (sash == null || sash.isDisposed()) {
-      return;
-    }
-    try {
-      AuditList list =
-          AuditManager.getActive()
-              .retrieveList(HopGui.DEFAULT_HOP_GUI_NAMESPACE, 
SASH_WEIGHTS_AUDIT_TYPE);
-      if (list == null || list.getNames() == null || list.getNames().size() < 
2) {
-        return;
-      }
-      int[] weights = new int[list.getNames().size()];
-      for (int i = 0; i < weights.length; i++) {
-        weights[i] = Integer.parseInt(list.getNames().get(i).trim());
-      }
-      sash.setWeights(weights);
-    } catch (Exception e) {
-      LogChannel.UI.logError("Error reading the metadata tree-panel width from 
the audit trail", e);
-    }
-  }
-
-  /** Debounced trigger to save the sash weights after the divider stops 
moving. */
-  private void scheduleSaveSashWeights() {
-    if (sash == null || sash.isDisposed()) {
-      return;
-    }
-    Display display = sash.getDisplay();
-    display.timerExec(-1, sashWeightsSaver);
-    display.timerExec(400, sashWeightsSaver);
-  }
-
-  /** Persists the current tree-panel sash weights (global, not per-project). 
*/
-  private void saveSashWeights() {
-    if (sash == null || sash.isDisposed()) {
-      return;
-    }
-    int[] weights = sash.getWeights();
-    if (weights == null || weights.length < 2) {
-      return;
-    }
-    try {
-      List<String> values = new ArrayList<>();
-      for (int weight : weights) {
-        values.add(Integer.toString(weight));
-      }
-      AuditManager.getActive()
-          .storeList(
-              HopGui.DEFAULT_HOP_GUI_NAMESPACE, SASH_WEIGHTS_AUDIT_TYPE, new 
AuditList(values));
-    } catch (Exception e) {
-      LogChannel.UI.logError("Error storing the metadata tree-panel width in 
the audit trail", e);
-    }
-  }
-
   /**
    * Deletes the selected virtual folder: any items inside it (or its 
sub-folders) are moved up to
    * the parent folder, and the folder (plus any persisted empty sub-folders) 
is removed from the
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/shared/SashFormMemory.java 
b/ui/src/main/java/org/apache/hop/ui/hopgui/shared/SashFormMemory.java
new file mode 100644
index 0000000000..4c4b60fa3a
--- /dev/null
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/shared/SashFormMemory.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.hop.ui.hopgui.shared;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.hop.core.logging.LogChannel;
+import org.apache.hop.history.AuditList;
+import org.apache.hop.history.AuditManager;
+import org.apache.hop.ui.hopgui.HopGui;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Remembers the weights (panel sizes) of a {@link SashForm} across restarts, 
stored globally in the
+ * audit trail (a layout preference, not per-project).
+ *
+ * <p>Call {@link #persist(SashForm, String, int...)} once, after the sash 
form and all of its child
+ * panels have been created. It restores the saved weights (or applies the 
supplied defaults when
+ * nothing has been saved yet) and then saves the weights, debounced, whenever 
the divider is moved.
+ */
+public final class SashFormMemory {
+
+  /** Global audit group: a sash layout is a UI preference shared across 
projects. */
+  private static final String AUDIT_GROUP = HopGui.DEFAULT_HOP_GUI_NAMESPACE;
+
+  private static final int SAVE_DEBOUNCE_MS = 400;
+
+  /**
+   * Shared default weights for a perspective tree panel, so every perspective 
lines up at the same
+   * width when nothing is saved (and after a reset). Callers that need a 
different split (e.g. a
+   * content sash) pass their own defaults.
+   */
+  private static final int[] DEFAULT_WEIGHTS = {20, 80};
+
+  /** Every tracked sash form, keyed by its audit key, so {@link #resetAll()} 
can reach them all. */
+  private static final Map<String, Tracked> TRACKED = new LinkedHashMap<>();
+
+  private record Tracked(SashForm sashForm, int[] defaultWeights) {}
+
+  private SashFormMemory() {
+    // Utility class
+  }
+
+  /**
+   * Restores the saved weights of {@code sashForm} and persists them whenever 
the user drags the
+   * divider.
+   *
+   * @param sashForm the sash form to track (must already have its child 
panels)
+   * @param key a unique audit key for this sash, e.g. {@code 
"explorer-perspective-tree-width"}
+   * @param defaultWeights weights to apply when nothing has been saved yet; 
pass none to keep the
+   *     weights the caller has already set
+   */
+  public static void persist(SashForm sashForm, String key, int... 
defaultWeights) {
+    if (sashForm == null || sashForm.isDisposed()) {
+      return;
+    }
+    int[] defaults = defaultsOrFallback(defaultWeights);
+    restore(sashForm, key, defaults);
+    TRACKED.put(key, new Tracked(sashForm, defaults));
+
+    Display display = sashForm.getDisplay();
+    Runnable saver = () -> save(sashForm, key);
+    // A child resizes both when the divider is dragged and when the window 
resizes; weights are
+    // proportional, so saving on a plain window resize is harmless. Debounce 
to a single write.
+    for (Control child : sashForm.getChildren()) {
+      if (child != null && !child.isDisposed()) {
+        child.addListener(
+            SWT.Resize,
+            e -> {
+              if (!sashForm.isDisposed()) {
+                display.timerExec(-1, saver);
+                display.timerExec(SAVE_DEBOUNCE_MS, saver);
+              }
+            });
+      }
+    }
+  }
+
+  /**
+   * Applies the saved weights for {@code key} to {@code sashForm}, or {@code 
defaultWeights} when
+   * nothing has been saved. Use this (instead of a hard-coded {@code 
setWeights(...)}) wherever a
+   * perspective re-applies its layout, e.g. when un-maximizing or showing a 
panel, so the user's
+   * remembered width is honoured.
+   */
+  public static void restore(SashForm sashForm, String key, int... 
defaultWeights) {
+    if (sashForm == null || sashForm.isDisposed()) {
+      return;
+    }
+    sashForm.setWeights(defaultsOrFallback(defaultWeights));
+    try {
+      AuditList list = AuditManager.getActive().retrieveList(AUDIT_GROUP, key);
+      if (list == null || list.getNames() == null || list.getNames().size() < 
2) {
+        return;
+      }
+      int[] weights = new int[list.getNames().size()];
+      for (int i = 0; i < weights.length; i++) {
+        weights[i] = Integer.parseInt(list.getNames().get(i).trim());
+      }
+      sashForm.setWeights(weights);
+    } catch (Exception e) {
+      LogChannel.UI.logError(
+          "Error reading sash weights for '" + key + "' from the audit trail", 
e);
+    }
+  }
+
+  private static void save(SashForm sashForm, String key) {
+    if (sashForm.isDisposed()) {
+      return;
+    }
+    int[] weights = sashForm.getWeights();
+    if (weights == null || weights.length < 2) {
+      return;
+    }
+    try {
+      List<String> values = new ArrayList<>();
+      for (int weight : weights) {
+        values.add(Integer.toString(weight));
+      }
+      AuditManager.getActive().storeList(AUDIT_GROUP, key, new 
AuditList(values));
+    } catch (Exception e) {
+      LogChannel.UI.logError("Error storing sash weights for '" + key + "' in 
the audit trail", e);
+    }
+  }
+
+  /**
+   * Resets every tracked sash form to its default weights and forgets the 
saved widths, returning
+   * the panels to their out-of-the-box layout now and after a restart. 
Tracked perspectives are
+   * those whose {@link #persist(SashForm, String, int...)} has run this 
session (created at
+   * startup).
+   */
+  public static void resetAll() {
+    for (Map.Entry<String, Tracked> entry : TRACKED.entrySet()) {
+      Tracked tracked = entry.getValue();
+      SashForm sashForm = tracked.sashForm();
+      int[] defaults = tracked.defaultWeights();
+      if (sashForm != null && !sashForm.isDisposed() && defaults != null && 
defaults.length > 0) {
+        sashForm.setWeights(defaults);
+      }
+      forget(entry.getKey());
+    }
+  }
+
+  /** The caller's defaults, or the shared {@link #DEFAULT_WEIGHTS} when none 
were supplied. */
+  private static int[] defaultsOrFallback(int[] defaultWeights) {
+    return (defaultWeights != null && defaultWeights.length > 0) ? 
defaultWeights : DEFAULT_WEIGHTS;
+  }
+
+  /** Removes the saved weights for a key (stores an empty list so the next 
load falls back). */
+  private static void forget(String key) {
+    try {
+      AuditManager.getActive().storeList(AUDIT_GROUP, key, new AuditList(new 
ArrayList<>()));
+    } catch (Exception e) {
+      LogChannel.UI.logError("Error clearing saved sash weights for '" + key + 
"'", e);
+    }
+  }
+}
diff --git 
a/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
 
b/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
index 76b89cdf66..ddd2ca941a 100644
--- 
a/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
+++ 
b/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
@@ -122,8 +122,8 @@ EnterOptionsDialog.ResetTooltips.Tooltip=Enable all tooltip 
options
 EnterOptionsDialog.ResetDialogPositions.Label=Reset dialog positions after 
restart
 EnterOptionsDialog.ResetDialogPositions.Tooltip=When enabled, dialog positions 
will only be remembered during the current session.\nWhen disabled, dialog 
positions will be persisted across application restarts.
 EnterOptionsDialog.ClearDialogPositions.Label=Clear dialog positions
-EnterOptionsDialog.ClearDialogPositions.Tooltip=Clears all remembered dialog 
positions for the current session
-EnterOptionsDialog.ClearDialogPositions.Confirmation=All dialog positions have 
been cleared for this session.
+EnterOptionsDialog.ClearDialogPositions.Tooltip=Clears all remembered dialog 
positions and resets the perspective tree-panel widths to their defaults
+EnterOptionsDialog.ClearDialogPositions.Confirmation=All dialog positions have 
been cleared and the perspective tree-panel widths have been reset to their 
defaults.
 EnterOptionsDialog.ClearDialogPositions.Title=Dialog Positions Cleared
 EnterOptionsDialog.ConfigFilename.Label=Hop configuration filename:
 EnterOptionsDialog.CopyOrDistributeDialog.Label=Show copy or distribute dialog 
when drawing a hop

Reply via email to