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 b1eb137153 Switch the JavaScript action dialog to the TM4E content 
editor #8515 (#8517)
b1eb137153 is described below

commit b1eb137153ceac5ea600804bcbb1358a86ecb7ba
Author: Nicolas Adment <[email protected]>
AuthorDate: Tue Sep 22 10:00:17 2026 +0200

    Switch the JavaScript action dialog to the TM4E content editor #8515 (#8517)
---
 .../workflow/actions/eval/ActionEvalDialog.java    | 123 +++------------------
 .../eval/messages/messages_de_DE.properties        |   2 -
 .../eval/messages/messages_en_US.properties        |   2 -
 .../eval/messages/messages_es_AR.properties        |   2 -
 .../eval/messages/messages_fr_FR.properties        |   2 -
 .../eval/messages/messages_it_IT.properties        |   2 -
 .../eval/messages/messages_ja_JP.properties        |   2 -
 .../eval/messages/messages_ko_KR.properties        |   2 -
 .../eval/messages/messages_nl_NL.properties        |   1 -
 .../eval/messages/messages_pt_BR.properties        |   2 -
 .../eval/messages/messages_zh_CN.properties        |   2 -
 11 files changed, 17 insertions(+), 125 deletions(-)

diff --git 
a/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEvalDialog.java
 
b/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEvalDialog.java
index 733791ad47..ec09ce234c 100644
--- 
a/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEvalDialog.java
+++ 
b/plugins/actions/eval/src/main/java/org/apache/hop/workflow/actions/eval/ActionEvalDialog.java
@@ -17,30 +17,22 @@
 
 package org.apache.hop.workflow.actions.eval;
 
-import org.apache.hop.core.Props;
 import org.apache.hop.core.util.Utils;
 import org.apache.hop.core.variables.IVariables;
 import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.ui.core.FormDataBuilder;
 import org.apache.hop.ui.core.PropsUi;
 import org.apache.hop.ui.core.dialog.BaseDialog;
 import org.apache.hop.ui.core.dialog.MessageBox;
-import org.apache.hop.ui.core.widget.JavaScriptStyledTextComp;
-import org.apache.hop.ui.core.widget.StyledTextComp;
-import org.apache.hop.ui.core.widget.TextComposite;
-import org.apache.hop.ui.util.EnvironmentUtils;
+import org.apache.hop.ui.core.widget.editor.IContentEditorWidget;
+import org.apache.hop.ui.hopgui.ContentEditorFacade;
 import org.apache.hop.ui.workflow.action.ActionDialog;
 import org.apache.hop.workflow.WorkflowMeta;
 import org.apache.hop.workflow.action.IAction;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 
@@ -48,9 +40,7 @@ import org.eclipse.swt.widgets.Shell;
 public class ActionEvalDialog extends ActionDialog {
   private static final Class<?> PKG = ActionEval.class;
 
-  private TextComposite wScript;
-
-  private Label wlPosition;
+  private IContentEditorWidget wScript;
 
   private ActionEval action;
 
@@ -74,93 +64,22 @@ public class ActionEvalDialog extends ActionDialog {
 
     ModifyListener lsMod = e -> action.setChanged();
 
-    wlPosition = new Label(shell, SWT.NONE);
-    wlPosition.setText(BaseMessages.getString(PKG, "ActionEval.LineNr.Label", 
"0"));
-    PropsUi.setLook(wlPosition);
-    FormData fdlPosition = new FormData();
-    fdlPosition.left = new FormAttachment(0, 0);
-    fdlPosition.bottom = new FormAttachment(wOk, -margin);
-    wlPosition.setLayoutData(fdlPosition);
-
     // Script line
     Label wlScript = new Label(shell, SWT.NONE);
     wlScript.setText(BaseMessages.getString(PKG, "ActionEval.Script.Label"));
+    wlScript.setLayoutData(new FormDataBuilder().left().top(wSpacer, 
margin).result());
     PropsUi.setLook(wlScript);
-    FormData fdlScript = new FormData();
-    fdlScript.left = new FormAttachment(0, 0);
-    fdlScript.top = new FormAttachment(wSpacer, margin);
-    wlScript.setLayoutData(fdlScript);
-
-    if (EnvironmentUtils.getInstance().isWeb()) {
-      wScript =
-          new StyledTextComp(
-              action,
-              shell,
-              SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL,
-              false,
-              TextComposite.STYLE_TYPE_JAVASCRIPT);
-    } else {
-      wScript =
-          new JavaScriptStyledTextComp(
-              action,
-              shell,
-              SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL,
-              false);
-      wScript.addLineStyleListener();
-    }
+
+    Composite composite = new Composite(shell, SWT.BORDER);
+    composite.setLayout(new FormLayout());
+    composite.setLayoutData(
+        new FormDataBuilder().top(wlScript, margin).bottom(wOk, 
-margin).fullWidth().result());
+    PropsUi.setLook(composite);
+
+    wScript = ContentEditorFacade.createContentEditor(composite, "javascript");
     wScript.setText(BaseMessages.getString(PKG, "ActionEval.Script.Default"));
-    PropsUi.setLook(wScript, Props.WIDGET_STYLE_FIXED);
-    wScript.addModifyListener(lsMod);
-    FormData fdScript = new FormData();
-    fdScript.left = new FormAttachment(0, 0);
-    fdScript.top = new FormAttachment(wlScript, margin);
-    fdScript.right = new FormAttachment(100, 0);
-    fdScript.bottom = new FormAttachment(wlPosition, -margin);
-    wScript.setLayoutData(fdScript);
-    wScript.addModifyListener(arg0 -> setPosition());
-
-    wScript.addKeyListener(
-        new KeyAdapter() {
-          @Override
-          public void keyPressed(KeyEvent e) {
-            setPosition();
-          }
-
-          @Override
-          public void keyReleased(KeyEvent e) {
-            setPosition();
-          }
-        });
-    wScript.addFocusListener(
-        new FocusAdapter() {
-          @Override
-          public void focusGained(FocusEvent e) {
-            setPosition();
-          }
-
-          @Override
-          public void focusLost(FocusEvent e) {
-            setPosition();
-          }
-        });
-    wScript.addMouseListener(
-        new MouseAdapter() {
-          @Override
-          public void mouseDoubleClick(MouseEvent e) {
-            setPosition();
-          }
-
-          @Override
-          public void mouseDown(MouseEvent e) {
-            setPosition();
-          }
-
-          @Override
-          public void mouseUp(MouseEvent e) {
-            setPosition();
-          }
-        });
     wScript.addModifyListener(lsMod);
+    wScript.getControl().setLayoutData(new 
FormDataBuilder().fullSize().result());
 
     getData();
     focusActionName();
@@ -170,15 +89,7 @@ public class ActionEvalDialog extends ActionDialog {
     return action;
   }
 
-  public void setPosition() {
-    int lineNumber = wScript.getLineNumber();
-    int columnNumber = wScript.getColumnNumber();
-    wlPosition.setText(
-        BaseMessages.getString(
-            PKG, "ActionEval.Position.Label", "" + lineNumber, "" + 
columnNumber));
-  }
-
-  /** Copy information from the meta-data input to the dialog fields. */
+  /** Copy information from the metadata input to the dialog fields. */
   public void getData() {
     if (action.getName() != null) {
       wName.setText(action.getName());
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_de_DE.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_de_DE.properties
index 61a9fd07f4..e66a977f15 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_de_DE.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_de_DE.properties
@@ -23,10 +23,8 @@ ActionEval.CouldNotCompile=JavaScript nicht kompilierbar {0}
 ActionEval.Description=Bewertet das Ergebnis der Ausf\u00FChrung einer 
fr\u00FCheren Action
 ActionEval.ErrorEvaluating=Fehler bei der Auswertung des Ausdrucks [{0}] : {1}
 ActionEval.keyword=Auswertung
-ActionEval.LineNr.Label=Zeilennummer: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=Auswertung
-ActionEval.Position.Label=Zeile {0} Spalte {1}
 ActionEval.Script.Default=Skript
 ActionEval.Script.Label=JavaScript: 
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_en_US.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_en_US.properties
index 1b1b4b331c..c389134ac0 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_en_US.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_en_US.properties
@@ -22,10 +22,8 @@ ActionEval.CouldNotCompile=Couldn''t compile javascript\: {0}
 ActionEval.Description=Evaluates the result of the execution of a previous 
action
 ActionEval.ErrorEvaluating=Error evaluating expression in [{0}] \: {1}
 ActionEval.keyword=evaluate,condition,javascript,expression,boolean
-ActionEval.LineNr.Label=Line number\: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=Evaluation
-ActionEval.Position.Label=Line {0} Column {1}
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript\: 
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_es_AR.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_es_AR.properties
index 836fa29376..adfd67ead7 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_es_AR.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_es_AR.properties
@@ -21,10 +21,8 @@
 ActionEval.ActionName.Label=Nombre de la entrada de trabajo
 ActionEval.CouldNotCompile=No se pudo compilar el c\u00F3digo javascript\: {0}
 ActionEval.ErrorEvaluating=Error al evaluar la expresi\u00F3n en [{0}]\: {1}
-ActionEval.LineNr.Label=N\u00FAmero de l\u00EDnea\: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=Evaluaci\u00F3n Javascript
-ActionEval.Position.Label=L\u00EDnea {0} Columna {1}
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript\:
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_fr_FR.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_fr_FR.properties
index 52aaf8022b..bfebbf5aed 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_fr_FR.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_fr_FR.properties
@@ -22,10 +22,8 @@ ActionEval.ActionName.Label=Nom de l''action
 ActionEval.CouldNotCompile=Impossible de compiler le script java \: {0}
 ActionEval.Description=Evalue le r\u00e9sultat de l''action 
pr\u00e9c\u00e9dente
 ActionEval.ErrorEvaluating=Apache Hop a rencontr\u00E9 une erreur lors de 
l''\u00E9valuation de l''expression [{0}] : {1}
-ActionEval.LineNr.Label=Num\u00E9ro de ligne\u202F: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=\u00C9valuation
-ActionEval.Position.Label=Ligne {0} Colonne {1}
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript\u202F: 
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_it_IT.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_it_IT.properties
index 4957bd3fba..84563955a1 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_it_IT.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_it_IT.properties
@@ -21,10 +21,8 @@
 ActionEval.ActionName.Label=Nome action
 ActionEval.CouldNotCompile=Impossibile compilare javascript\: {0}
 ActionEval.ErrorEvaluating=Errore nel valutare l''espressione in [{0}] \: {1}
-ActionEval.LineNr.Label=Numero linea\: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=Valutazione
-ActionEval.Position.Label=Linea {0} Colonna {1}
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript\: 
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ja_JP.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ja_JP.properties
index 82216c7bc3..bd68046941 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ja_JP.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ja_JP.properties
@@ -20,10 +20,8 @@
 
 ActionEval.ActionName.Label=\u30b8\u30e7\u30d6\u540d
 ActionEval.Description=Java\u30b9\u30af\u30ea\u30d7\u30c8
-ActionEval.LineNr.Label=\u884c\u756a\u53f7\: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=Evaluation
-ActionEval.Position.Label=\u884c{0}\u5217{1}
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript\: 
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ko_KR.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ko_KR.properties
index 83115314ac..96295a746f 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ko_KR.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_ko_KR.properties
@@ -20,6 +20,4 @@
 
 ActionEval.ActionName.Label=Workflow \uC5D4\uD2B8\uB9AC \uC774\uB984
 ActionEval.CouldNotCompile=Javascript\uB97C \uCEF4\uD30C\uC77C\uD560 \uC218 
\uC5C6\uC2B5\uB2C8\uB2E4: {0}
-ActionEval.LineNr.Label=\uC904 \uBC88\uD638: {0}
-ActionEval.Position.Label={0} \uD589  {1} \uC5F4
 ActionEval.Script.Default=\uC2A4\uD06C\uB9BD\uD2B8
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_nl_NL.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_nl_NL.properties
index 6d960ab939..01832a1aec 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_nl_NL.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_nl_NL.properties
@@ -21,7 +21,6 @@
 ActionEval.ActionName.Label=Naam van de action
 ActionEval.CouldNotCompile=Ik kon het opgegeven Java script niet compileren\: 
{0}
 ActionEval.ErrorEvaluating=Er deed zich een fout voor bij het evalueren van 
expressie in [{0}] \: {1}
-ActionEval.LineNr.Label=Rijnummer\: {0}
 ActionEval.Name.Default=Evaluatie
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript\: 
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_pt_BR.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_pt_BR.properties
index 3a9dbe53be..b36a6ec36b 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_pt_BR.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_pt_BR.properties
@@ -23,10 +23,8 @@ ActionEval.CouldNotCompile=N\u00E3o foi poss\u00EDvel 
compilar JavaScript {0}
 ActionEval.Description=Avalia o resultado da execu\u00E7\u00E3o de uma 
a\u00E7\u00E3o pr\u00E9via
 ActionEval.ErrorEvaluating=Ocorreu um erro avaliando express\u00E3o em [{0}]\: 
{1}
 ActionEval.keyword=avalia\u00E7\u00E3o
-ActionEval.LineNr.Label=Linha n\u00FAmero\: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=Avalia\u00E7\u00E3o
-ActionEval.Position.Label=Linha {0} Coluna {1}
 ActionEval.Script.Default=Script
 ActionEval.Script.Label=JavaScript: 
 ActionEval.Title=JavaScript
diff --git 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_zh_CN.properties
 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_zh_CN.properties
index 6b1266c5ce..093fede97f 100644
--- 
a/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_zh_CN.properties
+++ 
b/plugins/actions/eval/src/main/resources/org/apache/hop/workflow/actions/eval/messages/messages_zh_CN.properties
@@ -22,10 +22,8 @@ ActionEval.CouldNotCompile=\u4E0D\u80FD\u7F16\u8BD1 
javascript\: {0}
 ActionEval.Description=\u5728\u524D\u7F6E Action 
\u7684\u6267\u884C\u5B8C\u6210\u540E\u6267\u884C\u8BE5\u811A\u672C\u4E2D\u7684\u903B\u8F91
 ActionEval.ErrorEvaluating=\u5728 [{0}] 
\u91CC\u6709\u9519\u8BEF\u7684\u5224\u65AD\u6761\u4EF6\u8868\u8FBE\u5F0F \: {1}
 ActionEval.keyword=evaluation
-ActionEval.LineNr.Label=\u884C\u53F7\: {0}
 ActionEval.Name=JavaScript
 ActionEval.Name.Default=\u5224\u65AD\u6761\u4EF6
-ActionEval.Position.Label=\u884C {0} \u5217 {1}
 ActionEval.Script.Default=\u811A\u672C
 ActionEval.Script.Label=JavaScirpt \u811A\u672C\:
 ActionEval.Title=JavaScript

Reply via email to