diff --git a/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java b/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java index ddd1d1597b..e708aad499 100644 --- a/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java +++ b/plugins/actions/sql/src/main/java/org/apache/hop/workflow/actions/sql/ActionSqlDialog.java @@ -148,6 +148,7 @@ public IAction open() { // Connection line DatabaseMeta databaseMeta = workflowMeta.findDatabase(action.getConnection(), variables); wConnection = addConnectionLine(shell, wName, databaseMeta, null); + wConnection.addListener(SWT.Selection, e -> getSqlReservedWords()); // SQL from file? Label wlSqlFromFile = new Label(shell, SWT.RIGHT); @@ -309,6 +310,16 @@ public IAction open() { } private List getSqlReservedWords() { + // Do not search keywords when connection is empty + if (wConnection.getText() == null || wConnection.getText().isEmpty()) { + return new ArrayList<>(); + } + + // If connection is a variable that can't be resolved + if (variables.resolve(wConnection.getText()).startsWith("${")) { + return new ArrayList<>(); + } + DatabaseMeta databaseMeta = wConnection.loadSelectedElement(); if (databaseMeta == null) { diff --git a/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java b/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java index 0247f3e107..0894d40704 100644 --- a/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java +++ b/plugins/actions/waitforsql/src/main/java/org/apache/hop/workflow/actions/waitforsql/ActionWaitForSqlDialog.java @@ -182,6 +182,7 @@ public IAction open() { // Connection line DatabaseMeta databaseMeta = workflowMeta.findDatabase(action.getConnection(), variables); wConnection = addConnectionLine(shell, wName, databaseMeta, lsMod); + wConnection.addListener(SWT.Selection, e -> getSqlReservedWords()); // Schema name line wlSchemaname = new Label(shell, SWT.RIGHT); @@ -606,6 +607,16 @@ public void mouseUp(MouseEvent e) { } private List getSqlReservedWords() { + // Do not search keywords when connection is empty + if (wConnection.getText() == null || wConnection.getText().isEmpty()) { + return new ArrayList<>(); + } + + // If connection is a variable that can't be resolved + if (variables.resolve(wConnection.getText()).startsWith("${")) { + return new ArrayList<>(); + } + DatabaseMeta databaseMeta = wConnection.loadSelectedElement(); if (databaseMeta == null) { diff --git a/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinDialog.java b/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinDialog.java index 9ec8efa736..fde4804adb 100644 --- a/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinDialog.java +++ b/plugins/transforms/databasejoin/src/main/java/org/apache/hop/pipeline/transforms/databasejoin/DatabaseJoinDialog.java @@ -147,6 +147,7 @@ public String open() { // Connection line wConnection = addConnectionLine(shell, wTransformName, input.getConnection(), lsMod); + wConnection.addListener(SWT.Selection, e -> getSqlReservedWords()); // ICache? Label wlCache = new Label(shell, SWT.RIGHT); @@ -424,6 +425,17 @@ public void widgetSelected(SelectionEvent e) { } private List getSqlReservedWords() { + + // Do not search keywords when connection is empty + if (wConnection.getText() == null || wConnection.getText().isEmpty()) { + return new ArrayList<>(); + } + + // If connection is a variable that can't be resolved + if (variables.resolve(wConnection.getText()).startsWith("${")) { + return new ArrayList<>(); + } + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables); if (databaseMeta == null) { logError("Database connection not found. Proceding without keywords."); diff --git a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowDialog.java b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowDialog.java index 3b56af62dc..f5ada1e854 100644 --- a/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowDialog.java +++ b/plugins/transforms/dynamicsqlrow/src/main/java/org/apache/hop/pipeline/transforms/dynamicsqlrow/DynamicSqlRowDialog.java @@ -143,6 +143,7 @@ public String open() { wConnection.select(0); } wConnection.addModifyListener(lsMod); + wConnection.addListener(SWT.Selection, e -> getSqlReservedWords()); // SQLFieldName field Label wlSqlFieldName = new Label(shell, SWT.RIGHT); @@ -370,6 +371,16 @@ public void mouseUp(MouseEvent e) { } private List getSqlReservedWords() { + // Do not search keywords when connection is empty + if (wConnection.getText() == null || wConnection.getText().isEmpty()) { + return new ArrayList<>(); + } + + // If connection is a variable that can't be resolved + if (variables.resolve(wConnection.getText()).startsWith("${")) { + return new ArrayList<>(); + } + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables); if (databaseMeta == null) { logError("Database connection not found. Proceding without keywords."); diff --git a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlDialog.java b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlDialog.java index c4cb33cb5e..6cd5675927 100644 --- a/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlDialog.java +++ b/plugins/transforms/sql/src/main/java/org/apache/hop/pipeline/transforms/sql/ExecSqlDialog.java @@ -178,6 +178,7 @@ public void widgetSelected(SelectionEvent e) { // Connection line wConnection = addConnectionLine(shell, wTransformName, input.getConnection(), lsMod); wConnection.addSelectionListener(lsSelection); + wConnection.addListener(SWT.Selection, e -> getSqlReservedWords()); // Table line... Label wlSql = new Label(shell, SWT.LEFT); @@ -561,6 +562,16 @@ public void widgetSelected(SelectionEvent e) { } private List getSqlReservedWords() { + // Do not search keywords when connection is empty + if (wConnection.getText() == null || wConnection.getText().isEmpty()) { + return new ArrayList<>(); + } + + // If connection is a variable that can't be resolved + if (variables.resolve(wConnection.getText()).startsWith("${")) { + return new ArrayList<>(); + } + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables); if (databaseMeta == null) { logError("Database connection not found. Proceding without keywords."); diff --git a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java index c9507d22b8..d2d1276b88 100644 --- a/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java +++ b/plugins/transforms/tableinput/src/main/java/org/apache/hop/pipeline/transforms/tableinput/TableInputDialog.java @@ -106,10 +106,7 @@ public String open() { PropsUi.setLook(shell); setShellImage(shell, input); - ModifyListener lsMod = - e -> { - input.setChanged(); - }; + ModifyListener lsMod = e -> input.setChanged(); changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); @@ -142,6 +139,7 @@ public String open() { wTransformName.setLayoutData(fdTransformName); wConnection = addConnectionLine(shell, wTransformName, input.getConnection(), lsMod); + wConnection.addListener(SWT.Selection, e -> getSqlReservedWords()); // Some buttons wOk = new Button(shell, SWT.PUSH); @@ -357,6 +355,16 @@ public void mouseUp(MouseEvent e) { } private List getSqlReservedWords() { + // Do not search keywords when connection is empty + if (input.getConnection() == null || input.getConnection().isEmpty()) { + return new ArrayList<>(); + } + + // If connection is a variable that can't be resolved + if (variables.resolve(input.getConnection()).startsWith("${")) { + return new ArrayList<>(); + } + DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables); if (databaseMeta == null) { logError("Database connection not found. Proceding without keywords."); diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/ConditionEditor.java b/ui/src/main/java/org/apache/hop/ui/core/widget/ConditionEditor.java index c9c082d888..f7b3f8e63f 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/widget/ConditionEditor.java +++ b/ui/src/main/java/org/apache/hop/ui/core/widget/ConditionEditor.java @@ -193,7 +193,7 @@ public ConditionEditor(Composite composite, int arg1, Condition co, IRowMeta inp white = GuiResource.getInstance().getColorWhite(); black = GuiResource.getInstance().getColorBlack(); red = GuiResource.getInstance().getColorRed(); - green = GuiResource.getInstance().getColorGreen(); + green = GuiResource.getInstance().getColorDarkGreen(); blue = GuiResource.getInstance().getColorBlue(); gray = GuiResource.getInstance().getColorDarkGray(); diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/GenericCodeHighlight.java b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/GenericCodeHighlight.java index 8768d5d812..231739933e 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/GenericCodeHighlight.java +++ b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/GenericCodeHighlight.java @@ -91,7 +91,7 @@ void initializeColors() { new Color[] { guiResource.getColorBlack(), guiResource.getColorRed(), - guiResource.getColorGreen(), + guiResource.getColorDarkGreen(), guiResource.getColorBlue(), guiResource.getColorOrange() }; diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaHighlight.java b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaHighlight.java index fa9a51e6dd..fef00d1339 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaHighlight.java +++ b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaHighlight.java @@ -86,7 +86,7 @@ void initializeColors() { new Color[] { GuiResource.getInstance().getColorBlack(), // black GuiResource.getInstance().getColorRed(), // red - GuiResource.getInstance().getColorGreen(), // green + GuiResource.getInstance().getColorDarkGreen(), // green GuiResource.getInstance().getColorBlue(), // blue GuiResource.getInstance().getColorOrange() // orange }; diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaScriptHighlight.java b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaScriptHighlight.java index 5f38fbaee3..0252ca3a6d 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaScriptHighlight.java +++ b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/JavaScriptHighlight.java @@ -94,7 +94,7 @@ void initializeColors() { new Color[] { guiResource.getColorBlack(), guiResource.getColorRed(), - guiResource.getColorGreen(), + guiResource.getColorDarkGreen(), guiResource.getColorBlue(), guiResource.getColorOrange() }; diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/SQLValuesHighlight.java b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/SQLValuesHighlight.java index 95bcb5cdde..581be8fc07 100644 --- a/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/SQLValuesHighlight.java +++ b/ui/src/main/java/org/apache/hop/ui/core/widget/highlight/SQLValuesHighlight.java @@ -102,7 +102,7 @@ void initializeColors() { new Color[] { GuiResource.getInstance().getColorBlack(), // black GuiResource.getInstance().getColorRed(), // red - GuiResource.getInstance().getColorGreen(), // green + GuiResource.getInstance().getColorDarkGreen(), // green GuiResource.getInstance().getColorBlue(), // blue GuiResource.getInstance().getColorMagenta() // SQL Functions / Rose };