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

mcasters 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 9931c7694a The underlining of the name of an action or transformation 
no longer works correctly #6195 (#6199)
9931c7694a is described below

commit 9931c7694a8458e5f245b693f2d49cc17af09ade
Author: Nicolas Adment <[email protected]>
AuthorDate: Mon Dec 15 14:52:06 2025 +0100

    The underlining of the name of an action or transformation no longer works 
correctly #6195 (#6199)
    
    - Fixed mouse hover over name
    - Mouse hovers over name only if no other operation is in progress
    - Redrawing of graph inside the “resizeNote” method
---
 .../hopgui/file/pipeline/HopGuiPipelineGraph.java  |  78 ++++++++-------
 .../ui/hopgui/file/shared/HopGuiAbstractGraph.java |   6 +-
 .../hopgui/file/workflow/HopGuiWorkflowGraph.java  | 108 +++++++++++----------
 3 files changed, 101 insertions(+), 91 deletions(-)

diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
index c71fff5a6d..13054a95f5 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
@@ -194,7 +194,6 @@ import org.eclipse.swt.events.MouseTrackListener;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Cursor;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.FormAttachment;
@@ -318,6 +317,8 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
 
   private PipelineHopMeta candidate;
 
+  private boolean dragSelection;
+
   private boolean splitHop;
 
   private int lastButton;
@@ -651,6 +652,7 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
     Point real = screen2real(event.x, event.y);
     lastClick = new Point(real.x, real.y);
     lastButton = event.button;
+    dragSelection = false;
 
     // Hide the tooltip!
     hideToolTips();
@@ -734,8 +736,7 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
             addCandidateAsHop(event.x, event.y);
           }
 
-          TransformMeta transformMeta = (TransformMeta) areaOwner.getOwner();
-          currentTransform = transformMeta;
+          currentTransform = (TransformMeta) areaOwner.getOwner();
 
           for (ITransformSelectionListener listener : 
currentTransformListeners) {
             listener.onUpdateSelection(currentTransform);
@@ -743,8 +744,8 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
 
           // ALT-Click: edit error handling
           //
-          if (event.button == 1 && alt && 
transformMeta.supportsErrorHandling()) {
-            pipelineTransformDelegate.editTransformErrorHandling(pipelineMeta, 
transformMeta);
+          if (event.button == 1 && alt && 
currentTransform.supportsErrorHandling()) {
+            pipelineTransformDelegate.editTransformErrorHandling(pipelineMeta, 
currentTransform);
             return;
           } else if (event.button == 1 && startHopTransform != null && 
endHopTransform == null) {
             candidate = new PipelineHopMeta(startHopTransform, 
currentTransform);
@@ -752,11 +753,12 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
             // SHIFT CLICK is start of drag to create a new hop
             //
             canvas.setData("mode", "hop");
-            startHopTransform = transformMeta;
+            startHopTransform = currentTransform;
           } else {
             canvas.setData("mode", "drag");
+            dragSelection = true;
             selectedTransforms = pipelineMeta.getSelectedTransforms();
-            selectedTransform = transformMeta;
+            selectedTransform = currentTransform;
             //
             // When an icon is moved that is not selected, it gets
             // selected too late.
@@ -764,7 +766,7 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
             //
             previousTransformLocations = 
pipelineMeta.getSelectedTransformLocations();
 
-            Point p = transformMeta.getLocation();
+            Point p = currentTransform.getLocation();
             iconOffset = new Point(real.x - p.x, real.y - p.y);
           }
           redraw();
@@ -1430,7 +1432,6 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
     // Resizing the current note
     if (resize != null) {
       resizeNote(selectedNote, real);
-      redraw();
       return;
     }
 
@@ -1461,7 +1462,11 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
       LogChannel.GENERAL.logError("Error calling PipelineGraphMouseMoved 
extension point", ex);
     }
 
-    if (areaOwner != null) {
+    // Mouse over an area only if no other operation is in progress
+    if (areaOwner != null
+        && this.startHopTransform == null
+        && this.selectionRegion == null
+        && !dragSelection) {
       // Mouse over the name of the transform
       //
       if (!PropsUi.getInstance().useDoubleClick()) {
@@ -1470,11 +1475,6 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
             doRedraw = true;
           }
           mouseOverName = (String) areaOwner.getOwner();
-        } else {
-          if (mouseOverName != null) {
-            doRedraw = true;
-          }
-          mouseOverName = null;
         }
       }
 
@@ -1483,6 +1483,11 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
         // Check if the mouse hovers over the border to resize
         resizeOver = this.getResize(areaOwner.getArea(), real);
       }
+    } else {
+      if (mouseOverName != null) {
+        doRedraw = true;
+      }
+      mouseOverName = null;
     }
 
     //
@@ -1619,19 +1624,23 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
       doRedraw = true;
     }
 
-    Cursor cursor = null;
-    // Change the cursor when the mouse is on the resize edge of a note
-    if (resizeOver != null) {
-      cursor = getDisplay().getSystemCursor(resizeOver.getCursor());
-    }
-    // Change cursor when the mouse is on a hop or an area that support 
hovering
-    else if ((areaOwner != null
-            && areaOwner.getAreaType() != null
-            && areaOwner.getAreaType().isSupportHover())
-        || this.findPipelineHop(real.x, real.y) != null) {
-      cursor = getDisplay().getSystemCursor(SWT.CURSOR_HAND);
+    //  If an operation is already in progress, do not change the cursor.
+    if (this.startHopTransform == null && this.selectionRegion == null && 
!dragSelection) {
+      // Change the cursor when the mouse is on the resize edge of a note
+      if (resizeOver != null) {
+        setCursor(getDisplay().getSystemCursor(resizeOver.getCursor()));
+      }
+      // Change cursor when the mouse is on a hop or an area that support 
hovering
+      else if ((areaOwner != null
+              && areaOwner.getAreaType() != null
+              && areaOwner.getAreaType().isSupportHover())
+          || this.findPipelineHop(real.x, real.y) != null) {
+        setCursor(getDisplay().getSystemCursor(SWT.CURSOR_HAND));
+      } else {
+        // Reset cursor after mouse hover
+        setCursor(null);
+      }
     }
-    setCursor(cursor);
 
     if (doRedraw) {
       redraw();
@@ -2096,12 +2105,13 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
     lastHopSplit = null;
     lastButton = 0;
     iconOffset = null;
+    dragSelection = false;
     startHopTransform = null;
     endHopTransform = null;
     endHopLocation = null;
     pipelineMeta.unselectAll();
-    for (int i = 0; i < pipelineMeta.nrPipelineHops(); i++) {
-      pipelineMeta.getPipelineHop(i).setSplit(false);
+    for (PipelineHopMeta hop : pipelineMeta.getPipelineHops()) {
+      hop.setSplit(false);
     }
   }
 
@@ -2126,12 +2136,10 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
    * @return the pipeline hop on the specified location, otherwise: null
    */
   private PipelineHopMeta findPipelineHop(int x, int y, TransformMeta exclude) 
{
-    int i;
     PipelineHopMeta online = null;
-    for (i = 0; i < pipelineMeta.nrPipelineHops(); i++) {
-      PipelineHopMeta hi = pipelineMeta.getPipelineHop(i);
-      TransformMeta fs = hi.getFromTransform();
-      TransformMeta ts = hi.getToTransform();
+    for (PipelineHopMeta hop : pipelineMeta.getPipelineHops()) {
+      TransformMeta fs = hop.getFromTransform();
+      TransformMeta ts = hop.getToTransform();
 
       if (fs == null || ts == null) {
         return null;
@@ -2146,7 +2154,7 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
       int[] line = getLine(fs, ts);
 
       if (pointOnLine(x, y, line)) {
-        online = hi;
+        online = hop;
       }
     }
     return online;
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
index d633a5ad9f..0fe2429255 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/shared/HopGuiAbstractGraph.java
@@ -65,8 +65,6 @@ public abstract class HopGuiAbstractGraph extends 
DragViewZoomBase
   protected ToolTip toolTip;
   protected String mouseOverName;
 
-  private boolean changedState;
-
   /**
    * This is a state map which can be used by plugins to render extra states 
on top of pipelines and
    * workflows or their components.
@@ -79,7 +77,6 @@ public abstract class HopGuiAbstractGraph extends 
DragViewZoomBase
     this.hopGui = hopGui;
     this.variables = new Variables();
     this.variables.copyFrom(hopGui.getVariables());
-    this.changedState = false;
     this.id = UUID.randomUUID().toString();
     this.stateMap = new HashMap<>();
     this.offset = new DPoint(0.0, 0.0);
@@ -352,6 +349,8 @@ public abstract class HopGuiAbstractGraph extends 
DragViewZoomBase
             resizeArea.height);
       }
     }
+
+    redraw();
   }
 
   /**
@@ -498,6 +497,7 @@ public abstract class HopGuiAbstractGraph extends 
DragViewZoomBase
     this.mouseOverName = mouseOverName;
   }
 
+  /** Resize direction */
   public enum Resize {
     EAST(SWT.CURSOR_SIZEW),
     NORTH(SWT.CURSOR_SIZENS),
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
index c121fbe9da..c1dddfcf7a 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
@@ -158,7 +158,6 @@ import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.MouseMoveListener;
 import org.eclipse.swt.events.MouseTrackListener;
 import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.graphics.Cursor;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.FillLayout;
@@ -347,6 +346,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
   private ActionMeta currentAction;
   private boolean ignoreNextClick;
   private boolean doubleClick;
+  private boolean dragSelection;
   private WorkflowHopMeta clickedWorkflowHop;
 
   private Timer redrawTimer;
@@ -557,6 +557,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
     Point real = screen2real(event.x, event.y);
     lastClick = new Point(real.x, real.y);
     lastButton = event.button;
+    dragSelection = false;
 
     // Hide the tooltip!
     hideToolTips();
@@ -596,8 +597,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
             return;
           }
 
-          ActionMeta actionCopy = (ActionMeta) areaOwner.getOwner();
-          currentAction = actionCopy;
+          currentAction = (ActionMeta) areaOwner.getOwner();
 
           if (hopCandidate != null) {
             addCandidateAsHop();
@@ -606,11 +606,12 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
             // SHIFT CLICK is start of drag to create a new hop
             //
             canvas.setData("mode", "hop");
-            startHopAction = actionCopy;
+            startHopAction = currentAction;
           } else {
             canvas.setData("mode", "drag");
+            dragSelection = true;
             selectedActions = workflowMeta.getSelectedActions();
-            selectedAction = actionCopy;
+            selectedAction = currentAction;
             //
             // When an icon is moved that is not selected, it gets
             // selected too late.
@@ -618,7 +619,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
             //
             previousActionLocations = workflowMeta.getSelectedLocations();
 
-            Point p = actionCopy.getLocation();
+            Point p = currentAction.getLocation();
             iconOffset = new Point(real.x - p.x, real.y - p.y);
           }
           updateGui();
@@ -707,13 +708,18 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
 
       canvas.setData("mode", "resize");
       resize = this.getResize(areaOwner.getArea(), real);
-      // Keep the original area of the resizing note
-      resizeArea =
-          new Rectangle(
-              currentNotePad.getLocation().x,
-              currentNotePad.getLocation().y,
-              currentNotePad.getWidth(),
-              currentNotePad.getHeight());
+
+      if (resize != null) {
+        // Keep the original area of the resizing note
+        resizeArea =
+            new Rectangle(
+                currentNotePad.getLocation().x,
+                currentNotePad.getLocation().y,
+                currentNotePad.getWidth(),
+                currentNotePad.getHeight());
+      } else {
+        dragSelection = true;
+      }
 
       updateGui();
       done = true;
@@ -766,6 +772,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
   @Override
   public void mouseUp(MouseEvent event) {
     resize = null;
+    dragSelection = false;
 
     // canvas.setData("mode", null); does not work.
     canvas.setData("mode", "null");
@@ -1205,7 +1212,6 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
     // Resizing the current note
     if (resize != null) {
       resizeNote(selectedNote, real);
-      redraw();
       return;
     }
 
@@ -1214,23 +1220,19 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
     AreaOwner areaOwner = getVisibleAreaOwner(real.x, real.y);
     Resize resizeOver = null;
 
-    // Moved over an hop?
-    //
-    if (areaOwner != null) {
-
+    // Mouse over an area only if no other operation is in progress
+    if (areaOwner != null
+        && this.startHopAction == null
+        && this.selectionRegion == null
+        && !dragSelection) {
       // Mouse over the name of the action
       //
       if (!PropsUi.getInstance().useDoubleClick()) {
-        if (areaOwner != null && areaOwner.getAreaType() == 
AreaOwner.AreaType.ACTION_NAME) {
+        if (areaOwner.getAreaType() == AreaOwner.AreaType.ACTION_NAME) {
           if (mouseOverName == null) {
             doRedraw = true;
           }
           mouseOverName = (String) areaOwner.getOwner();
-        } else {
-          if (mouseOverName != null) {
-            doRedraw = true;
-          }
-          mouseOverName = null;
         }
       }
 
@@ -1239,6 +1241,11 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
         // Check if the mouse is over the border to activate a resize cursor
         resizeOver = this.getResize(areaOwner.getArea(), real);
       }
+    } else {
+      if (mouseOverName != null) {
+        doRedraw = true;
+      }
+      mouseOverName = null;
     }
 
     //
@@ -1359,27 +1366,23 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
       doRedraw = true;
     }
 
-    Cursor cursor = null;
-    // Change cursor when dragging view or view port
-    // if (viewDrag || viewPortNavigation) {
-    //    cursor = getDisplay().getSystemCursor(SWT.CURSOR_SIZEALL);
-    // }
-    // Change cursor when selecting a region
-    //  else if (selectionRegion != null) {
-    //  cursor = getDisplay().getSystemCursor(SWT.CURSOR_CROSS);
-    /// } else
-    // Change the cursor when the mouse is on the resize edge of a note
-    if (resizeOver != null) {
-      cursor = getDisplay().getSystemCursor(resizeOver.getCursor());
-    }
-    // Change cursor when the mouse is on a hop or an area that support 
hovering
-    else if ((areaOwner != null
-            && areaOwner.getAreaType() != null
-            && areaOwner.getAreaType().isSupportHover())
-        || findWorkflowHop(real.x, real.y) != null) {
-      cursor = getDisplay().getSystemCursor(SWT.CURSOR_HAND);
-    }
-    setCursor(cursor);
+    //  If an operation is already in progress, do not change the cursor.
+    if (this.startHopAction == null && this.selectionRegion == null && 
!dragSelection) {
+      // Change the cursor when the mouse is on the resize edge of a note
+      if (resizeOver != null) {
+        setCursor(getDisplay().getSystemCursor(resizeOver.getCursor()));
+      }
+      // Change cursor when the mouse is on a hop or an area that support 
hovering
+      else if ((areaOwner != null
+              && areaOwner.getAreaType() != null
+              && areaOwner.getAreaType().isSupportHover())
+          || findWorkflowHop(real.x, real.y) != null) {
+        setCursor(getDisplay().getSystemCursor(SWT.CURSOR_HAND));
+      } else {
+        // Reset cursor after mouse hover
+        setCursor(null);
+      }
+    }
 
     if (doRedraw) {
       redraw();
@@ -1784,9 +1787,10 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
     startHopAction = null;
     endHopAction = null;
     iconOffset = null;
+    dragSelection = false;
     workflowMeta.unselectAll();
-    for (int i = 0; i < workflowMeta.nrWorkflowHops(); i++) {
-      workflowMeta.getWorkflowHop(i).setSplit(false);
+    for (WorkflowHopMeta hop : workflowMeta.getWorkflowHops()) {
+      hop.setSplit(false);
     }
   }
 
@@ -1827,12 +1831,10 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
    * @return the workflow hop on the specified location, otherwise: null
    */
   private WorkflowHopMeta findHop(int x, int y, ActionMeta exclude) {
-    int i;
     WorkflowHopMeta online = null;
-    for (i = 0; i < workflowMeta.nrWorkflowHops(); i++) {
-      WorkflowHopMeta hi = workflowMeta.getWorkflowHop(i);
-      ActionMeta fs = hi.getFromAction();
-      ActionMeta ts = hi.getToAction();
+    for (WorkflowHopMeta hop : workflowMeta.getWorkflowHops()) {
+      ActionMeta fs = hop.getFromAction();
+      ActionMeta ts = hop.getToAction();
 
       if (fs == null || ts == null) {
         return null;
@@ -1847,7 +1849,7 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
       int[] line = getLine(fs, ts);
 
       if (pointOnLine(x, y, line)) {
-        online = hi;
+        online = hop;
       }
     }
     return online;

Reply via email to