You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2022/09/19 05:58:29 UTC

[hop] branch master updated: HOP-4216 Save the properties of the shells in the default name space -Cleanup duplicate code

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a670afe71a HOP-4216 Save the properties of the shells in the default name space -Cleanup duplicate code
     new c8c463cc25 Merge pull request #1693 from nadment/HOP-4216
a670afe71a is described below

commit a670afe71a2e663adc024c74bfc909ccfc7143ce
Author: Nicolas Adment <39...@users.noreply.github.com>
AuthorDate: Sun Sep 18 22:27:02 2022 +0200

    HOP-4216 Save the properties of the shells in the default name space
    -Cleanup duplicate code
---
 .../main/java/org/apache/hop/ui/core/PropsUi.java  |  6 ++---
 .../ui/pipeline/transform/BaseTransformDialog.java | 27 ++--------------------
 2 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
index 176c1d7de7..7a228f509f 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
@@ -27,9 +27,9 @@ import org.apache.hop.core.util.Utils;
 import org.apache.hop.history.AuditManager;
 import org.apache.hop.history.AuditState;
 import org.apache.hop.ui.core.gui.GuiResource;
-import org.apache.hop.ui.core.gui.HopNamespace;
 import org.apache.hop.ui.core.gui.WindowProperty;
 import org.apache.hop.ui.core.widget.OsHelper;
+import org.apache.hop.ui.hopgui.HopGui;
 import org.apache.hop.ui.hopgui.TextSizeUtilFacade;
 import org.apache.hop.ui.util.EnvironmentUtils;
 import org.eclipse.swt.SWT;
@@ -365,7 +365,7 @@ public class PropsUi extends Props {
   public void setScreen(WindowProperty windowProperty) {
     AuditManager.storeState(
         LogChannel.UI,
-        HopNamespace.getNamespace(),
+        HopGui.DEFAULT_HOP_GUI_NAMESPACE,
         "shells",
         windowProperty.getName(),
         windowProperty.getStateProperties());
@@ -377,7 +377,7 @@ public class PropsUi extends Props {
     }
     AuditState auditState =
         AuditManager.retrieveState(
-            LogChannel.UI, HopNamespace.getNamespace(), "shells", windowName);
+            LogChannel.UI, HopGui.DEFAULT_HOP_GUI_NAMESPACE, "shells", windowName);
     if (auditState == null) {
       return null;
     }
diff --git a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java
index 9f1720d3d6..69653f1e07 100644
--- a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/BaseTransformDialog.java
@@ -639,31 +639,8 @@ public class BaseTransformDialog extends Dialog {
     setSize(shell, -1, -1, true);
   }
 
-  public static void setSize(Shell shell, int prefWidth, int prefHeight) {
-    PropsUi props = PropsUi.getInstance();
-
-    WindowProperty winprop = props.getScreen(shell.getText());
-    if (winprop != null) {
-      winprop.setShell(shell, prefWidth, prefHeight);
-    } else {
-      shell.layout();
-
-      winprop = new WindowProperty(shell.getText(), false, 0, 0, prefWidth, prefHeight);
-      winprop.setShell(shell);
-
-      // Now, as this is the first time it gets opened, try to put it in the middle of the screen...
-      Rectangle shellBounds = shell.getBounds();
-      Monitor monitor = shell.getDisplay().getPrimaryMonitor();
-      if (shell.getParent() != null) {
-        monitor = shell.getParent().getMonitor();
-      }
-      Rectangle monitorClientArea = monitor.getClientArea();
-
-      int middleX = monitorClientArea.x + (monitorClientArea.width - shellBounds.width) / 2;
-      int middleY = monitorClientArea.y + (monitorClientArea.height - shellBounds.height) / 2;
-
-      shell.setLocation(middleX, middleY);
-    }
+  public static void setSize(Shell shell, int minWidth, int minHeight) {
+    setSize(shell, minWidth, minHeight, false);
   }
 
   /**