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 2021/06/15 13:50:17 UTC
[incubator-hop] branch master updated: HOP-2948 : Remove Eclipse
JFace dependency
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/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new 70029c5 HOP-2948 : Remove Eclipse JFace dependency
new 830f90b Merge pull request #871 from mattcasters/master
70029c5 is described below
commit 70029c5b21efd020dd6637ef5230d2e82676170f
Author: Matt Casters <ma...@gmail.com>
AuthorDate: Tue Jun 15 15:31:53 2021 +0200
HOP-2948 : Remove Eclipse JFace dependency
---
assemblies/client/pom.xml | 12 -
assemblies/client/src/assembly/assembly.xml | 2 -
assemblies/web/pom.xml | 6 -
.../cassandraoutput/CassandraOutputDialog.java | 26 +-
.../SSTableOutputDialog.java | 25 +-
.../neo4j/transforms/output/Neo4JOutputDialog.java | 13 +-
.../insertupdate/InsertUpdateDialog.java | 30 +-
.../monetdbbulkloader/MonetDbBulkLoaderDialog.java | 10 +-
.../pgbulkloader/PGBulkLoaderDialog.java | 33 +-
.../salesforceinsert/SalesforceInsertDialog.java | 11 +-
.../salesforceupdate/SalesforceUpdateDialog.java | 11 +-
.../salesforceupsert/SalesforceUpsertDialog.java | 15 +-
.../selectvalues/SelectValuesDialog.java | 54 +-
.../SynchronizeAfterMergeDialog.java | 12 +-
.../transforms/tableoutput/TableOutputDialog.java | 25 +-
.../transforms/fileinput/TextFileImportWizard.java | 150 -----
.../fileinput/TextFileImportWizardPage1.java | 117 ----
.../fileinput/TextFileImportWizardPage2.java | 698 ---------------------
.../transforms/fileinput/TextFileInputDialog.java | 115 +---
.../fileinput/text/TextFileImportWizard.java | 149 -----
.../fileinput/text/TextFileImportWizardPage1.java | 113 ----
.../fileinput/text/TextFileImportWizardPage2.java | 694 --------------------
.../fileinput/text/TextFileInputDialog.java | 111 +---
.../tokenreplacement/TokenReplacementDialog.java | 103 +--
pom.xml | 1 -
rap/pom.xml | 6 -
rcp/pom.xml | 13 -
ui/pom.xml | 12 -
.../org/apache/hop/ui/core/dialog/BaseDialog.java | 13 +
.../apache/hop/ui/core/dialog/DetailsDialog.java | 106 ++--
.../hop/ui/core/dialog/DialogBoxWithButtons.java | 121 ++++
.../hop/ui/core/dialog/ErrorWithDetailsDialog.java | 78 ---
.../org/apache/hop/ui/core/widget/CheckBoxVar.java | 121 ++--
.../apache/hop/ui/core/widget/StyledTextComp.java | 80 ++-
.../org/apache/hop/ui/core/widget/TableDraw.java | 538 ----------------
.../org/apache/hop/ui/core/widget/TextVar.java | 17 +-
.../apache/hop/ui/core/widget/TextVarButton.java | 90 +--
.../hop/ui/core/widget/warning/TextVarWarning.java | 192 ------
.../hop/ui/core/widget/warning/WarningText.java | 191 ------
.../ui/pipeline/transform/BaseTransformDialog.java | 27 +-
40 files changed, 548 insertions(+), 3593 deletions(-)
diff --git a/assemblies/client/pom.xml b/assemblies/client/pom.xml
index 526176b..07fd00a 100644
--- a/assemblies/client/pom.xml
+++ b/assemblies/client/pom.xml
@@ -14,7 +14,6 @@
~ 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.
- ~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -232,17 +231,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.jface</artifactId>
- <version>${org.eclipse.jface.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
</project>
diff --git a/assemblies/client/src/assembly/assembly.xml b/assemblies/client/src/assembly/assembly.xml
index 42bf94e..130d579 100644
--- a/assemblies/client/src/assembly/assembly.xml
+++ b/assemblies/client/src/assembly/assembly.xml
@@ -13,7 +13,6 @@
~ 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.
- ~
-->
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -75,7 +74,6 @@
</dependencySet>
<dependencySet>
<includes>
- <include>org.eclipse.platform:org.eclipse.jface</include>
<include>org.apache.hop:hop-ui-rcp</include>
<include>org.eclipse.jetty:*</include>
<include>javax.servlet:javax.servlet-api</include>
diff --git a/assemblies/web/pom.xml b/assemblies/web/pom.xml
index d31672a..e623e12 100644
--- a/assemblies/web/pom.xml
+++ b/assemblies/web/pom.xml
@@ -14,7 +14,6 @@
~ 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.
- ~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -105,11 +104,6 @@
</dependency>
<dependency>
<groupId>org.eclipse.rap</groupId>
- <artifactId>org.eclipse.rap.jface</artifactId>
- <version>${rap.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.rap</groupId>
<artifactId>org.eclipse.rap.fileupload</artifactId>
<version>${rap.version}</version>
</dependency>
diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java
index 28c82b3..44b0f51 100644
--- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java
+++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandraoutput/CassandraOutputDialog.java
@@ -41,19 +41,15 @@ import org.apache.hop.ui.core.dialog.ShowMessageDialog;
import org.apache.hop.ui.core.widget.MetaSelectionLine;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@@ -672,16 +668,17 @@ public class CassandraOutputDialog extends BaseTransformDialog implements ITrans
protected void showEnterSelectionDialog() {
TransformMeta transformMeta = pipelineMeta.findTransform(transformName);
- String[] choices = null;
+ String[] choices;
if (transformMeta != null) {
try {
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
if (row.size() == 0) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
@@ -732,10 +729,11 @@ public class CassandraOutputDialog extends BaseTransformDialog implements ITrans
wKeyField.setText(newSelection.toString());
}
} catch (HopException ex) {
- MessageDialog.openError(
+ new ErrorDialog(
shell,
BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"),
+ ex);
}
}
}
@@ -750,18 +748,20 @@ public class CassandraOutputDialog extends BaseTransformDialog implements ITrans
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
if (row.size() == 0) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
} catch (HopException ex) {
- MessageDialog.openError(
+ new ErrorDialog(
shell,
BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"),
+ ex);
}
}
}
diff --git a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputDialog.java b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputDialog.java
index 59c03e4..ab4626f 100644
--- a/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputDialog.java
+++ b/plugins/tech/cassandra/src/main/java/org/apache/hop/pipeline/transforms/cassandrasstableoutput/SSTableOutputDialog.java
@@ -29,21 +29,18 @@ import org.apache.hop.pipeline.transform.ITransformDialog;
import org.apache.hop.pipeline.transform.TransformMeta;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
+import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
@@ -348,10 +345,11 @@ public class SSTableOutputDialog extends BaseTransformDialog implements ITransfo
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
if (row.size() == 0) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
@@ -362,10 +360,11 @@ public class SSTableOutputDialog extends BaseTransformDialog implements ITransfo
wKeyField.add(vm.getName());
}
} catch (HopException ex) {
- MessageDialog.openError(
+ new ErrorDialog(
shell,
BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields"),
+ ex);
}
}
}
@@ -431,10 +430,11 @@ public class SSTableOutputDialog extends BaseTransformDialog implements ITransfo
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
if (row.size() == 0) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "SSTableOutputData.Message.NoIncomingFields"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
@@ -487,10 +487,11 @@ public class SSTableOutputDialog extends BaseTransformDialog implements ITransfo
wKeyField.setText(newSelection.toString());
}
} catch (HopException ex) {
- MessageDialog.openError(
+ new ErrorDialog(
shell,
BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields.Title"),
- BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"));
+ BaseMessages.getString(PKG, "CassandraOutputData.Message.NoIncomingFields"),
+ ex);
}
}
}
diff --git a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputDialog.java b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputDialog.java
index cec129f..5e793da 100755
--- a/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputDialog.java
+++ b/plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/transforms/output/Neo4JOutputDialog.java
@@ -36,6 +36,7 @@ import org.apache.hop.pipeline.transform.ITransformDialog;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
+import org.apache.hop.ui.core.dialog.MessageDialogWithToggle;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.MetaSelectionLine;
@@ -43,16 +44,12 @@ import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
@@ -60,7 +57,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
@@ -1030,16 +1026,13 @@ public class Neo4JOutputDialog extends BaseTransformDialog implements ITransform
new MessageDialogWithToggle(
shell,
BaseMessages.getString(PKG, "Neo4JOutputDialog.DynamicLabelsWarning.DialogTitle"),
- null,
- message.toString() + Const.CR,
- MessageDialog.WARNING,
+ message + Const.CR,
+ SWT.ICON_WARNING,
new String[] {
BaseMessages.getString(PKG, "Neo4JOutputDialog.DynamicLabelsWarning.Understood")
},
- 0,
BaseMessages.getString(PKG, "Neo4JOutputDialog.DynamicLabelsWarning.HideNextTime"),
"N".equalsIgnoreCase(props.getCustomParameter(STRING_DYNAMIC_LABELS_WARNING, "Y")));
- MessageDialogWithToggle.setDefaultImage(GuiResource.getInstance().getImageHopUi());
md.open();
props.setCustomParameter(STRING_DYNAMIC_LABELS_WARNING, md.getToggleState() ? "N" : "Y");
}
diff --git a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java
index 48a5e96..86453ab 100644
--- a/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java
+++ b/plugins/transforms/insertupdate/src/main/java/org/apache/hop/pipeline/transforms/insertupdate/InsertUpdateDialog.java
@@ -41,7 +41,6 @@ import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.EnterMappingDialog;
import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
-import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.MetaSelectionLine;
import org.apache.hop.ui.core.widget.TableView;
@@ -49,16 +48,26 @@ import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ComponentSelectionListener;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
-
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.*;
+import java.util.Map;
+import java.util.Set;
public class InsertUpdateDialog extends BaseTransformDialog implements ITransformDialog {
private static final Class<?> PKG = InsertUpdateMeta.class; // For Translator
@@ -571,12 +580,13 @@ public class InsertUpdateDialog extends BaseTransformDialog implements ITransfor
message +=
BaseMessages.getString(PKG, "InsertUpdateDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- boolean goOn =
- MessageDialog.openConfirm(
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "InsertUpdateDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
+ boolean goOn = (answer & SWT.OK) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java b/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java
index 5f9b29d..6b7f72a 100644
--- a/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java
+++ b/plugins/transforms/monetdbbulkloader/src/main/java/org/apache/hop/pipeline/transforms/monetdbbulkloader/MonetDbBulkLoaderDialog.java
@@ -43,7 +43,6 @@ import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
@@ -1110,13 +1109,14 @@ public class MonetDbBulkLoaderDialog extends BaseTransformDialog implements ITra
BaseMessages.getString(
PKG, "MonetDBBulkLoaderDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- boolean goOn =
- MessageDialog.openConfirm(
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(
PKG, "MonetDBBulkLoaderDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
+ boolean goOn = (answer & SWT.OK) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java
index 91d5eac..a6fd0da 100644
--- a/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java
+++ b/plugins/transforms/pgbulkloader/src/main/java/org/apache/hop/pipeline/transforms/pgbulkloader/PGBulkLoaderDialog.java
@@ -40,24 +40,35 @@ import org.apache.hop.ui.core.database.dialog.SqlEditor;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.EnterMappingDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
-import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.MetaSelectionLine;
import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
-
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.*;
+import java.util.Map;
+import java.util.Set;
public class PGBulkLoaderDialog extends BaseTransformDialog implements ITransformDialog {
private static final Class<?> PKG = PGBulkLoaderMeta.class; // For Translator
@@ -621,12 +632,14 @@ public class PGBulkLoaderDialog extends BaseTransformDialog implements ITransfor
message +=
BaseMessages.getString(PKG, "PGBulkLoaderDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- boolean goOn =
- MessageDialog.openConfirm(
+
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "PGBulkLoaderDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
+ boolean goOn = (answer & SWT.OK) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java
index 830003f..28a4dcf 100644
--- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java
+++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceinsert/SalesforceInsertDialog.java
@@ -49,7 +49,6 @@ import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ComponentSelectionListener;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
@@ -902,13 +901,15 @@ public class SalesforceInsertDialog extends SalesforceTransformDialog {
message +=
BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHop());
- boolean goOn =
- MessageDialog.openConfirm(
+
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(
PKG, "SalesforceInsertDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
+ boolean goOn = (answer & SWT.OK) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java
index 2f32b77..3eecfa1 100644
--- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java
+++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupdate/SalesforceUpdateDialog.java
@@ -46,7 +46,6 @@ import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ComponentSelectionListener;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
@@ -832,13 +831,15 @@ public class SalesforceUpdateDialog extends SalesforceTransformDialog {
message +=
BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHop());
- boolean goOn =
- MessageDialog.openConfirm(
+
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(
PKG, "SalesforceUpdateDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
+ boolean goOn = (answer & SWT.OK) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java
index 49a3743..823b658 100644
--- a/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java
+++ b/plugins/transforms/salesforce/src/main/java/org/apache/hop/pipeline/transforms/salesforceupsert/SalesforceUpsertDialog.java
@@ -46,19 +46,15 @@ import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ComponentSelectionListener;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
@@ -66,10 +62,8 @@ import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
@@ -963,13 +957,14 @@ public class SalesforceUpsertDialog extends SalesforceTransformDialog {
message +=
BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHop());
- boolean goOn =
- MessageDialog.openConfirm(
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(
PKG, "SalesforceUpsertDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
+ boolean goOn = (answer & SWT.OK) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java
index dbed0dc..acafb8d 100644
--- a/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java
+++ b/plugins/transforms/selectvalues/src/main/java/org/apache/hop/pipeline/transforms/selectvalues/SelectValuesDialog.java
@@ -27,6 +27,7 @@ import org.apache.hop.core.row.RowMeta;
import org.apache.hop.core.row.value.ValueMetaFactory;
import org.apache.hop.core.util.EnvUtil;
import org.apache.hop.core.util.Utils;
+import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
@@ -36,24 +37,34 @@ import org.apache.hop.pipeline.transform.TransformMeta;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.EnterMappingDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
-import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
-import java.util.*;
-import org.apache.hop.core.variables.IVariables;
+import java.util.Map;
+import java.util.Set;
public class SelectValuesDialog extends BaseTransformDialog implements ITransformDialog {
private static final Class<?> PKG = SelectValuesMeta.class; // For Translator
@@ -799,10 +810,11 @@ public class SelectValuesDialog extends BaseTransformDialog implements ITransfor
*/
private void generateMappings() {
if (!bPreviousFieldsLoaded) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SelectValuesDialog.ColumnInfo.Loading"),
- BaseMessages.getString(PKG, "SelectValuesDialog.ColumnInfo.Loading"));
+ BaseMessages.getString(PKG, "SelectValuesDialog.ColumnInfo.Loading"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
if ((wRemove.getItemCount() > 0) || (wMeta.getItemCount() > 0)) {
@@ -810,10 +822,11 @@ public class SelectValuesDialog extends BaseTransformDialog implements ITransfor
String[] columns = wRemove.getItem(i);
for (String column : columns) {
if (column.length() > 0) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoDeletOrMetaTitle"),
- BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoDeletOrMeta"));
+ BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoDeletOrMeta"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
}
@@ -822,10 +835,11 @@ public class SelectValuesDialog extends BaseTransformDialog implements ITransfor
String[] columns = wMeta.getItem(i);
for (String col : columns) {
if (col.length() > 0) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoDeletOrMetaTitle"),
- BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoDeletOrMeta"));
+ BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoDeletOrMeta"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
}
@@ -837,10 +851,11 @@ public class SelectValuesDialog extends BaseTransformDialog implements ITransfor
TransformMeta transformMeta = new TransformMeta(transformName, input);
List<TransformMeta> nextTransforms = pipelineMeta.findNextTransforms(transformMeta);
if (nextTransforms.size() == 0 || nextTransforms.size() > 1) {
- MessageDialog.openError(
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoNextTransformTitle"),
- BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoNextTransform"));
+ BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.NoNextTransform"),
+ SWT.ICON_ERROR | SWT.OK);
return;
}
TransformMeta outputTransformMeta = nextTransforms.get(0);
@@ -893,15 +908,14 @@ public class SelectValuesDialog extends BaseTransformDialog implements ITransfor
}
// show a confirm dialog if some misconfiguration was found
if (missingFields.length() > 0) {
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- boolean goOn =
- MessageDialog.openConfirm(
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "SelectValuesDialog.DoMapping.SomeFieldsNotFoundTitle"),
BaseMessages.getString(
- PKG,
- "SelectValuesDialog.DoMapping.SomeFieldsNotFound",
- missingFields.toString()));
+ PKG, "SelectValuesDialog.DoMapping.SomeFieldsNotFound", missingFields.toString()),
+ SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+ boolean goOn = (answer & SWT.YES) != 0;
if (!goOn) {
return;
}
diff --git a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java
index ce4ba65..beeb249 100644
--- a/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java
+++ b/plugins/transforms/synchronizeaftermerge/src/main/java/org/apache/hop/pipeline/transforms/synchronizeaftermerge/SynchronizeAfterMergeDialog.java
@@ -44,7 +44,6 @@ import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
@@ -847,13 +846,16 @@ public class SynchronizeAfterMergeDialog extends BaseTransformDialog implements
BaseMessages.getString(
PKG, "SynchronizeAfterMergeDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- boolean goOn =
- MessageDialog.openConfirm(
+
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(
PKG, "SynchronizeAfterMergeDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+ boolean goOn = (answer & SWT.YES) != 0;
+
if (!goOn) {
return;
}
diff --git a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java
index ff17e66..17ce040 100644
--- a/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java
+++ b/plugins/transforms/tableoutput/src/main/java/org/apache/hop/pipeline/transforms/tableoutput/TableOutputDialog.java
@@ -46,14 +46,12 @@ import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.EnterMappingDialog;
import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
-import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.ComboVar;
import org.apache.hop.ui.core.widget.MetaSelectionLine;
import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
@@ -69,7 +67,6 @@ import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
@@ -928,12 +925,13 @@ public class TableOutputDialog extends BaseTransformDialog implements ITransform
message +=
BaseMessages.getString(PKG, "TableOutputDialog.DoMapping.SomeFieldsNotFoundContinue")
+ Const.CR;
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- boolean goOn =
- MessageDialog.openConfirm(
+ int answer =
+ BaseDialog.openMessageBox(
shell,
BaseMessages.getString(PKG, "TableOutputDialog.DoMapping.SomeFieldsNotFoundTitle"),
- message);
+ message,
+ SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+ boolean goOn = (answer & SWT.YES) != 0;
if (!goOn) {
return;
}
@@ -1028,18 +1026,7 @@ public class TableOutputDialog extends BaseTransformDialog implements ITransform
protected void showUnsupportedConnectionMessageBox(IDatabase dbi) {
String title = BaseMessages.getString(PKG, "TableOutput.UnsupportedConnection.DialogTitle");
String message = dbi.getUnsupportedTableOutputMessage();
- String close = BaseMessages.getString(PKG, "System.Button.Close");
-
- MessageDialog dialog =
- new MessageDialog(
- shell,
- title,
- GuiResource.getInstance().getImageHopUi(),
- message,
- SWT.ICON_WARNING,
- new String[] {close},
- 0);
- dialog.open();
+ BaseDialog.openMessageBox(shell, title, message, SWT.ICON_WARNING | SWT.OK);
}
private void setTableFieldCombo() {
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizard.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizard.java
deleted file mode 100644
index 80abe8e..0000000
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizard.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.pipeline.transforms.fileinput;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-
-/*
- * Created on 17-apr-04
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-
-/**
- * @author Matt
- * <p>
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- * @deprecated replaced by implementation in the ...transforms.fileinput.text package
- */
-public class TextFileImportWizard implements IWizard {
- public TextFileImportWizard() {
- super();
- }
-
- // Adds any last-minute pages to this wizard.
- public void addPages() {
- }
-
- // Returns whether this wizard could be finished without further user interaction.
- public boolean canFinish() {
- return false;
- }
-
- // Creates this wizard's controls in the given parent control.
- public void createPageControls( Composite pageContainer ) {
- }
-
- // Disposes of this wizard and frees all SWT resources.
- public void dispose() {
- }
-
- // Returns the container of this wizard.
- public IWizardContainer getContainer() {
- return null;
- }
-
- // Returns the default page image for this wizard.
- public Image getDefaultPageImage() {
- return null;
- }
-
- // Returns the dialog settings for this wizard.
- public IDialogSettings getDialogSettings() {
- return null;
- }
-
- // Returns the successor of the given page.
- public IWizardPage getNextPage( IWizardPage page ) {
- return null;
- }
-
- // Returns the wizard page with the given name belonging to this wizard.
- public IWizardPage getPage( String pageName ) {
- return null;
- }
-
- // Returns the number of pages in this wizard.
- public int getPageCount() {
- return 3;
- }
-
- // Returns all the pages in this wizard.
- public IWizardPage[] getPages() {
- return null;
- }
-
- // Returns the predecessor of the given page.
- public IWizardPage getPreviousPage( IWizardPage page ) {
- return null;
- }
-
- // Returns the first page to be shown in this wizard.
- public IWizardPage getStartingPage() {
- return null;
- }
-
- // Returns the title bar color for this wizard.
- public RGB getTitleBarColor() {
- return null;
- }
-
- // Returns the window title string for this wizard.
- public String getWindowTitle() {
- return "WindowTitle";
- }
-
- // Returns whether help is available for this wizard.
- public boolean isHelpAvailable() {
- return false;
- }
-
- // Returns whether this wizard needs Previous and Next buttons.
- public boolean needsPreviousAndNextButtons() {
- return true;
- }
-
- // Returns whether this wizard needs a progress monitor.
- public boolean needsProgressMonitor() {
- return false;
- }
-
- // Performs any actions appropriate in response to the user having pressed the Cancel button, or refuse if canceling
- // now is not permitted.
- public boolean performCancel() {
- return false;
- }
-
- // Performs any actions appropriate in response to the user having pressed the Finish button, or refuse if finishing
- // now is not permitted.
- public boolean performFinish() {
- return false;
- }
-
- // Sets or clears the container of this wizard.
- public void setContainer( IWizardContainer wizardContainer ) {
- }
-
-}
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizardPage1.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizardPage1.java
deleted file mode 100644
index e385cb1..0000000
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizardPage1.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.pipeline.transforms.fileinput;
-
-import org.apache.hop.core.Const;
-import org.apache.hop.core.gui.ITextFileInputField;
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.ui.core.PropsUi;
-import org.apache.hop.ui.core.widget.TableDraw;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-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 java.util.List;
-import java.util.Vector;
-
-/**
- * @deprecated replaced by implementation in the ...transforms.fileinput.text package
- */
-public class TextFileImportWizardPage1 extends WizardPage { // implements Listener
-
- private static final Class<?> PKG = TextFileInputMeta.class; // For Translator
-
- private TableDraw wTable;
- private FormData fdTable;
-
- private PropsUi props;
- private List<String> rows;
- private Vector<ITextFileInputField> fields;
-
- public TextFileImportWizardPage1( String arg, PropsUi props, List<String> rows,
- Vector<ITextFileInputField> fields ) {
- super( arg );
- this.props = props;
- this.rows = rows;
- this.fields = fields;
-
- setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage1.DialogTitle" ) );
- setDescription( BaseMessages.getString( PKG, "TextFileImportWizardPage1.DialogMessage" ) );
- }
-
- public void createControl( Composite parent ) {
- // create the composite to hold the widgets
- Composite composite = new Composite( parent, SWT.NONE );
- props.setLook( composite );
-
- FormLayout compLayout = new FormLayout();
- compLayout.marginHeight = Const.FORM_MARGIN;
- compLayout.marginWidth = Const.FORM_MARGIN;
- composite.setLayout( compLayout );
-
- MouseAdapter lsMouse = new MouseAdapter() {
- public void mouseDown( MouseEvent e ) {
- int s = getSize();
- setPageComplete( s > 0 );
- }
- };
-
- wTable = new TableDraw( composite, props, this, fields );
- wTable.setRows( rows );
- props.setLook( wTable );
- wTable.setFields( fields );
- fdTable = new FormData();
- fdTable.left = new FormAttachment( 0, 0 );
- fdTable.right = new FormAttachment( 100, 0 );
- fdTable.top = new FormAttachment( 0, 0 );
- fdTable.bottom = new FormAttachment( 100, 0 );
- wTable.setLayoutData( fdTable );
- wTable.addMouseListener( lsMouse );
-
- // set the composite as the control for this page
- setControl( composite );
- }
-
- public void setFields( Vector<ITextFileInputField> fields ) {
- wTable.setFields( fields );
- }
-
- public Vector<ITextFileInputField> getFields() {
- return wTable.getFields();
- }
-
- public boolean canFlipToNextPage() {
- int size = getSize();
- if ( size > 0 ) {
- setErrorMessage( null );
- return true;
- } else {
- setErrorMessage( BaseMessages.getString( PKG, "TextFileImportWizardPage1.ErrorMarkerNeeded" ) );
- return false;
- }
- }
-
- public int getSize() {
- return wTable.getFields().size();
- }
-}
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizardPage2.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizardPage2.java
deleted file mode 100644
index 7a75a45..0000000
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileImportWizardPage2.java
+++ /dev/null
@@ -1,698 +0,0 @@
-/*
- * 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.pipeline.transforms.fileinput;
-
-import org.apache.hop.core.Const;
-import org.apache.hop.core.Props;
-import org.apache.hop.core.file.TextFileInputField;
-import org.apache.hop.core.gui.ITextFileInputField;
-import org.apache.hop.core.row.value.ValueMetaFactory;
-import org.apache.hop.core.row.value.ValueMetaString;
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.ui.core.PropsUi;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import java.util.Vector;
-
-/**
- * @deprecated replaced by implementation in the ...transforms.fileinput.text package
- */
-public class TextFileImportWizardPage2 extends WizardPage {
- private static final Class<?> PKG = TextFileInputMeta.class; // For Translator
-
- private List wFields;
- private FormData fdFields;
-
- private List wSamples;
- private FormData fdSamples;
-
- private Label wlFieldname;
- private Text wFieldname;
- private FormData fdlFieldname, fdFieldname;
-
- private Label wlPosition;
- private Text wPosition;
- private FormData fdlPosition, fdPosition;
-
- private Label wlLength;
- private Text wLength;
- private FormData fdlLength, fdLength;
-
- private Label wlFieldtype;
- private CCombo wFieldtype;
- private FormData fdlFieldtype, fdFieldtype;
-
- private Label wlFormat;
- private Text wFormat;
- private FormData fdlFormat, fdFormat;
-
- private Label wlTrimtype;
- private CCombo wTrimtype;
- private FormData fdlTrimtype, fdTrimtype;
-
- private Label wlPrecision;
- private Text wPrecision;
- private FormData fdlPrecision, fdPrecision;
-
- private Label wlDecimal;
- private Text wDecimal;
- private FormData fdlDecimal, fdDecimal;
-
- private Label wlGroup;
- private Text wGroup;
- private FormData fdlGroup, fdGroup;
-
- private Label wlCurrency;
- private Text wCurrency;
- private FormData fdlCurrency, fdCurrency;
-
- private Label wlIgnore;
- private Button wIgnore;
- private FormData fdlIgnore, fdIgnore;
-
- private Label wlRepeat;
- private Button wRepeat;
- private FormData fdlRepeat, fdRepeat;
-
- private Label wlNull;
- private Text wNull;
- private FormData fdlNull, fdNull;
-
- private Button wGuess, wGuessAll;
- private FormData fdGuess, fdGuessAll;
-
- private Button wPrev, wNext;
- private FormData fdPrev, fdNext;
-
- private PropsUi props;
- private java.util.List<String> rows;
- private Vector<ITextFileInputField> fields;
-
- private Shell shell;
-
- public TextFileImportWizardPage2( String arg, PropsUi props, java.util.List<String> rows,
- Vector<ITextFileInputField> fields ) {
- super( arg );
- this.props = props;
- this.rows = rows;
- this.fields = fields;
-
- setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage2.DialogTitle" ) );
- setDescription( "Give a name to the fields in this text file" );
- }
-
- public void createControl( Composite parent ) {
- shell = parent.getShell();
-
- int margin = props.getMargin();
- int left = props.getMiddlePct() / 2;
- int middle = props.getMiddlePct();
- int right = middle + left;
-
- // create the composite to hold the widgets
- Composite composite = new Composite( parent, SWT.NONE );
- props.setLook( composite );
-
- FormLayout compLayout = new FormLayout();
- compLayout.marginHeight = Const.FORM_MARGIN;
- compLayout.marginWidth = Const.FORM_MARGIN;
- composite.setLayout( compLayout );
-
- wFields = new List( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wFields );
- fdFields = new FormData();
- fdFields.top = new FormAttachment( 0, 0 );
- fdFields.left = new FormAttachment( 0, 0 );
- fdFields.right = new FormAttachment( left, 0 );
- fdFields.bottom = new FormAttachment( 100, 0 );
- wFields.setLayoutData( fdFields );
-
- refreshFields();
-
- // Fieldname line
- wlFieldname = new Label( composite, SWT.RIGHT );
- wlFieldname.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Fieldname.Label" ) );
- props.setLook( wlFieldname );
- fdlFieldname = new FormData();
- fdlFieldname.left = new FormAttachment( wFields, 0 );
- fdlFieldname.top = new FormAttachment( 0, 0 );
- fdlFieldname.right = new FormAttachment( middle, 0 );
- wlFieldname.setLayoutData( fdlFieldname );
- wFieldname = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wFieldname );
- fdFieldname = new FormData();
- fdFieldname.left = new FormAttachment( middle, margin );
- fdFieldname.right = new FormAttachment( right, 0 );
- fdFieldname.top = new FormAttachment( 0, 0 );
- wFieldname.setLayoutData( fdFieldname );
-
- // Position line
- wlPosition = new Label( composite, SWT.RIGHT );
- wlPosition.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldPosition.Label" ) );
- props.setLook( wlPosition );
- fdlPosition = new FormData();
- fdlPosition.left = new FormAttachment( wFields, 0 );
- fdlPosition.top = new FormAttachment( wFieldname, margin );
- fdlPosition.right = new FormAttachment( middle, 0 );
- wlPosition.setLayoutData( fdlPosition );
- wPosition = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wPosition );
- fdPosition = new FormData();
- fdPosition.left = new FormAttachment( middle, margin );
- fdPosition.top = new FormAttachment( wFieldname, margin );
- fdPosition.right = new FormAttachment( right, 0 );
- wPosition.setLayoutData( fdPosition );
- wPosition.setEnabled( false );
-
- // Topos line
- wlLength = new Label( composite, SWT.RIGHT );
- wlLength.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldLength.Label" ) );
- props.setLook( wlLength );
- fdlLength = new FormData();
- fdlLength.left = new FormAttachment( wFields, 0 );
- fdlLength.top = new FormAttachment( wPosition, margin );
- fdlLength.right = new FormAttachment( middle, 0 );
- wlLength.setLayoutData( fdlLength );
- wLength = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wLength );
- fdLength = new FormData();
- fdLength.left = new FormAttachment( middle, margin );
- fdLength.top = new FormAttachment( wPosition, margin );
- fdLength.right = new FormAttachment( right, 0 );
- wLength.setLayoutData( fdLength );
- wLength.setEnabled( false );
-
- // Fieldtype line
- wlFieldtype = new Label( composite, SWT.RIGHT );
- wlFieldtype.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldType.Label" ) );
- props.setLook( wlFieldtype );
- fdlFieldtype = new FormData();
- fdlFieldtype.left = new FormAttachment( wFields, 0 );
- fdlFieldtype.top = new FormAttachment( wLength, margin );
- fdlFieldtype.right = new FormAttachment( middle, 0 );
- wlFieldtype.setLayoutData( fdlFieldtype );
- wFieldtype = new CCombo( composite, SWT.BORDER | SWT.READ_ONLY );
- props.setLook( wFieldtype );
- for ( int i = 0; i < ValueMetaFactory.getValueMetaNames().length; i++ ) {
- wFieldtype.add( ValueMetaFactory.getValueMetaNames()[ i ] );
- }
- fdFieldtype = new FormData();
- fdFieldtype.left = new FormAttachment( middle, margin );
- fdFieldtype.top = new FormAttachment( wLength, margin );
- fdFieldtype.right = new FormAttachment( right, 0 );
- wFieldtype.setLayoutData( fdFieldtype );
-
- // Format line
- wlFormat = new Label( composite, SWT.RIGHT );
- wlFormat.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldFormatter.Label" ) );
- props.setLook( wlFormat );
- fdlFormat = new FormData();
- fdlFormat.left = new FormAttachment( wFields, 0 );
- fdlFormat.top = new FormAttachment( wFieldtype, margin );
- fdlFormat.right = new FormAttachment( middle, 0 );
- wlFormat.setLayoutData( fdlFormat );
- wFormat = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wFormat );
- fdFormat = new FormData();
- fdFormat.left = new FormAttachment( middle, margin );
- fdFormat.top = new FormAttachment( wFieldtype, margin );
- fdFormat.right = new FormAttachment( right, 0 );
- wFormat.setLayoutData( fdFormat );
-
- // Ignore checkbox
- wlIgnore = new Label( composite, SWT.RIGHT );
- wlIgnore.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Ignore.Label" ) );
- props.setLook( wlIgnore );
- fdlIgnore = new FormData();
- fdlIgnore.left = new FormAttachment( wFields, 0 );
- fdlIgnore.top = new FormAttachment( wFormat, margin );
- fdlIgnore.right = new FormAttachment( middle, 0 );
- wlIgnore.setLayoutData( fdlIgnore );
- wIgnore = new Button( composite, SWT.CHECK );
- props.setLook( wIgnore );
- fdIgnore = new FormData();
- fdIgnore.left = new FormAttachment( middle, margin );
- fdIgnore.top = new FormAttachment( wFormat, margin );
- fdIgnore.right = new FormAttachment( right, 0 );
- wIgnore.setLayoutData( fdIgnore );
-
- // Trimtype line
- wlTrimtype = new Label( composite, SWT.RIGHT );
- wlTrimtype.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.TrimType.Label" ) );
- props.setLook( wlTrimtype );
- fdlTrimtype = new FormData();
- fdlTrimtype.left = new FormAttachment( wFields, 0 );
- fdlTrimtype.top = new FormAttachment( wIgnore, margin );
- fdlTrimtype.right = new FormAttachment( middle, 0 );
- wlTrimtype.setLayoutData( fdlTrimtype );
- wTrimtype = new CCombo( composite, SWT.BORDER | SWT.READ_ONLY );
- props.setLook( wTrimtype );
- for ( int i = 0; i < ValueMetaString.trimTypeDesc.length; i++ ) {
- wTrimtype.add( ValueMetaString.trimTypeDesc[ i ] );
- }
- fdTrimtype = new FormData();
- fdTrimtype.left = new FormAttachment( middle, margin );
- fdTrimtype.top = new FormAttachment( wIgnore, margin );
- fdTrimtype.right = new FormAttachment( right, 0 );
- wTrimtype.setLayoutData( fdTrimtype );
-
- // Precision line
- wlPrecision = new Label( composite, SWT.RIGHT );
- wlPrecision.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Precision.Label" ) );
- props.setLook( wlPrecision );
- fdlPrecision = new FormData();
- fdlPrecision.left = new FormAttachment( wFields, 0 );
- fdlPrecision.top = new FormAttachment( wTrimtype, margin );
- fdlPrecision.right = new FormAttachment( middle, 0 );
- wlPrecision.setLayoutData( fdlPrecision );
- wPrecision = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wPrecision );
- fdPrecision = new FormData();
- fdPrecision.left = new FormAttachment( middle, margin );
- fdPrecision.top = new FormAttachment( wTrimtype, margin );
- fdPrecision.right = new FormAttachment( right, 0 );
- wPrecision.setLayoutData( fdPrecision );
-
- // Currency line
- wlCurrency = new Label( composite, SWT.RIGHT );
- wlCurrency.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Currency.Label" ) );
- props.setLook( wlCurrency );
- fdlCurrency = new FormData();
- fdlCurrency.left = new FormAttachment( wFields, 0 );
- fdlCurrency.top = new FormAttachment( wPrecision, margin );
- fdlCurrency.right = new FormAttachment( middle, 0 );
- wlCurrency.setLayoutData( fdlCurrency );
- wCurrency = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wCurrency );
- fdCurrency = new FormData();
- fdCurrency.left = new FormAttachment( middle, margin );
- fdCurrency.top = new FormAttachment( wPrecision, margin );
- fdCurrency.right = new FormAttachment( right, 0 );
- wCurrency.setLayoutData( fdCurrency );
-
- // Decimal line
- wlDecimal = new Label( composite, SWT.RIGHT );
- wlDecimal.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Decimal.Label" ) );
- props.setLook( wlDecimal );
- fdlDecimal = new FormData();
- fdlDecimal.left = new FormAttachment( wFields, 0 );
- fdlDecimal.top = new FormAttachment( wCurrency, margin );
- fdlDecimal.right = new FormAttachment( middle, 0 );
- wlDecimal.setLayoutData( fdlDecimal );
- wDecimal = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wDecimal );
- fdDecimal = new FormData();
- fdDecimal.left = new FormAttachment( middle, margin );
- fdDecimal.top = new FormAttachment( wCurrency, margin );
- fdDecimal.right = new FormAttachment( right, 0 );
- wDecimal.setLayoutData( fdDecimal );
-
- // Group line
- wlGroup = new Label( composite, SWT.RIGHT );
- wlGroup.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Group.Label" ) );
- props.setLook( wlGroup );
- fdlGroup = new FormData();
- fdlGroup.left = new FormAttachment( wFields, 0 );
- fdlGroup.top = new FormAttachment( wDecimal, margin );
- fdlGroup.right = new FormAttachment( middle, 0 );
- wlGroup.setLayoutData( fdlGroup );
- wGroup = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wGroup );
- fdGroup = new FormData();
- fdGroup.left = new FormAttachment( middle, margin );
- fdGroup.top = new FormAttachment( wDecimal, margin );
- fdGroup.right = new FormAttachment( right, 0 );
- wGroup.setLayoutData( fdGroup );
-
- // Ignore checkbox
- wlRepeat = new Label( composite, SWT.RIGHT );
- wlRepeat.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Repeat.Label" ) );
- props.setLook( wlRepeat );
- fdlRepeat = new FormData();
- fdlRepeat.left = new FormAttachment( wFields, 0 );
- fdlRepeat.top = new FormAttachment( wGroup, margin );
- fdlRepeat.right = new FormAttachment( middle, 0 );
- wlRepeat.setLayoutData( fdlRepeat );
- wRepeat = new Button( composite, SWT.CHECK );
- props.setLook( wRepeat );
- fdRepeat = new FormData();
- fdRepeat.left = new FormAttachment( middle, margin );
- fdRepeat.top = new FormAttachment( wGroup, margin );
- fdRepeat.right = new FormAttachment( right, 0 );
- wRepeat.setLayoutData( fdRepeat );
-
- // Null line
- wlNull = new Label( composite, SWT.RIGHT );
- wlNull.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Null.Label" ) );
- props.setLook( wlNull );
- fdlNull = new FormData();
- fdlNull.left = new FormAttachment( wFields, 0 );
- fdlNull.top = new FormAttachment( wRepeat, margin );
- fdlNull.right = new FormAttachment( middle, 0 );
- wlNull.setLayoutData( fdlNull );
- wNull = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wNull );
- fdNull = new FormData();
- fdNull.left = new FormAttachment( middle, margin );
- fdNull.top = new FormAttachment( wRepeat, margin );
- fdNull.right = new FormAttachment( right, 0 );
- wNull.setLayoutData( fdNull );
-
- // The buttons
- wPrev = new Button( composite, SWT.PUSH );
- wPrev.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Previous.Button" ) );
- fdPrev = new FormData();
- fdPrev.left = new FormAttachment( left, margin );
- fdPrev.bottom = new FormAttachment( 100, 0 );
- wPrev.setLayoutData( fdPrev );
-
- // Guess button
- wGuess = new Button( composite, SWT.PUSH );
- wGuess.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Guess.Button" ) );
- fdGuess = new FormData();
- fdGuess.left = new FormAttachment( wPrev, margin );
- fdGuess.bottom = new FormAttachment( 100, 0 );
- wGuess.setLayoutData( fdGuess );
-
- // GuessAll button
- wGuessAll = new Button( composite, SWT.PUSH );
- wGuessAll.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.GuessAll.Button" ) );
- fdGuessAll = new FormData();
- fdGuessAll.left = new FormAttachment( wGuess, 0 );
- fdGuessAll.bottom = new FormAttachment( 100, 0 );
- wGuessAll.setLayoutData( fdGuessAll );
-
- wNext = new Button( composite, SWT.PUSH );
- wNext.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Next.Button" ) );
- fdNext = new FormData();
- fdNext.left = new FormAttachment( wGuessAll, 0 );
- fdNext.bottom = new FormAttachment( 100, 0 );
- wNext.setLayoutData( fdNext );
-
- // Sample list on the right...
- wSamples = new List( composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
- props.setLook( wSamples, Props.WIDGET_STYLE_FIXED );
- fdSamples = new FormData();
- fdSamples.top = new FormAttachment( 0, 0 );
- fdSamples.left = new FormAttachment( right, 0 );
- fdSamples.right = new FormAttachment( 100, 0 );
- fdSamples.bottom = new FormAttachment( 100, 0 );
- wSamples.setLayoutData( fdSamples );
-
- wFields.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- showInfo();
- }
- } );
-
- if ( wFields.getItemCount() > 0 ) {
- wFields.select( 0 );
- showInfo();
- }
-
- wFieldtype.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- int valtype = ValueMetaFactory.getIdForValueMeta( wFieldtype.getText() );
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setType( valtype );
- }
- }
- } );
-
- wFieldname.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setName( wFieldname.getText() );
- wFields.setItem( idx, wFieldname.getText() );
- }
- } );
-
- wFormat.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setFormat( wFormat.getText() );
- }
- } );
-
- wNext.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 && idx < wFields.getItemCount() - 1 ) {
- wFields.select( idx + 1 );
- wFields.showSelection();
- showInfo();
- }
- }
- } );
-
- wPrev.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx > 0 ) {
- wFields.select( idx - 1 );
- wFields.showSelection();
- showInfo();
- }
- }
- } );
-
- wIgnore.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.flipIgnored();
- }
- }
- } );
-
- wGuess.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setSamples( wSamples.getItems() );
- field.guess();
- showInfo();
- }
- }
- } );
-
- wGuessAll.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- MessageBox mb = new MessageBox( shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION );
- mb.setMessage( BaseMessages.getString(
- PKG, "TextFileImportWizardPage2.OverwriteTypeSettings.DialogMessage" ) );
- mb.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.OverwriteTypeSettings.DialogTitle" ) );
- int answer = mb.open();
- if ( answer == SWT.YES ) {
- for ( int i = 0; i < fields.size(); i++ ) {
- TextFileInputField field = (TextFileInputField) fields.get( i );
- field.setSamples( getRowSamples( field.getPosition(), field.getLength() ) );
- field.guess();
-
- wFields.select( i );
- wFields.showSelection();
- showInfo();
- }
- }
-
- if ( wFields.getItemCount() > 0 ) {
- wFields.select( 0 );
- wFields.showSelection();
- }
- showInfo();
- }
- } );
-
- wRepeat.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.flipRepeated();
- }
- }
- } );
-
- wCurrency.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setCurrencySymbol( wCurrency.getText() );
- }
- } );
-
- wGroup.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setGroupSymbol( wGroup.getText() );
- }
- } );
-
- wDecimal.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setDecimalSymbol( wDecimal.getText() );
- }
- } );
-
- wNull.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setNullString( wNull.getText() );
- }
- } );
-
- wTrimtype.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- int trimType = ValueMetaString.getTrimTypeByDesc( wTrimtype.getText() );
- TextFileInputField field = (TextFileInputField) fields.get( idx );
- field.setTrimType( trimType );
- }
- }
- } );
-
- // set the composite as the control for this page
- setControl( composite );
- }
-
- public boolean canFlipToNextPage() {
- refreshFields();
- if ( wFields.getItemCount() > 0 ) {
- wFields.select( 0 );
- showInfo();
- }
- return false;
- }
-
- private void refreshFields() {
- wFields.removeAll();
- for ( int i = 0; i < fields.size(); i++ ) {
- wFields.add( ( (TextFileInputField) fields.get( i ) ).getName() );
- }
- }
-
- private String[] getRowSamples( int position, int length ) {
- if ( position < 0 || position + length < 0 ) {
- return new String[ 0 ];
- }
-
- String[] retval = new String[ rows.size() ];
-
- for ( int i = 0; i < rows.size(); i++ ) {
- String line = rows.get( i );
-
- if ( position < line.length() ) {
- if ( position + length >= line.length() ) {
- retval[ i ] = line.substring( position );
- } else {
- retval[ i ] = line.substring( position, position + length );
- }
- } else {
- retval[ i ] = "";
- }
- }
-
- return retval;
- }
-
- private void showInfo() {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- TextFileInputField field = (TextFileInputField) fields.get( idx );
-
- String name = field.getName();
- int from = field.getPosition();
- int length = field.getLength();
- String type = field.getTypeDesc();
- boolean ignore = field.isIgnored();
- String format = field.getFormat();
- String trimtype = field.getTrimTypeDesc();
- int precision = field.getPrecision();
- String currency = field.getCurrencySymbol();
- String decimal = field.getDecimalSymbol();
- String group = field.getGroupSymbol();
- boolean repeat = field.isRepeated();
- String nullif = field.getNullString();
-
- if ( name != null ) {
- wFieldname.setText( name );
- }
- wPosition.setText( "" + from );
- wLength.setText( "" + length );
- if ( type != null ) {
- wFieldtype.setText( type );
- }
- wIgnore.setSelection( ignore );
- if ( format != null ) {
- wFormat.setText( format );
- }
- if ( trimtype != null ) {
- wTrimtype.setText( trimtype );
- }
- wPrecision.setText( "" + precision );
- if ( currency != null ) {
- wCurrency.setText( currency );
- }
- if ( decimal != null ) {
- wDecimal.setText( decimal );
- }
- if ( group != null ) {
- wGroup.setText( group );
- }
- wRepeat.setSelection( repeat );
- if ( nullif != null ) {
- wNull.setText( nullif );
- }
-
- // Clear the sample list...
- wSamples.removeAll();
- String[] samples = getRowSamples( from, length );
- for ( int i = 0; i < samples.length; i++ ) {
- wSamples.add( samples[ i ] );
- }
-
- }
- }
-}
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java
index f584699..b122dfe 100644
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java
+++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/TextFileInputDialog.java
@@ -34,6 +34,7 @@ import org.apache.hop.core.row.value.ValueMetaFactory;
import org.apache.hop.core.row.value.ValueMetaString;
import org.apache.hop.core.util.EnvUtil;
import org.apache.hop.core.util.Utils;
+import org.apache.hop.core.variables.IVariables;
import org.apache.hop.core.vfs.HopVfs;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.pipeline.Pipeline;
@@ -42,36 +43,55 @@ import org.apache.hop.pipeline.PipelinePreviewFactory;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
import org.apache.hop.pipeline.transform.ITransformDialog;
import org.apache.hop.pipeline.transform.TransformMeta;
-import org.apache.hop.ui.core.dialog.*;
-import org.apache.hop.ui.core.gui.GuiResource;
+import org.apache.hop.ui.core.dialog.BaseDialog;
+import org.apache.hop.ui.core.dialog.EnterNumberDialog;
+import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
+import org.apache.hop.ui.core.dialog.EnterTextDialog;
+import org.apache.hop.ui.core.dialog.ErrorDialog;
+import org.apache.hop.ui.core.dialog.PreviewRowsDialog;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import java.util.*;
-import org.apache.hop.core.variables.IVariables;
+import java.util.Locale;
+import java.util.Vector;
/** @deprecated replaced by implementation in the ...transforms.fileinput.text package */
public class TextFileInputDialog extends BaseTransformDialog implements ITransformDialog {
@@ -2607,8 +2627,6 @@ public class TextFileInputDialog extends BaseTransformDialog implements ITransfo
private void get() {
if (wFiletype.getText().equalsIgnoreCase("CSV")) {
getCSV();
- } else {
- getFixed();
}
}
@@ -3036,83 +3054,6 @@ public class TextFileInputDialog extends BaseTransformDialog implements ITransfo
return retval;
}
- private void getFixed() {
- TextFileInputMeta info = new TextFileInputMeta();
- getInfo(info);
-
- Shell sh = new Shell(shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
-
- try {
- List<String> rows = getFirst(50, false);
- fields = getFields(info, rows);
-
- final TextFileImportWizardPage1 page1 =
- new TextFileImportWizardPage1("1", props, rows, fields);
- page1.createControl(sh);
- final TextFileImportWizardPage2 page2 =
- new TextFileImportWizardPage2("2", props, rows, fields);
- page2.createControl(sh);
-
- Wizard wizard =
- new Wizard() {
- public boolean performFinish() {
- wFields.clearAll(false);
-
- for (ITextFileInputField field1 : fields) {
- TextFileInputField field = (TextFileInputField) field1;
- if (!field.isIgnored() && field.getLength() > 0) {
- TableItem item = new TableItem(wFields.table, SWT.NONE);
- item.setText(1, field.getName());
- item.setText(2, "" + field.getTypeDesc());
- item.setText(3, "" + field.getFormat());
- item.setText(4, "" + field.getPosition());
- item.setText(5, field.getLength() < 0 ? "" : "" + field.getLength());
- item.setText(6, field.getPrecision() < 0 ? "" : "" + field.getPrecision());
- item.setText(7, "" + field.getCurrencySymbol());
- item.setText(8, "" + field.getDecimalSymbol());
- item.setText(9, "" + field.getGroupSymbol());
- item.setText(10, "" + field.getNullString());
- item.setText(11, "" + field.getIfNullValue());
- item.setText(12, "" + field.getTrimTypeDesc());
- item.setText(
- 13,
- field.isRepeated()
- ? BaseMessages.getString(PKG, "System.Combo.Yes")
- : BaseMessages.getString(PKG, "System.Combo.No"));
- }
- }
- int size = wFields.table.getItemCount();
- if (size == 0) {
- new TableItem(wFields.table, SWT.NONE);
- }
-
- wFields.removeEmptyRows();
- wFields.setRowNums();
- wFields.optWidth(true);
-
- input.setChanged();
-
- return true;
- }
- };
-
- wizard.addPage(page1);
- wizard.addPage(page2);
-
- WizardDialog wd = new WizardDialog(shell, wizard);
- WizardDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- wd.setMinimumPageSize(700, 375);
- wd.updateSize();
- wd.open();
- } catch (Exception e) {
- new ErrorDialog(
- shell,
- BaseMessages.getString(PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle"),
- BaseMessages.getString(PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage"),
- e);
- }
- }
-
private Vector<ITextFileInputField> getFields(TextFileInputMeta info, List<String> rows) {
Vector<ITextFileInputField> fields = new Vector<>();
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizard.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizard.java
deleted file mode 100644
index 2bb02c7..0000000
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizard.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.pipeline.transforms.fileinput.text;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-
-/*
- * Created on 17-apr-04
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-
-/**
- * @author Matt
- * <p>
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class TextFileImportWizard implements IWizard {
- public TextFileImportWizard() {
- super();
- }
-
- // Adds any last-minute pages to this wizard.
- public void addPages() {
- }
-
- // Returns whether this wizard could be finished without further user interaction.
- public boolean canFinish() {
- return false;
- }
-
- // Creates this wizard's controls in the given parent control.
- public void createPageControls( Composite pageContainer ) {
- }
-
- // Disposes of this wizard and frees all SWT resources.
- public void dispose() {
- }
-
- // Returns the container of this wizard.
- public IWizardContainer getContainer() {
- return null;
- }
-
- // Returns the default page image for this wizard.
- public Image getDefaultPageImage() {
- return null;
- }
-
- // Returns the dialog settings for this wizard.
- public IDialogSettings getDialogSettings() {
- return null;
- }
-
- // Returns the successor of the given page.
- public IWizardPage getNextPage( IWizardPage page ) {
- return null;
- }
-
- // Returns the wizard page with the given name belonging to this wizard.
- public IWizardPage getPage( String pageName ) {
- return null;
- }
-
- // Returns the number of pages in this wizard.
- public int getPageCount() {
- return 3;
- }
-
- // Returns all the pages in this wizard.
- public IWizardPage[] getPages() {
- return null;
- }
-
- // Returns the predecessor of the given page.
- public IWizardPage getPreviousPage( IWizardPage page ) {
- return null;
- }
-
- // Returns the first page to be shown in this wizard.
- public IWizardPage getStartingPage() {
- return null;
- }
-
- // Returns the title bar color for this wizard.
- public RGB getTitleBarColor() {
- return null;
- }
-
- // Returns the window title string for this wizard.
- public String getWindowTitle() {
- return "WindowTitle";
- }
-
- // Returns whether help is available for this wizard.
- public boolean isHelpAvailable() {
- return false;
- }
-
- // Returns whether this wizard needs Previous and Next buttons.
- public boolean needsPreviousAndNextButtons() {
- return true;
- }
-
- // Returns whether this wizard needs a progress monitor.
- public boolean needsProgressMonitor() {
- return false;
- }
-
- // Performs any actions appropriate in response to the user having pressed the Cancel button, or refuse if canceling
- // now is not permitted.
- public boolean performCancel() {
- return false;
- }
-
- // Performs any actions appropriate in response to the user having pressed the Finish button, or refuse if finishing
- // now is not permitted.
- public boolean performFinish() {
- return false;
- }
-
- // Sets or clears the container of this wizard.
- public void setContainer( IWizardContainer wizardContainer ) {
- }
-
-}
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizardPage1.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizardPage1.java
deleted file mode 100644
index f7f14d3..0000000
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizardPage1.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.pipeline.transforms.fileinput.text;
-
-import org.apache.hop.core.Const;
-import org.apache.hop.core.gui.ITextFileInputField;
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.ui.core.PropsUi;
-import org.apache.hop.ui.core.widget.TableDraw;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-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 java.util.List;
-import java.util.Vector;
-
-public class TextFileImportWizardPage1 extends WizardPage { // implements Listener
- private static final Class<?> PKG = TextFileInputMeta.class; // For Translator
-
- private TableDraw wTable;
- private FormData fdTable;
-
- private PropsUi props;
- private List<String> rows;
- private Vector<ITextFileInputField> fields;
-
- public TextFileImportWizardPage1( String arg, PropsUi props, List<String> rows,
- Vector<ITextFileInputField> fields ) {
- super( arg );
- this.props = props;
- this.rows = rows;
- this.fields = fields;
-
- setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage1.DialogTitle" ) );
- setDescription( BaseMessages.getString( PKG, "TextFileImportWizardPage1.DialogMessage" ) );
- }
-
- public void createControl( Composite parent ) {
- // create the composite to hold the widgets
- Composite composite = new Composite( parent, SWT.NONE );
- props.setLook( composite );
-
- FormLayout compLayout = new FormLayout();
- compLayout.marginHeight = Const.FORM_MARGIN;
- compLayout.marginWidth = Const.FORM_MARGIN;
- composite.setLayout( compLayout );
-
- MouseAdapter lsMouse = new MouseAdapter() {
- public void mouseDown( MouseEvent e ) {
- int s = getSize();
- setPageComplete( s > 0 );
- }
- };
-
- wTable = new TableDraw( composite, props, this, fields );
- wTable.setRows( rows );
- props.setLook( wTable );
- wTable.setFields( fields );
- fdTable = new FormData();
- fdTable.left = new FormAttachment( 0, 0 );
- fdTable.right = new FormAttachment( 100, 0 );
- fdTable.top = new FormAttachment( 0, 0 );
- fdTable.bottom = new FormAttachment( 100, 0 );
- wTable.setLayoutData( fdTable );
- wTable.addMouseListener( lsMouse );
-
- // set the composite as the control for this page
- setControl( composite );
- }
-
- public void setFields( Vector<ITextFileInputField> fields ) {
- wTable.setFields( fields );
- }
-
- public Vector<ITextFileInputField> getFields() {
- return wTable.getFields();
- }
-
- public boolean canFlipToNextPage() {
- int size = getSize();
- if ( size > 0 ) {
- setErrorMessage( null );
- return true;
- } else {
- setErrorMessage( BaseMessages.getString( PKG, "TextFileImportWizardPage1.ErrorMarkerNeeded" ) );
- return false;
- }
- }
-
- public int getSize() {
- return wTable.getFields().size();
- }
-}
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizardPage2.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizardPage2.java
deleted file mode 100644
index 8c110ff..0000000
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileImportWizardPage2.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- * 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.pipeline.transforms.fileinput.text;
-
-import org.apache.hop.core.Const;
-import org.apache.hop.core.Props;
-import org.apache.hop.core.gui.ITextFileInputField;
-import org.apache.hop.core.row.value.ValueMetaFactory;
-import org.apache.hop.core.row.value.ValueMetaString;
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.pipeline.transforms.file.BaseFileField;
-import org.apache.hop.ui.core.PropsUi;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import java.util.Vector;
-
-public class TextFileImportWizardPage2 extends WizardPage {
- private static final Class<?> PKG = TextFileInputMeta.class; // For Translator
-
- private List wFields;
- private FormData fdFields;
-
- private List wSamples;
- private FormData fdSamples;
-
- private Label wlFieldname;
- private Text wFieldname;
- private FormData fdlFieldname, fdFieldname;
-
- private Label wlPosition;
- private Text wPosition;
- private FormData fdlPosition, fdPosition;
-
- private Label wlLength;
- private Text wLength;
- private FormData fdlLength, fdLength;
-
- private Label wlFieldtype;
- private CCombo wFieldtype;
- private FormData fdlFieldtype, fdFieldtype;
-
- private Label wlFormat;
- private Text wFormat;
- private FormData fdlFormat, fdFormat;
-
- private Label wlTrimtype;
- private CCombo wTrimtype;
- private FormData fdlTrimtype, fdTrimtype;
-
- private Label wlPrecision;
- private Text wPrecision;
- private FormData fdlPrecision, fdPrecision;
-
- private Label wlDecimal;
- private Text wDecimal;
- private FormData fdlDecimal, fdDecimal;
-
- private Label wlGroup;
- private Text wGroup;
- private FormData fdlGroup, fdGroup;
-
- private Label wlCurrency;
- private Text wCurrency;
- private FormData fdlCurrency, fdCurrency;
-
- private Label wlIgnore;
- private Button wIgnore;
- private FormData fdlIgnore, fdIgnore;
-
- private Label wlRepeat;
- private Button wRepeat;
- private FormData fdlRepeat, fdRepeat;
-
- private Label wlNull;
- private Text wNull;
- private FormData fdlNull, fdNull;
-
- private Button wGuess, wGuessAll;
- private FormData fdGuess, fdGuessAll;
-
- private Button wPrev, wNext;
- private FormData fdPrev, fdNext;
-
- private PropsUi props;
- private java.util.List<String> rows;
- private Vector<ITextFileInputField> fields;
-
- private Shell shell;
-
- public TextFileImportWizardPage2( String arg, PropsUi props, java.util.List<String> rows,
- Vector<ITextFileInputField> fields ) {
- super( arg );
- this.props = props;
- this.rows = rows;
- this.fields = fields;
-
- setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage2.DialogTitle" ) );
- setDescription( "Give a name to the fields in this text file" );
- }
-
- public void createControl( Composite parent ) {
- shell = parent.getShell();
-
- int margin = props.getMargin();
- int left = props.getMiddlePct() / 2;
- int middle = props.getMiddlePct();
- int right = middle + left;
-
- // create the composite to hold the widgets
- Composite composite = new Composite( parent, SWT.NONE );
- props.setLook( composite );
-
- FormLayout compLayout = new FormLayout();
- compLayout.marginHeight = Const.FORM_MARGIN;
- compLayout.marginWidth = Const.FORM_MARGIN;
- composite.setLayout( compLayout );
-
- wFields = new List( composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );
- props.setLook( wFields );
- fdFields = new FormData();
- fdFields.top = new FormAttachment( 0, 0 );
- fdFields.left = new FormAttachment( 0, 0 );
- fdFields.right = new FormAttachment( left, 0 );
- fdFields.bottom = new FormAttachment( 100, 0 );
- wFields.setLayoutData( fdFields );
-
- refreshFields();
-
- // Fieldname line
- wlFieldname = new Label( composite, SWT.RIGHT );
- wlFieldname.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Fieldname.Label" ) );
- props.setLook( wlFieldname );
- fdlFieldname = new FormData();
- fdlFieldname.left = new FormAttachment( wFields, 0 );
- fdlFieldname.top = new FormAttachment( 0, 0 );
- fdlFieldname.right = new FormAttachment( middle, 0 );
- wlFieldname.setLayoutData( fdlFieldname );
- wFieldname = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wFieldname );
- fdFieldname = new FormData();
- fdFieldname.left = new FormAttachment( middle, margin );
- fdFieldname.right = new FormAttachment( right, 0 );
- fdFieldname.top = new FormAttachment( 0, 0 );
- wFieldname.setLayoutData( fdFieldname );
-
- // Position line
- wlPosition = new Label( composite, SWT.RIGHT );
- wlPosition.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldPosition.Label" ) );
- props.setLook( wlPosition );
- fdlPosition = new FormData();
- fdlPosition.left = new FormAttachment( wFields, 0 );
- fdlPosition.top = new FormAttachment( wFieldname, margin );
- fdlPosition.right = new FormAttachment( middle, 0 );
- wlPosition.setLayoutData( fdlPosition );
- wPosition = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wPosition );
- fdPosition = new FormData();
- fdPosition.left = new FormAttachment( middle, margin );
- fdPosition.top = new FormAttachment( wFieldname, margin );
- fdPosition.right = new FormAttachment( right, 0 );
- wPosition.setLayoutData( fdPosition );
- wPosition.setEnabled( false );
-
- // Topos line
- wlLength = new Label( composite, SWT.RIGHT );
- wlLength.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldLength.Label" ) );
- props.setLook( wlLength );
- fdlLength = new FormData();
- fdlLength.left = new FormAttachment( wFields, 0 );
- fdlLength.top = new FormAttachment( wPosition, margin );
- fdlLength.right = new FormAttachment( middle, 0 );
- wlLength.setLayoutData( fdlLength );
- wLength = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wLength );
- fdLength = new FormData();
- fdLength.left = new FormAttachment( middle, margin );
- fdLength.top = new FormAttachment( wPosition, margin );
- fdLength.right = new FormAttachment( right, 0 );
- wLength.setLayoutData( fdLength );
- wLength.setEnabled( false );
-
- // Fieldtype line
- wlFieldtype = new Label( composite, SWT.RIGHT );
- wlFieldtype.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldType.Label" ) );
- props.setLook( wlFieldtype );
- fdlFieldtype = new FormData();
- fdlFieldtype.left = new FormAttachment( wFields, 0 );
- fdlFieldtype.top = new FormAttachment( wLength, margin );
- fdlFieldtype.right = new FormAttachment( middle, 0 );
- wlFieldtype.setLayoutData( fdlFieldtype );
- wFieldtype = new CCombo( composite, SWT.BORDER | SWT.READ_ONLY );
- props.setLook( wFieldtype );
- for ( int i = 0; i < ValueMetaFactory.getValueMetaNames().length; i++ ) {
- wFieldtype.add( ValueMetaFactory.getValueMetaNames()[ i ] );
- }
- fdFieldtype = new FormData();
- fdFieldtype.left = new FormAttachment( middle, margin );
- fdFieldtype.top = new FormAttachment( wLength, margin );
- fdFieldtype.right = new FormAttachment( right, 0 );
- wFieldtype.setLayoutData( fdFieldtype );
-
- // Format line
- wlFormat = new Label( composite, SWT.RIGHT );
- wlFormat.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.FieldFormatter.Label" ) );
- props.setLook( wlFormat );
- fdlFormat = new FormData();
- fdlFormat.left = new FormAttachment( wFields, 0 );
- fdlFormat.top = new FormAttachment( wFieldtype, margin );
- fdlFormat.right = new FormAttachment( middle, 0 );
- wlFormat.setLayoutData( fdlFormat );
- wFormat = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wFormat );
- fdFormat = new FormData();
- fdFormat.left = new FormAttachment( middle, margin );
- fdFormat.top = new FormAttachment( wFieldtype, margin );
- fdFormat.right = new FormAttachment( right, 0 );
- wFormat.setLayoutData( fdFormat );
-
- // Ignore checkbox
- wlIgnore = new Label( composite, SWT.RIGHT );
- wlIgnore.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Ignore.Label" ) );
- props.setLook( wlIgnore );
- fdlIgnore = new FormData();
- fdlIgnore.left = new FormAttachment( wFields, 0 );
- fdlIgnore.top = new FormAttachment( wFormat, margin );
- fdlIgnore.right = new FormAttachment( middle, 0 );
- wlIgnore.setLayoutData( fdlIgnore );
- wIgnore = new Button( composite, SWT.CHECK );
- props.setLook( wIgnore );
- fdIgnore = new FormData();
- fdIgnore.left = new FormAttachment( middle, margin );
- fdIgnore.top = new FormAttachment( wFormat, margin );
- fdIgnore.right = new FormAttachment( right, 0 );
- wIgnore.setLayoutData( fdIgnore );
-
- // Trimtype line
- wlTrimtype = new Label( composite, SWT.RIGHT );
- wlTrimtype.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.TrimType.Label" ) );
- props.setLook( wlTrimtype );
- fdlTrimtype = new FormData();
- fdlTrimtype.left = new FormAttachment( wFields, 0 );
- fdlTrimtype.top = new FormAttachment( wIgnore, margin );
- fdlTrimtype.right = new FormAttachment( middle, 0 );
- wlTrimtype.setLayoutData( fdlTrimtype );
- wTrimtype = new CCombo( composite, SWT.BORDER | SWT.READ_ONLY );
- props.setLook( wTrimtype );
- for ( int i = 0; i < ValueMetaString.trimTypeDesc.length; i++ ) {
- wTrimtype.add( ValueMetaString.trimTypeDesc[ i ] );
- }
- fdTrimtype = new FormData();
- fdTrimtype.left = new FormAttachment( middle, margin );
- fdTrimtype.top = new FormAttachment( wIgnore, margin );
- fdTrimtype.right = new FormAttachment( right, 0 );
- wTrimtype.setLayoutData( fdTrimtype );
-
- // Precision line
- wlPrecision = new Label( composite, SWT.RIGHT );
- wlPrecision.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Precision.Label" ) );
- props.setLook( wlPrecision );
- fdlPrecision = new FormData();
- fdlPrecision.left = new FormAttachment( wFields, 0 );
- fdlPrecision.top = new FormAttachment( wTrimtype, margin );
- fdlPrecision.right = new FormAttachment( middle, 0 );
- wlPrecision.setLayoutData( fdlPrecision );
- wPrecision = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wPrecision );
- fdPrecision = new FormData();
- fdPrecision.left = new FormAttachment( middle, margin );
- fdPrecision.top = new FormAttachment( wTrimtype, margin );
- fdPrecision.right = new FormAttachment( right, 0 );
- wPrecision.setLayoutData( fdPrecision );
-
- // Currency line
- wlCurrency = new Label( composite, SWT.RIGHT );
- wlCurrency.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Currency.Label" ) );
- props.setLook( wlCurrency );
- fdlCurrency = new FormData();
- fdlCurrency.left = new FormAttachment( wFields, 0 );
- fdlCurrency.top = new FormAttachment( wPrecision, margin );
- fdlCurrency.right = new FormAttachment( middle, 0 );
- wlCurrency.setLayoutData( fdlCurrency );
- wCurrency = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wCurrency );
- fdCurrency = new FormData();
- fdCurrency.left = new FormAttachment( middle, margin );
- fdCurrency.top = new FormAttachment( wPrecision, margin );
- fdCurrency.right = new FormAttachment( right, 0 );
- wCurrency.setLayoutData( fdCurrency );
-
- // Decimal line
- wlDecimal = new Label( composite, SWT.RIGHT );
- wlDecimal.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Decimal.Label" ) );
- props.setLook( wlDecimal );
- fdlDecimal = new FormData();
- fdlDecimal.left = new FormAttachment( wFields, 0 );
- fdlDecimal.top = new FormAttachment( wCurrency, margin );
- fdlDecimal.right = new FormAttachment( middle, 0 );
- wlDecimal.setLayoutData( fdlDecimal );
- wDecimal = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wDecimal );
- fdDecimal = new FormData();
- fdDecimal.left = new FormAttachment( middle, margin );
- fdDecimal.top = new FormAttachment( wCurrency, margin );
- fdDecimal.right = new FormAttachment( right, 0 );
- wDecimal.setLayoutData( fdDecimal );
-
- // Group line
- wlGroup = new Label( composite, SWT.RIGHT );
- wlGroup.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Group.Label" ) );
- props.setLook( wlGroup );
- fdlGroup = new FormData();
- fdlGroup.left = new FormAttachment( wFields, 0 );
- fdlGroup.top = new FormAttachment( wDecimal, margin );
- fdlGroup.right = new FormAttachment( middle, 0 );
- wlGroup.setLayoutData( fdlGroup );
- wGroup = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wGroup );
- fdGroup = new FormData();
- fdGroup.left = new FormAttachment( middle, margin );
- fdGroup.top = new FormAttachment( wDecimal, margin );
- fdGroup.right = new FormAttachment( right, 0 );
- wGroup.setLayoutData( fdGroup );
-
- // Ignore checkbox
- wlRepeat = new Label( composite, SWT.RIGHT );
- wlRepeat.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Repeat.Label" ) );
- props.setLook( wlRepeat );
- fdlRepeat = new FormData();
- fdlRepeat.left = new FormAttachment( wFields, 0 );
- fdlRepeat.top = new FormAttachment( wGroup, margin );
- fdlRepeat.right = new FormAttachment( middle, 0 );
- wlRepeat.setLayoutData( fdlRepeat );
- wRepeat = new Button( composite, SWT.CHECK );
- props.setLook( wRepeat );
- fdRepeat = new FormData();
- fdRepeat.left = new FormAttachment( middle, margin );
- fdRepeat.top = new FormAttachment( wGroup, margin );
- fdRepeat.right = new FormAttachment( right, 0 );
- wRepeat.setLayoutData( fdRepeat );
-
- // Null line
- wlNull = new Label( composite, SWT.RIGHT );
- wlNull.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Null.Label" ) );
- props.setLook( wlNull );
- fdlNull = new FormData();
- fdlNull.left = new FormAttachment( wFields, 0 );
- fdlNull.top = new FormAttachment( wRepeat, margin );
- fdlNull.right = new FormAttachment( middle, 0 );
- wlNull.setLayoutData( fdlNull );
- wNull = new Text( composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wNull );
- fdNull = new FormData();
- fdNull.left = new FormAttachment( middle, margin );
- fdNull.top = new FormAttachment( wRepeat, margin );
- fdNull.right = new FormAttachment( right, 0 );
- wNull.setLayoutData( fdNull );
-
- // The buttons
- wPrev = new Button( composite, SWT.PUSH );
- wPrev.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Previous.Button" ) );
- fdPrev = new FormData();
- fdPrev.left = new FormAttachment( left, margin );
- fdPrev.bottom = new FormAttachment( 100, 0 );
- wPrev.setLayoutData( fdPrev );
-
- // Guess button
- wGuess = new Button( composite, SWT.PUSH );
- wGuess.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Guess.Button" ) );
- fdGuess = new FormData();
- fdGuess.left = new FormAttachment( wPrev, margin );
- fdGuess.bottom = new FormAttachment( 100, 0 );
- wGuess.setLayoutData( fdGuess );
-
- // GuessAll button
- wGuessAll = new Button( composite, SWT.PUSH );
- wGuessAll.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.GuessAll.Button" ) );
- fdGuessAll = new FormData();
- fdGuessAll.left = new FormAttachment( wGuess, 0 );
- fdGuessAll.bottom = new FormAttachment( 100, 0 );
- wGuessAll.setLayoutData( fdGuessAll );
-
- wNext = new Button( composite, SWT.PUSH );
- wNext.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.Next.Button" ) );
- fdNext = new FormData();
- fdNext.left = new FormAttachment( wGuessAll, 0 );
- fdNext.bottom = new FormAttachment( 100, 0 );
- wNext.setLayoutData( fdNext );
-
- // Sample list on the right...
- wSamples = new List( composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
- props.setLook( wSamples, Props.WIDGET_STYLE_FIXED );
- fdSamples = new FormData();
- fdSamples.top = new FormAttachment( 0, 0 );
- fdSamples.left = new FormAttachment( right, 0 );
- fdSamples.right = new FormAttachment( 100, 0 );
- fdSamples.bottom = new FormAttachment( 100, 0 );
- wSamples.setLayoutData( fdSamples );
-
- wFields.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- showInfo();
- }
- } );
-
- if ( wFields.getItemCount() > 0 ) {
- wFields.select( 0 );
- showInfo();
- }
-
- wFieldtype.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- int valtype = ValueMetaFactory.getIdForValueMeta( wFieldtype.getText() );
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setType( valtype );
- }
- }
- } );
-
- wFieldname.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setName( wFieldname.getText() );
- wFields.setItem( idx, wFieldname.getText() );
- }
- } );
-
- wFormat.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setFormat( wFormat.getText() );
- }
- } );
-
- wNext.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 && idx < wFields.getItemCount() - 1 ) {
- wFields.select( idx + 1 );
- wFields.showSelection();
- showInfo();
- }
- }
- } );
-
- wPrev.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx > 0 ) {
- wFields.select( idx - 1 );
- wFields.showSelection();
- showInfo();
- }
- }
- } );
-
- wIgnore.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.flipIgnored();
- }
- }
- } );
-
- wGuess.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setSamples( wSamples.getItems() );
- field.guess();
- showInfo();
- }
- }
- } );
-
- wGuessAll.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- MessageBox mb = new MessageBox( shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION );
- mb.setMessage( BaseMessages.getString( PKG, "TextFileImportWizardPage2.OverwriteTypeSettings.DialogMessage" ) );
- mb.setText( BaseMessages.getString( PKG, "TextFileImportWizardPage2.OverwriteTypeSettings.DialogTitle" ) );
- int answer = mb.open();
- if ( answer == SWT.YES ) {
- for ( int i = 0; i < fields.size(); i++ ) {
- BaseFileField field = (BaseFileField) fields.get( i );
- field.setSamples( getRowSamples( field.getPosition(), field.getLength() ) );
- field.guess();
-
- wFields.select( i );
- wFields.showSelection();
- showInfo();
- }
- }
-
- if ( wFields.getItemCount() > 0 ) {
- wFields.select( 0 );
- wFields.showSelection();
- }
- showInfo();
- }
- } );
-
- wRepeat.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.flipRepeated();
- }
- }
- } );
-
- wCurrency.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setCurrencySymbol( wCurrency.getText() );
- }
- } );
-
- wGroup.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setGroupSymbol( wGroup.getText() );
- }
- } );
-
- wDecimal.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setDecimalSymbol( wDecimal.getText() );
- }
- } );
-
- wNull.addModifyListener( e -> {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setNullString( wNull.getText() );
- }
- } );
-
- wTrimtype.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e ) {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- int trimType = ValueMetaString.getTrimTypeByDesc( wTrimtype.getText() );
- BaseFileField field = (BaseFileField) fields.get( idx );
- field.setTrimType( trimType );
- }
- }
- } );
-
- // set the composite as the control for this page
- setControl( composite );
- }
-
- public boolean canFlipToNextPage() {
- refreshFields();
- if ( wFields.getItemCount() > 0 ) {
- wFields.select( 0 );
- showInfo();
- }
- return false;
- }
-
- private void refreshFields() {
- wFields.removeAll();
- for ( int i = 0; i < fields.size(); i++ ) {
- wFields.add( ( (BaseFileField) fields.get( i ) ).getName() );
- }
- }
-
- private String[] getRowSamples( int position, int length ) {
- if ( position < 0 || position + length < 0 ) {
- return new String[ 0 ];
- }
-
- String[] retval = new String[ rows.size() ];
-
- for ( int i = 0; i < rows.size(); i++ ) {
- String line = rows.get( i );
-
- if ( position < line.length() ) {
- if ( position + length >= line.length() ) {
- retval[ i ] = line.substring( position );
- } else {
- retval[ i ] = line.substring( position, position + length );
- }
- } else {
- retval[ i ] = "";
- }
- }
-
- return retval;
- }
-
- private void showInfo() {
- int idx = wFields.getSelectionIndex();
- if ( idx >= 0 ) {
- BaseFileField field = (BaseFileField) fields.get( idx );
-
- String name = field.getName();
- int from = field.getPosition();
- int length = field.getLength();
- String type = field.getTypeDesc();
- boolean ignore = field.isIgnored();
- String format = field.getFormat();
- String trimtype = field.getTrimTypeDesc();
- int precision = field.getPrecision();
- String currency = field.getCurrencySymbol();
- String decimal = field.getDecimalSymbol();
- String group = field.getGroupSymbol();
- boolean repeat = field.isRepeated();
- String nullif = field.getNullString();
-
- if ( name != null ) {
- wFieldname.setText( name );
- }
- wPosition.setText( "" + from );
- wLength.setText( "" + length );
- if ( type != null ) {
- wFieldtype.setText( type );
- }
- wIgnore.setSelection( ignore );
- if ( format != null ) {
- wFormat.setText( format );
- }
- if ( trimtype != null ) {
- wTrimtype.setText( trimtype );
- }
- wPrecision.setText( "" + precision );
- if ( currency != null ) {
- wCurrency.setText( currency );
- }
- if ( decimal != null ) {
- wDecimal.setText( decimal );
- }
- if ( group != null ) {
- wGroup.setText( group );
- }
- wRepeat.setSelection( repeat );
- if ( nullif != null ) {
- wNull.setText( nullif );
- }
-
- // Clear the sample list...
- wSamples.removeAll();
- String[] samples = getRowSamples( from, length );
- for ( int i = 0; i < samples.length; i++ ) {
- wSamples.add( samples[ i ] );
- }
-
- }
- }
-}
diff --git a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java
index 49b42cf..4a673ac 100644
--- a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java
+++ b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputDialog.java
@@ -45,8 +45,12 @@ import org.apache.hop.pipeline.transform.ITransformDialog;
import org.apache.hop.pipeline.transform.TransformMeta;
import org.apache.hop.pipeline.transforms.common.ICsvInputAwareMeta;
import org.apache.hop.pipeline.transforms.file.BaseFileField;
-import org.apache.hop.ui.core.dialog.*;
-import org.apache.hop.ui.core.gui.GuiResource;
+import org.apache.hop.ui.core.dialog.BaseDialog;
+import org.apache.hop.ui.core.dialog.EnterNumberDialog;
+import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
+import org.apache.hop.ui.core.dialog.EnterTextDialog;
+import org.apache.hop.ui.core.dialog.ErrorDialog;
+import org.apache.hop.ui.core.dialog.PreviewRowsDialog;
import org.apache.hop.ui.core.widget.ColumnInfo;
import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
@@ -56,27 +60,41 @@ import org.apache.hop.ui.pipeline.transform.common.ICsvInputAwareImportProgressD
import org.apache.hop.ui.pipeline.transform.common.ICsvInputAwareTransformDialog;
import org.apache.hop.ui.pipeline.transform.common.IGetFieldsCapableTransformDialog;
import org.apache.hop.ui.pipeline.transform.common.TextFileLineUtil;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.*;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import java.util.*;
+import java.util.Locale;
+import java.util.Set;
+import java.util.Vector;
import java.util.stream.Collectors;
public class TextFileInputDialog extends BaseTransformDialog
@@ -2507,8 +2525,6 @@ public class TextFileInputDialog extends BaseTransformDialog
private void get() {
if (wFiletype.getText().equalsIgnoreCase("CSV")) {
getFields();
- } else {
- getFixed();
}
}
@@ -2784,83 +2800,6 @@ public class TextFileInputDialog extends BaseTransformDialog
return retval;
}
- private void getFixed() {
- TextFileInputMeta info = new TextFileInputMeta();
- getInfo(info, true);
-
- Shell sh = new Shell(shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
-
- try {
- List<String> rows = getFirst(50, false);
- fields = getFields(info, rows);
-
- final TextFileImportWizardPage1 page1 =
- new TextFileImportWizardPage1("1", props, rows, fields);
- page1.createControl(sh);
- final TextFileImportWizardPage2 page2 =
- new TextFileImportWizardPage2("2", props, rows, fields);
- page2.createControl(sh);
-
- Wizard wizard =
- new Wizard() {
- public boolean performFinish() {
- wFields.clearAll(false);
-
- for (ITextFileInputField field1 : fields) {
- BaseFileField field = (BaseFileField) field1;
- if (!field.isIgnored() && field.getLength() > 0) {
- TableItem item = new TableItem(wFields.table, SWT.NONE);
- item.setText(1, field.getName());
- item.setText(2, "" + field.getTypeDesc());
- item.setText(3, "" + field.getFormat());
- item.setText(4, "" + field.getPosition());
- item.setText(5, field.getLength() < 0 ? "" : "" + field.getLength());
- item.setText(6, field.getPrecision() < 0 ? "" : "" + field.getPrecision());
- item.setText(7, "" + field.getCurrencySymbol());
- item.setText(8, "" + field.getDecimalSymbol());
- item.setText(9, "" + field.getGroupSymbol());
- item.setText(10, "" + field.getNullString());
- item.setText(11, "" + field.getIfNullValue());
- item.setText(12, "" + field.getTrimTypeDesc());
- item.setText(
- 13,
- field.isRepeated()
- ? BaseMessages.getString(PKG, "System.Combo.Yes")
- : BaseMessages.getString(PKG, "System.Combo.No"));
- }
- }
- int size = wFields.table.getItemCount();
- if (size == 0) {
- new TableItem(wFields.table, SWT.NONE);
- }
-
- wFields.removeEmptyRows();
- wFields.setRowNums();
- wFields.optWidth(true);
-
- input.setChanged();
-
- return true;
- }
- };
-
- wizard.addPage(page1);
- wizard.addPage(page2);
-
- WizardDialog wd = new WizardDialog(shell, wizard);
- WizardDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
- wd.setMinimumPageSize(700, 375);
- wd.updateSize();
- wd.open();
- } catch (Exception e) {
- new ErrorDialog(
- shell,
- BaseMessages.getString(PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle"),
- BaseMessages.getString(PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage"),
- e);
- }
- }
-
private Vector<ITextFileInputField> getFields(TextFileInputMeta info, List<String> rows) {
Vector<ITextFileInputField> fields = new Vector<>();
diff --git a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java
index c3ff788..f6dd71e 100644
--- a/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java
+++ b/plugins/transforms/tokenreplacement/src/main/java/org/apache/hop/pipeline/transforms/tokenreplacement/TokenReplacementDialog.java
@@ -37,7 +37,6 @@ import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.pipeline.transform.ITableItemInsertListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
@@ -47,17 +46,13 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
@@ -1605,7 +1600,7 @@ public class TokenReplacementDialog extends BaseTransformDialog implements ITran
return true;
}
};
- getFieldsFromPrevious(r, wFields, 2, new int[] {2}, new int[] {1}, listener);
+ getFieldsFromPrevious(r, wFields, 2, new int[] {2}, new int[] {1}, -1, -1, listener);
}
} catch (HopException ke) {
new ErrorDialog(
@@ -1615,100 +1610,4 @@ public class TokenReplacementDialog extends BaseTransformDialog implements ITran
ke);
}
}
-
- public void getFieldsFromPrevious(
- IRowMeta row,
- TableView tableView,
- int keyColumn,
- int[] nameColumn,
- int[] tokenNameColumn,
- ITableItemInsertListener listener) {
- if (row == null || row.size() == 0) {
- return; // nothing to do
- }
-
- Table table = tableView.table;
-
- // get a list of all the non-empty keys (names)
- //
- List<String> keys = new ArrayList<String>();
- for (int i = 0; i < table.getItemCount(); i++) {
- TableItem tableItem = table.getItem(i);
- String key = tableItem.getText(keyColumn);
- if (!Utils.isEmpty(key) && keys.indexOf(key) < 0) {
- keys.add(key);
- }
- }
-
- int choice = 0;
-
- if (keys.size() > 0) {
- // Ask what we should do with the existing data in the transform.
- //
- MessageDialog md =
- new MessageDialog(
- tableView.getShell(),
- BaseMessages.getString(
- PKG, "BaseTransformDialog.GetFieldsChoice.Title"), // "Warning!"
- null,
- BaseMessages.getString(
- PKG,
- "BaseTransformDialog.GetFieldsChoice.Message",
- "" + keys.size(),
- "" + row.size()),
- SWT.ICON_WARNING,
- new String[] {
- BaseMessages.getString(PKG, "BaseTransformDialog.AddNew"),
- BaseMessages.getString(PKG, "BaseTransformDialog.Add"),
- BaseMessages.getString(PKG, "BaseTransformDialog.ClearAndAdd"),
- BaseMessages.getString(PKG, "BaseTransformDialog.Cancel"),
- },
- 0);
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHop());
- int idx = md.open();
- choice = idx & 0xFF;
- }
-
- if (choice == 3 || choice == 255) {
- return; // Cancel clicked
- }
-
- if (choice == 2) {
- tableView.clearAll(false);
- }
-
- for (int i = 0; i < row.size(); i++) {
- IValueMeta v = row.getValueMeta(i);
-
- boolean add = true;
-
- if (choice == 0) { // hang on, see if it's not yet in the table view
-
- if (keys.indexOf(v.getName()) >= 0) {
- add = false;
- }
- }
-
- if (add) {
- TableItem tableItem = new TableItem(table, SWT.NONE);
-
- for (int aNameColumn : nameColumn) {
- tableItem.setText(aNameColumn, Const.NVL(v.getName(), ""));
- }
-
- for (int aTokenNameColumn : tokenNameColumn) {
- tableItem.setText(aTokenNameColumn, Const.NVL(v.getName(), ""));
- }
-
- if (listener != null) {
- if (!listener.tableItemInserted(tableItem, v)) {
- tableItem.dispose(); // remove it again
- }
- }
- }
- }
- tableView.removeEmptyRows();
- tableView.setRowNums();
- tableView.optWidth(true);
- }
}
diff --git a/pom.xml b/pom.xml
index 6a22601..8f1c396 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,7 +116,6 @@
<jetty.version>9.4.35.v20201120</jetty.version>
<org.eclipse.platform.version>3.116.0</org.eclipse.platform.version>
<org.eclipse.commands.version>3.9.600</org.eclipse.commands.version>
- <org.eclipse.jface.version>3.22.100</org.eclipse.jface.version>
<org.eclipse.equinox.version>3.10.600</org.eclipse.equinox.version>
<rhino.version>1.7.12</rhino.version>
<httpclient.version>4.5.3</httpclient.version>
diff --git a/rap/pom.xml b/rap/pom.xml
index c790e62..a75bf79 100644
--- a/rap/pom.xml
+++ b/rap/pom.xml
@@ -14,7 +14,6 @@
~ 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.
- ~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -58,10 +57,5 @@
<artifactId>org.eclipse.rap.rwt</artifactId>
<version>${rap.version}</version>
</dependency>
- <dependency>
- <groupId>org.eclipse.rap</groupId>
- <artifactId>org.eclipse.rap.jface</artifactId>
- <version>${rap.version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/rcp/pom.xml b/rcp/pom.xml
index 6986cd2..e891f7d 100644
--- a/rcp/pom.xml
+++ b/rcp/pom.xml
@@ -14,7 +14,6 @@
~ 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.
- ~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -53,17 +52,5 @@
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.jface</artifactId>
- <version>${org.eclipse.jface.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
</project>
diff --git a/ui/pom.xml b/ui/pom.xml
index 6589910..87325bd 100644
--- a/ui/pom.xml
+++ b/ui/pom.xml
@@ -14,7 +14,6 @@
~ 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.
- ~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -67,17 +66,6 @@
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.jface</artifactId>
- <version>${org.eclipse.jface.version}</version>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>${org.eclipse.equinox.version}</version>
<exclusions>
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java
index ee1c114..5c1d027 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/BaseDialog.java
@@ -45,6 +45,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
@@ -54,14 +56,18 @@ import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
/** A base dialog class containing a body and a configurable button panel. */
@@ -516,4 +522,11 @@ public abstract class BaseDialog extends Dialog {
}
}
}
+
+ public static final int openMessageBox(Shell parent, String title, String message, int flags) {
+ MessageBox box = new MessageBox(parent, flags);
+ box.setText(title);
+ box.setMessage(message);
+ return box.open();
+ }
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/DetailsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/DetailsDialog.java
index 8955d8b..fd3d43e 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/DetailsDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/DetailsDialog.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -17,66 +17,90 @@
package org.apache.hop.ui.core.dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.apache.hop.core.Const;
+import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.ui.core.PropsUi;
+import org.apache.hop.ui.core.gui.WindowProperty;
+import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/** Created by bmorrise on 10/13/16. */
-public class DetailsDialog extends MessageDialog {
+public class DetailsDialog {
+ private Shell shell;
+ private PropsUi props;
- private String details;
- private Text detailsText;
+ private final String title;
+ private final String message;
+ private final Shell parent;
+ private final Image titleImage;
+ private final String details;
public DetailsDialog(
Shell parentShell,
String dialogTitle,
Image dialogTitleImage,
String dialogMessage,
- int dialogImageType,
- String[] dialogButtonLabels,
- int defaultIndex,
String details) {
- super(
- parentShell,
- dialogTitle,
- dialogTitleImage,
- dialogMessage,
- dialogImageType,
- dialogButtonLabels,
- defaultIndex);
-
+ this.title = dialogTitle;
+ this.message = dialogMessage;
+ this.parent = parentShell;
+ this.titleImage = dialogTitleImage;
this.details = details;
}
- @Override
- protected Control createMessageArea(Composite composite) {
- GridLayout gridLayout = (GridLayout) composite.getLayout();
- gridLayout.numColumns = 1;
- composite.setLayout(gridLayout);
+ public void open() {
+ shell = new Shell(parent, SWT.DIALOG_TRIM);
+ shell.setImage(titleImage);
+ shell.setText(Const.NVL(title, ""));
+ props = PropsUi.getInstance();
+
+ shell.setLayout(new FormLayout());
+
+ Button wClose = new Button(shell, SWT.PUSH);
+ props.setLook(wClose);
+ wClose.setText(BaseMessages.getString("System.Button.Close"));
+ wClose.addListener(SWT.Selection, e -> close());
+ BaseTransformDialog.positionBottomButtons(
+ shell,
+ new Button[] {
+ wClose,
+ },
+ Const.MARGIN,
+ null);
- if (this.message != null) {
- this.messageLabel = new Label(composite, this.getMessageLabelStyle());
- this.messageLabel.setText(this.message);
- }
+ Label wLabel = new Label(shell, SWT.LEFT);
+ props.setLook(wLabel);
+ wLabel.setText(Const.NVL(message, ""));
+ FormData fdLabel = new FormData();
+ fdLabel.left = new FormAttachment(0, 0);
+ fdLabel.top = new FormAttachment(0, 0);
+ fdLabel.right = new FormAttachment(100, 0);
+ wLabel.setLayoutData(fdLabel);
- if (this.details != null) {
- this.detailsText = new Text(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- this.detailsText.pack();
- this.detailsText.setText(this.details);
- GridData gridData = new GridData();
- gridData.widthHint = 1024;
- gridData.heightHint = 300;
- this.detailsText.setLayoutData(gridData);
- this.detailsText.setSelection(this.details.length());
- }
+ Text wDetails = new Text(shell, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ props.setLook(wDetails);
+ wDetails.setText(Const.NVL(details, ""));
+ wDetails.setSelection(details.length());
+ FormData fdDetails = new FormData();
+ fdDetails.left = new FormAttachment(0, 0);
+ fdDetails.right = new FormAttachment(100, 0);
+ fdDetails.top = new FormAttachment(wLabel, Const.MARGIN);
+ fdDetails.bottom = new FormAttachment(wClose, -2 * Const.MARGIN);
+ wDetails.setLayoutData(fdDetails);
+
+ BaseDialog.defaultShellHandling(shell, c -> close(), c -> close());
+ }
- return composite;
+ private void close() {
+ props.setScreen(new WindowProperty(shell));
+ shell.dispose();
}
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java
new file mode 100644
index 0000000..9c39052
--- /dev/null
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/DialogBoxWithButtons.java
@@ -0,0 +1,121 @@
+/*
+ * 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.core.dialog;
+
+import org.apache.hop.core.Const;
+import org.apache.hop.ui.core.PropsUi;
+import org.apache.hop.ui.core.gui.GuiResource;
+import org.apache.hop.ui.core.gui.WindowProperty;
+import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class DialogBoxWithButtons {
+
+ private PropsUi props;
+ private Shell shell;
+
+ private final Shell parent;
+ private final String title;
+ private final String message;
+ private final String[] buttonLabels;
+ private final AtomicInteger choice;
+
+ public DialogBoxWithButtons(Shell parent, String title, String message, String[] buttonLabels) {
+ this.parent = parent;
+ this.title = title;
+ this.message = message;
+ this.buttonLabels = buttonLabels;
+
+ choice = new AtomicInteger();
+ }
+
+ public int open() {
+ props = PropsUi.getInstance();
+ shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.CLOSE | SWT.RESIZE);
+ shell.setText(Const.NVL(title, ""));
+ shell.setImage(GuiResource.getInstance().getImageHopUi());
+ FormLayout formLayout = new FormLayout();
+ int formMargin = (int) (Const.FORM_MARGIN * props.getZoomFactor());
+ formLayout.marginTop = formMargin;
+ formLayout.marginLeft = formMargin;
+ formLayout.marginBottom = formMargin;
+ formLayout.marginRight = formMargin;
+ shell.setLayout(formLayout);
+
+ Label wLabel = new Label(shell, SWT.CENTER | SWT.WRAP);
+ props.setLook(wLabel);
+ wLabel.setText(Const.NVL(message, ""));
+ FormData fdLabel = new FormData();
+ fdLabel.left = new FormAttachment(0, 0);
+ fdLabel.top = new FormAttachment(0, 0);
+ fdLabel.right = new FormAttachment(100, 0);
+ wLabel.setLayoutData(fdLabel);
+
+ java.util.List<Button> buttons = new ArrayList<>();
+ for (int i = 0; i < buttonLabels.length; i++) {
+ String buttonLabel = buttonLabels[i];
+ Button button = new Button(shell, SWT.PUSH);
+ props.setLook(button);
+ button.setText(Const.NVL(buttonLabel, ""));
+ buttons.add(button);
+ final int index = i;
+ button.addListener(
+ SWT.Selection,
+ e -> {
+ choice.set(index);
+ dispose();
+ });
+ }
+ BaseTransformDialog.positionBottomButtons(
+ shell, buttons.toArray(new Button[0]), formMargin, wLabel);
+
+ BaseTransformDialog.setSize(shell);
+ shell.addListener(SWT.Close, e -> dispose());
+ BaseTransformDialog.setSize(shell);
+
+ shell.open();
+
+ Display display = shell.getDisplay();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ return choice.get();
+ }
+
+ private void close() {
+ choice.set(0xFF);
+ }
+
+ private void dispose() {
+ props.setScreen(new WindowProperty(shell));
+ shell.dispose();
+ }
+}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorWithDetailsDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorWithDetailsDialog.java
deleted file mode 100644
index e18f439..0000000
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ErrorWithDetailsDialog.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.core.dialog;
-
-import org.apache.hop.i18n.BaseMessages;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-
-/** Created by bmorrise on 10/13/16. */
-public class ErrorWithDetailsDialog extends MessageDialog {
- public static final Class<?> PKG = ErrorWithDetailsDialog.class;
-
- private int detailsIndex;
- private String details;
-
- public ErrorWithDetailsDialog(
- Shell parentShell,
- String dialogTitle,
- Image dialogTitleImage,
- String dialogMessage,
- int dialogImageType,
- String[] dialogButtonLabels,
- int defaultIndex,
- int detailsIndex,
- String details) {
- super(
- parentShell,
- dialogTitle,
- dialogTitleImage,
- dialogMessage,
- dialogImageType,
- dialogButtonLabels,
- defaultIndex);
-
- this.details = details;
- this.detailsIndex = detailsIndex;
- }
-
- @Override
- protected Point getInitialSize() {
- return getParentShell().computeSize(368, 107);
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- super.buttonPressed(buttonId);
- if (buttonId == detailsIndex) {
- DetailsDialog detailsDialog =
- new DetailsDialog(
- getParentShell(),
- BaseMessages.getString(PKG, "ErrorDialog.ShowDetail.Title"),
- null,
- BaseMessages.getString(PKG, "ErrorDialog.ShowDetail.Message"),
- 0,
- new String[] {BaseMessages.getString(PKG, "ErrorDialog.ShowDetail.Close")},
- 0,
- details);
- detailsDialog.open();
- }
- }
-}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/CheckBoxVar.java b/ui/src/main/java/org/apache/hop/ui/core/widget/CheckBoxVar.java
index 3bbd82d..301fe66 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/CheckBoxVar.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/widget/CheckBoxVar.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -17,12 +17,12 @@
package org.apache.hop.ui.core.widget;
+import org.apache.hop.core.Const;
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.PropsUi;
import org.apache.hop.ui.core.gui.GuiResource;
-import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyListener;
@@ -35,9 +35,11 @@ import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
/**
- * A Widget that combines a Check Box widget with a Variable button that will insert an Environment variable.
+ * A Widget that combines a Check Box widget with a Variable button that will insert an Environment
+ * variable.
*
* @author Matt
* @since 9-august-2006
@@ -47,20 +49,19 @@ public class CheckBoxVar extends Composite {
private static final PropsUi props = PropsUi.getInstance();
- private ControlDecoration controlDecoration;
-
private Button wBox;
private TextVar wText;
- public CheckBoxVar( IVariables variables, Composite composite, int flags ) {
- this( variables, composite, flags, null );
+ public CheckBoxVar(IVariables variables, Composite composite, int flags) {
+ this(variables, composite, flags, null);
}
- public CheckBoxVar( final IVariables variables, final Composite composite, int flags, String variable ) {
- super( composite, SWT.NONE );
+ public CheckBoxVar(
+ final IVariables variables, final Composite composite, int flags, String variable) {
+ super(composite, SWT.NONE);
- props.setLook( this );
+ props.setLook(this);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
@@ -68,85 +69,61 @@ public class CheckBoxVar extends Composite {
formLayout.marginTop = 0;
formLayout.marginBottom = 0;
- this.setLayout( formLayout );
+ this.setLayout(formLayout);
// add a text field on it...
- wBox = new Button( this, flags );
- props.setLook( wBox );
- wText = new TextVar( variables, this, flags | SWT.NO_BACKGROUND );
- wText.getTextWidget().setForeground( GuiResource.getInstance().getColorRed() ); // Put it in a red color to make it
+ wBox = new Button(this, flags);
+ props.setLook(wBox);
+ wText = new TextVar(variables, this, flags | SWT.NO_BACKGROUND);
+ wText
+ .getTextWidget()
+ .setForeground(GuiResource.getInstance().getColorRed()); // Put it in a red color to make it
// shine...
- wText.getTextWidget().setBackground( composite.getBackground() ); // make it blend in with the rest...
-
- setVariableOnCheckBox( variable );
-
- controlDecoration = new ControlDecoration( wBox, SWT.CENTER | SWT.LEFT );
- Image image = GuiResource.getInstance().getImageVariable();
- controlDecoration.setImage( image );
- controlDecoration.setDescriptionText( BaseMessages.getString( PKG, "CheckBoxVar.tooltip.InsertVariable" ) );
- controlDecoration.addSelectionListener( new SelectionAdapter() {
-
- @Override
- public void widgetSelected( SelectionEvent arg0 ) {
- String variableName = VariableButtonListenerFactory.getVariableName( composite.getShell(), variables );
- if ( variableName != null ) {
- setVariableOnCheckBox( "${" + variableName + "}" );
- }
- }
- } );
+ wText
+ .getTextWidget()
+ .setBackground(composite.getBackground()); // make it blend in with the rest...
+ wText.setText(Const.NVL(variable, ""));
FormData fdBox = new FormData();
- fdBox.top = new FormAttachment( 0, 0 );
- fdBox.left = new FormAttachment( 0, image.getBounds().width );
- wBox.setLayoutData( fdBox );
+ fdBox.top = new FormAttachment(wText, 0, SWT.CENTER);
+ fdBox.left = new FormAttachment(0, 0);
+ wBox.setLayoutData(fdBox);
FormData fdText = new FormData();
- fdText.top = new FormAttachment( 0, 0 );
- fdText.left = new FormAttachment( wBox, props.getMargin() );
- fdText.right = new FormAttachment( 100, 0 );
- wText.setLayoutData( fdText );
- }
-
- private void setVariableOnCheckBox( String variableName ) {
- if ( !Utils.isEmpty( variableName ) ) {
- wText.setText( variableName );
- } else {
- wText.setText( "" );
- }
+ fdText.top = new FormAttachment(0, 0);
+ fdText.left = new FormAttachment(wBox, props.getMargin());
+ fdText.right = new FormAttachment(100, 0);
+ wText.setLayoutData(fdText);
}
- /**
- * @return the text in the Text widget
- */
+ /** @return the text in the Text widget */
public String getText() {
return wBox.getText();
}
- /**
- * @param text the text in the Text widget to set.
- */
- public void setText( String text ) {
- wBox.setText( text );
+ /** @param text the text in the Text widget to set. */
+ public void setText(String text) {
+ wBox.setText(text);
}
- public void addSelectionListener( SelectionAdapter lsDef ) {
- wBox.addSelectionListener( lsDef );
+ public void addSelectionListener(SelectionAdapter lsDef) {
+ wBox.addSelectionListener(lsDef);
}
- public void addKeyListener( KeyListener lsKey ) {
- wBox.addKeyListener( lsKey );
+ public void addKeyListener(KeyListener lsKey) {
+ wBox.addKeyListener(lsKey);
}
- public void addFocusListener( FocusListener lsFocus ) {
- wBox.addFocusListener( lsFocus );
+ public void addFocusListener(FocusListener lsFocus) {
+ wBox.addFocusListener(lsFocus);
}
- public void setEnabled( boolean flag ) {
- wBox.setEnabled( flag );
+ public void setEnabled(boolean flag) {
+ wBox.setEnabled(flag);
}
- public void setSelection( boolean selection ) {
- wBox.setSelection( selection );
+ public void setSelection(boolean selection) {
+ wBox.setSelection(selection);
}
public boolean getSelection() {
@@ -157,19 +134,19 @@ public class CheckBoxVar extends Composite {
return wBox.setFocus();
}
- public void addTraverseListener( TraverseListener tl ) {
- wBox.addTraverseListener( tl );
+ public void addTraverseListener(TraverseListener tl) {
+ wBox.addTraverseListener(tl);
}
public String getVariableName() {
return wText.getText();
}
- public void setVariableName( String variableName ) {
- if ( variableName != null ) {
- wText.setText( variableName );
+ public void setVariableName(String variableName) {
+ if (variableName != null) {
+ wText.setText(variableName);
} else {
- wText.setText( "" );
+ wText.setText("");
}
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/StyledTextComp.java b/ui/src/main/java/org/apache/hop/ui/core/widget/StyledTextComp.java
index 80ad9cb..08356ad 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/StyledTextComp.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/widget/StyledTextComp.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -18,13 +18,12 @@
package org.apache.hop.ui.core.widget;
import org.apache.commons.lang.StringUtils;
-import org.apache.hop.core.util.StringUtil;
+import org.apache.hop.core.Const;
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.gui.GuiResource;
-import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
@@ -49,64 +48,60 @@ public class StyledTextComp extends Composite {
private static final Class<?> PKG = StyledTextComp.class; // For Translator
// Modification for Undo/Redo on Styled Text
- private Text textWidget;
- private Menu styledTextPopupmenu;
- private String strTabName;
- private Composite xParent;
+ private final Text textWidget;
+ private final Menu styledTextPopupmenu;
+ private final Composite xParent;
private Image image;
- private IVariables variables;
- private boolean varsSensitive;
-
- public StyledTextComp( IVariables variables, Composite parent, int args ) {
+ public StyledTextComp(IVariables variables, Composite parent, int args) {
this(variables, parent, args, true, false);
}
- public StyledTextComp(
- IVariables variables, Composite parent, int args, boolean varsSensitive ) {
+ public StyledTextComp(IVariables variables, Composite parent, int args, boolean varsSensitive) {
this(variables, parent, args, varsSensitive, false);
}
public StyledTextComp(
- IVariables variables,
- Composite parent,
- int args,
- boolean varsSensitive,
- boolean variableIconOnTop ) {
+ IVariables variables,
+ Composite parent,
+ int args,
+ boolean varsSensitive,
+ boolean variableIconOnTop) {
+
super(parent, SWT.NONE);
- this.varsSensitive = varsSensitive;
- this.variables = variables;
textWidget = new Text(this, args);
styledTextPopupmenu = new Menu(parent.getShell(), SWT.POP_UP);
xParent = parent;
- this.strTabName = strTabName;
- // clipboard = new Clipboard(parent.getDisplay());
this.setLayout(variableIconOnTop ? new FormLayout() : new FillLayout());
buildingStyledTextMenu();
- if (this.varsSensitive) {
- textWidget.addKeyListener(new ControlSpaceKeyAdapter(this.variables, textWidget ));
+ if (varsSensitive) {
+ textWidget.addKeyListener(new ControlSpaceKeyAdapter(variables, textWidget));
image = GuiResource.getInstance().getImageVariable();
if (variableIconOnTop) {
- final Label wicon = new Label(this, SWT.RIGHT);
- PropsUi.getInstance().setLook(wicon);
- wicon.setToolTipText(BaseMessages.getString(PKG, "StyledTextComp.tooltip.InsertVariable"));
- wicon.setImage(image);
- wicon.setLayoutData(new FormDataBuilder().top().right(100, 0).result());
+ final Label wIcon = new Label(this, SWT.RIGHT);
+ PropsUi.getInstance().setLook(wIcon);
+ wIcon.setToolTipText(BaseMessages.getString(PKG, "StyledTextComp.tooltip.InsertVariable"));
+ wIcon.setImage(image);
+ wIcon.setLayoutData(new FormDataBuilder().top().right(100, 0).result());
textWidget.setLayoutData(
new FormDataBuilder()
- .top(new FormAttachment(wicon, 0, 0))
+ .top(new FormAttachment(wIcon, 0, 0))
.left()
.right(100, 0)
.bottom(100, 0)
.result());
} else {
- ControlDecoration controlDecoration =
- new ControlDecoration( textWidget, SWT.TOP | SWT.RIGHT);
+ Label controlDecoration = new Label(parent, SWT.NONE);
controlDecoration.setImage(image);
- controlDecoration.setDescriptionText(
+ controlDecoration.setToolTipText(
BaseMessages.getString(PKG, "StyledTextComp.tooltip.InsertVariable"));
- PropsUi.getInstance().setLook(controlDecoration.getControl());
+ PropsUi.getInstance().setLook(controlDecoration);
+ controlDecoration.setLayoutData(
+ new FormDataBuilder()
+ .top(new FormAttachment(textWidget, 0, SWT.TOP))
+ .left(new FormAttachment(textWidget, Const.MARGIN, SWT.RIGHT))
+ .result());
}
}
}
@@ -185,7 +180,7 @@ public class StyledTextComp extends Composite {
textWidget.addMenuDetectListener(
e -> {
styledTextPopupmenu.getItem(2).setEnabled(checkPaste());
- if ( textWidget.getSelectionCount() > 0) {
+ if (textWidget.getSelectionCount() > 0) {
styledTextPopupmenu.getItem(0).setEnabled(true);
styledTextPopupmenu.getItem(1).setEnabled(true);
} else {
@@ -212,7 +207,6 @@ public class StyledTextComp extends Composite {
}
}
-
public Image getImage() {
return image;
}
@@ -243,16 +237,12 @@ public class StyledTextComp extends Composite {
}
}
- /**
- * @return The caret line number, starting from 1.
- */
+ /** @return The caret line number, starting from 1. */
public int getLineNumber() {
- return textWidget.getCaretLineNumber()+1;
+ return textWidget.getCaretLineNumber() + 1;
}
- /**
- * @return The caret column number, starting from 1.
- */
+ /** @return The caret column number, starting from 1. */
public int getColumnNumber() {
String text = textWidget.getText();
if (StringUtils.isEmpty(text)) {
@@ -261,7 +251,9 @@ public class StyledTextComp extends Composite {
int columnNumber = 1;
int textPosition = textWidget.getCaretPosition();
- while ( textPosition > 0 && text.charAt( textPosition - 1 ) != '\n' && text.charAt( textPosition - 1 ) != '\r' ) {
+ while (textPosition > 0
+ && text.charAt(textPosition - 1) != '\n'
+ && text.charAt(textPosition - 1) != '\r') {
textPosition--;
columnNumber++;
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/TableDraw.java b/ui/src/main/java/org/apache/hop/ui/core/widget/TableDraw.java
deleted file mode 100644
index 752272b..0000000
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/TableDraw.java
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * 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.core.widget;
-
-import org.apache.hop.core.gui.ITextFileInputField;
-import org.apache.hop.ui.core.PropsUi;
-import org.apache.hop.ui.core.gui.GuiResource;
-import org.apache.hop.ui.hopgui.TextSizeUtilFacade;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ScrollBar;
-
-import java.util.List;
-import java.util.Vector;
-
-/**
- * Widget to draw the character of a fixed length text-file in a graphical way.
- *
- * @author Matt
- * @since 17-04-2004
- */
-public class TableDraw extends Canvas {
- private Display display;
- private Color bg;
- // private Font font;
- private Color black, red, blue, lgray;
- private Point offset;
- private ScrollBar hori;
- private ScrollBar vert;
- private int maxlen;
-
- private int fontheight;
- private int fontwidth;
-
- private Image cache_image;
- private int prevFromX, prevToX, prevFromY, prevToY;
-
- private Vector<ITextFileInputField> fields;
-
- private List<String> rows;
-
- private static final int LEFT = 50;
- private static final int TOP = 30;
- private static final int MARGIN = 10;
-
- private int potential_click;
-
- private WizardPage wPage;
- private String prevfieldname;
-
- public TableDraw(
- Composite parent, PropsUi props, WizardPage wPage, Vector<ITextFileInputField> fields) {
- super(parent, SWT.NO_BACKGROUND | SWT.H_SCROLL | SWT.V_SCROLL);
- this.wPage = wPage;
- this.fields = fields;
-
- prevfieldname = "";
-
- potential_click = -1;
-
- // Cache displayed text...
- cache_image = null;
- prevFromX = -1;
- prevToX = -1;
- prevFromY = -1;
- prevToY = -1;
-
- display = parent.getDisplay();
- bg = GuiResource.getInstance().getColorBackground();
- fontheight = props.getDefaultFont().getHeight();
-
- black = GuiResource.getInstance().getColorBlack();
- red = GuiResource.getInstance().getColorRed();
- blue = GuiResource.getInstance().getColorBlue();
- lgray = GuiResource.getInstance().getColorLightGray();
-
- hori = getHorizontalBar();
- vert = getVerticalBar();
-
- // Determine font width...
- String teststring = "ABCDEF";
- fontwidth = Math.round(TextSizeUtilFacade.textExtent(teststring).x / teststring.length());
-
- setBackground(bg);
- // setFont(font);
-
- addPaintListener(e -> TableDraw.this.paintControl(e));
-
- addDisposeListener(
- arg0 -> {
- if (cache_image != null) {
- cache_image.dispose();
- }
- });
-
- hori.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- redraw();
- }
- });
- vert.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- redraw();
- }
- });
- hori.setThumb(100);
- vert.setThumb(100);
-
- // Mouse events!
-
- addMouseListener(
- new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- Point offset = getOffset();
- int posx =
- (int) Math.round((double) (e.x - LEFT - MARGIN - offset.x) / ((double) fontwidth));
-
- if (posx > 0) {
- potential_click = posx;
-
- redraw();
- }
- }
-
- public void mouseUp(MouseEvent e) {
- if (potential_click > 0) {
- setMarker(potential_click); // clear or set!
- potential_click = -1;
-
- redraw();
- }
- }
- });
-
- addMouseMoveListener(
- e -> {
- int posx =
- (int) Math.round((double) (e.x - LEFT - MARGIN - offset.x) / ((double) fontwidth));
-
- // Clicked and mouse is down: move marker to a new location...
- if (potential_click >= 0) {
- if (posx > 0) {
- potential_click = posx;
- redraw();
- }
- }
-
- ITextFileInputField field = getFieldOnPosition(posx);
- if (field != null && !field.getName().equalsIgnoreCase(prevfieldname)) {
- setToolTipText(field.getName() + " : length=" + field.getLength());
- prevfieldname = field.getName();
- }
- });
- }
-
- private ITextFileInputField getFieldOnPosition(int x) {
- for (int i = 0; i < fields.size(); i++) {
- ITextFileInputField field = fields.get(i);
- int pos = field.getPosition();
- int len = field.getLength();
- if (pos <= x && pos + len > x) {
- return field;
- }
- }
- return null;
- }
-
- private void setMarker(int x) {
- int idx = -1;
- int highest_smaller = -1;
-
- for (int i = 0; i < fields.size(); i++) {
- ITextFileInputField field = fields.get(i);
-
- int pos = field.getPosition();
- int len = field.getLength();
-
- if (pos == potential_click) {
- idx = i;
- }
- if (highest_smaller < 0 && pos + len >= x) {
- highest_smaller = i; // The first time this occurs is OK.
- }
- }
-
- // OK, so we need to add a new field on the location of the previous one
- // Actually, we make the previous field shorter
- //
- // Field 1: pos=0, length=100
- //
- // becomes
- //
- // Field1: pos=0, length=50
- // Field2: pos=51, length=50
- //
- // We know the number of the new field : lowest_larger.
- //
- // Note: We should always have one field @ position 0, length max
- //
- if (idx < 0) { // Position is not yet in the list, the field is not deleted, but added
- if (highest_smaller >= 0) {
- // OK, let's add a new field, but split the length of the previous field
- // We want to keep this list sorted, so add at position lowest_larger.
- // We want to change the previous entry and add another after it.
- ITextFileInputField prevfield = fields.get(highest_smaller);
- int newlength = prevfield.getLength() - (x - prevfield.getPosition());
- ITextFileInputField field = prevfield.createNewInstance(getNewFieldname(), x, newlength);
- fields.add(highest_smaller + 1, field);
-
- // Don't forget to make the previous field shorter
- prevfield.setLength(x - prevfield.getPosition());
- }
- } else {
- if (highest_smaller >= 0) {
- // Now we need to remove the field with the same starting position
- // The previous field need to receive extra length
- ITextFileInputField prevfield = fields.get(highest_smaller);
- ITextFileInputField field = fields.get(idx);
- prevfield.setLength(prevfield.getLength() + field.getLength());
- // Remove the field
- fields.remove(idx);
- }
- }
-
- // Something has changed: change wizard page...
- wPage.setPageComplete(wPage.canFlipToNextPage());
- }
-
- // Loop from 1 to ... and see if we have an empty Fieldnr available.
- private String getNewFieldname() {
- int nr = 1;
- String name = "Field" + nr;
- while (fieldExists(name)) {
- nr++;
- name = "Field" + nr;
- }
- return name;
- }
-
- private boolean fieldExists(String name) {
- for (int i = 0; i < fields.size(); i++) {
- ITextFileInputField field = fields.get(i);
-
- if (name.equalsIgnoreCase(field.getName())) {
- return true;
- }
- }
- return false;
- }
-
- public void setRows(List<String> rows) {
- this.rows = rows;
- maxlen = getMaxLength();
- redraw();
- }
-
- // Draw the widget.
- public void paintControl(PaintEvent e) {
- offset = getOffset();
- if (offset == null) {
- return;
- }
-
- Point area = getArea();
- Point max = getMaximum();
- Point thumb = getThumb(area, max);
-
- hori.setThumb(thumb.x);
- vert.setThumb(thumb.y);
-
- // From where do we need to draw?
- int fromy = -offset.y / (fontheight + 2);
- int toy = fromy + (area.y / (fontheight + 2));
- int fromx = -offset.x / fontwidth;
- int tox = fromx + (area.x / fontwidth);
-
- Image image = new Image(display, area.x, area.y);
-
- if (fromx != prevFromX || fromy != prevFromY || tox != prevToX || toy != prevToY) {
- if (cache_image != null) {
- cache_image.dispose();
- cache_image = null;
- }
- cache_image = new Image(display, area.x, area.y);
-
- GC gc = new GC(cache_image);
-
- // We have a cached image: draw onto it!
- int linepos = TOP - 5;
-
- gc.setBackground(bg);
- gc.fillRectangle(LEFT, TOP, area.x, area.y);
-
- // We draw in black...
- gc.setForeground(black);
- // gc.setFont(font);
-
- // Draw the text
- //
- for (int i = fromy; i < rows.size() && i < toy; i++) {
- String str = rows.get(i);
- for (int p = fromx; p < str.length() && p < tox; p++) {
- gc.drawText(
- "" + str.charAt(p),
- LEFT + MARGIN + p * fontwidth + offset.x,
- TOP + i * (fontheight + 2) + offset.y,
- true);
- }
-
- if (str.length() < tox) {
- gc.setForeground(red);
- gc.setBackground(red);
- int x_oval = LEFT + MARGIN + str.length() * fontwidth + offset.x;
- int y_oval = TOP + i * (fontheight + 2) + offset.y;
- gc.drawOval(x_oval, y_oval, fontwidth, fontheight);
- gc.fillOval(x_oval, y_oval, fontwidth, fontheight);
- gc.setForeground(black);
- gc.setBackground(bg);
- }
- }
-
- // Draw the rulers
- // HORIZONTAL
- gc.setBackground(lgray);
- gc.fillRectangle(LEFT + MARGIN, 0, area.x, linepos + 1);
- gc.setBackground(bg);
-
- gc.drawLine(LEFT + MARGIN, linepos, area.x, linepos);
-
- // Little tabs, small ones, every 5 big one, every 10 the number above...
- for (int i = fromx; i < maxlen + 10 && i < tox + 10; i++) {
- String number = "" + i;
- int numsize = number.length() * fontwidth;
-
- if (i > 0 && (i % 10) == 0) {
- gc.drawText(
- "" + i,
- LEFT + MARGIN + i * fontwidth - numsize / 2 + offset.x,
- linepos - 10 - fontheight,
- true);
- }
-
- if (i > 0 && (i % 5) == 0) {
- gc.drawLine(
- LEFT + MARGIN + i * fontwidth + offset.x,
- linepos,
- LEFT + MARGIN + i * fontwidth + offset.x,
- linepos - 5);
- } else {
- gc.drawLine(
- LEFT + MARGIN + i * fontwidth + offset.x,
- linepos,
- LEFT + MARGIN + i * fontwidth + offset.x,
- linepos - 3);
- }
- }
-
- // VERTICIAL
- gc.setBackground(lgray);
- gc.fillRectangle(0, TOP, LEFT, area.y);
-
- gc.drawLine(LEFT, TOP, LEFT, area.y);
-
- for (int i = fromy; i < rows.size() && i < toy; i++) {
- String number = "" + (i + 1);
- int numsize = number.length() * fontwidth;
- gc.drawText(number, LEFT - 5 - numsize, TOP + i * (fontheight + 2) + offset.y, true);
- gc.drawLine(
- LEFT,
- TOP + (i + 1) * (fontheight + 2) + offset.y,
- LEFT - 5,
- TOP + (i + 1) * (fontheight + 2) + offset.y);
- }
-
- gc.dispose();
- }
-
- GC gc = new GC(image);
-
- // Draw the cached image onto the canvas image:
- gc.drawImage(cache_image, 0, 0);
-
- // Also draw the markers...
- gc.setForeground(red);
- gc.setBackground(red);
- for (int i = 0; i < fields.size(); i++) {
- int x = (fields.get(i)).getPosition();
- if (x >= fromx && x <= tox) {
- drawMarker(gc, x, area.y);
- }
- }
- if (potential_click >= 0) {
- gc.setForeground(blue);
- gc.setBackground(blue);
- drawMarker(gc, potential_click, area.y);
- }
-
- // Draw the image:
- e.gc.drawImage(image, 0, 0);
- gc.dispose();
- image.dispose();
- }
-
- private void drawMarker(GC gc, int x, int maxy) {
- int[] triangle =
- new int[] {
- LEFT + MARGIN + x * fontwidth + offset.x, TOP - 4,
- LEFT + MARGIN + x * fontwidth + offset.x + 3,
- TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x - 3, TOP + 1
- };
- gc.fillPolygon(triangle);
- gc.drawPolygon(triangle);
- gc.drawLine(
- LEFT + MARGIN + x * fontwidth + offset.x,
- TOP + 1,
- LEFT + MARGIN + x * fontwidth + offset.x,
- maxy);
- }
-
- private Point getOffset() {
- Point area = getArea();
- Point max = getMaximum();
- Point thumb = getThumb(area, max);
- Point offset = getOffset(thumb, area);
-
- return offset;
- }
-
- private Point getThumb(Point area, Point max) {
- Point thumb = new Point(0, 0);
- if (max.x <= area.x) {
- thumb.x = 100;
- } else {
- thumb.x = Math.round(100 * area.x / max.x);
- }
- if (max.y <= area.y) {
- thumb.y = 100;
- } else {
- thumb.y = Math.round(100 * area.y / max.y);
- }
-
- return thumb;
- }
-
- private Point getOffset(Point thumb, Point area) {
- Point p = new Point(0, 0);
- Point sel = new Point(hori.getSelection(), vert.getSelection());
-
- if (thumb.x == 0 || thumb.y == 0) {
- return p;
- }
-
- p.x = Math.round(-sel.x * area.x / thumb.x);
- p.y = Math.round(-sel.y * area.y / thumb.y);
-
- return p;
- }
-
- private Point getMaximum() {
- int maxx = 0;
- int maxy = (rows.size() + 10) * (fontheight + 2);
-
- for (int i = 0; i < rows.size(); i++) {
- String str = rows.get(i);
- int len = (str.length() + 10) * fontwidth;
-
- if (maxx < len) {
- maxx = len;
- }
- }
-
- return new Point(maxx, maxy);
- }
-
- private int getMaxLength() {
- int maxx = 0;
-
- for (int i = 0; i < rows.size(); i++) {
- String str = rows.get(i);
- int len = str.length();
-
- if (maxx < len) {
- maxx = len;
- }
- }
-
- return maxx;
- }
-
- private Point getArea() {
- Rectangle rect = getClientArea();
- Point area = new Point(rect.width, rect.height);
-
- return area;
- }
-
- public Vector<ITextFileInputField> getFields() {
- return fields;
- }
-
- public void setFields(Vector<ITextFileInputField> fields) {
- this.fields = fields;
- }
-
- public void clearFields() {
- fields = new Vector<>();
- }
-}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/TextVar.java b/ui/src/main/java/org/apache/hop/ui/core/widget/TextVar.java
index edda95e..39f4767 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/TextVar.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/widget/TextVar.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -149,7 +149,9 @@ public class TextVar extends Composite {
this.insertTextInterface = insertTextInterface;
this.variables = variables;
- PropsUi.getInstance().setLook(this);
+ PropsUi props = PropsUi.getInstance();
+
+ props.setLook(this);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
@@ -161,20 +163,21 @@ public class TextVar extends Composite {
// Add the variable $ image on the top right of the control
//
- Label wlImage = new Label(this, SWT.NONE);
- wlImage.setImage(GuiResource.getInstance().getImageVariable());
- wlImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
+ Label wImage = new Label(this, SWT.NONE);
+ props.setLook(wImage);
+ wImage.setImage(GuiResource.getInstance().getImageVariable());
+ wImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
FormData fdlImage = new FormData();
fdlImage.top = new FormAttachment(0, 0);
fdlImage.right = new FormAttachment(100, 0);
- wlImage.setLayoutData(fdlImage);
+ wImage.setLayoutData(fdlImage);
// add a text field on it...
wText = new Text(this, flags);
FormData fdText = new FormData();
fdText.top = new FormAttachment(0, 0);
fdText.left = new FormAttachment(0, 0);
- fdText.right = new FormAttachment(wlImage, 0);
+ fdText.right = new FormAttachment(wImage, 0);
fdText.bottom = new FormAttachment(100, 0);
wText.setLayoutData(fdText);
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/TextVarButton.java b/ui/src/main/java/org/apache/hop/ui/core/widget/TextVarButton.java
index 374b4a7..235de6d 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/TextVarButton.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/widget/TextVarButton.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -21,10 +21,8 @@ import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.gui.GuiResource;
-import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
@@ -35,68 +33,82 @@ import org.eclipse.swt.widgets.Text;
public class TextVarButton extends TextVar {
- public TextVarButton( IVariables variables, Composite composite, int flags,
- IGetCaretPosition getCaretPositionInterface, IInsertText insertTextInterface,
- SelectionListener selectionListener ) {
- super( composite, variables, flags, getCaretPositionInterface, insertTextInterface, selectionListener );
+ public TextVarButton(
+ IVariables variables,
+ Composite composite,
+ int flags,
+ IGetCaretPosition getCaretPositionInterface,
+ IInsertText insertTextInterface,
+ SelectionListener selectionListener) {
+ super(
+ composite,
+ variables,
+ flags,
+ getCaretPositionInterface,
+ insertTextInterface,
+ selectionListener);
}
- protected void initialize( IVariables variables, Composite composite, int flags, String toolTipText,
- IGetCaretPosition getCaretPositionInterface, IInsertText insertTextInterface,
- SelectionListener selectionListener ) {
+ protected void initialize(
+ IVariables variables,
+ Composite composite,
+ int flags,
+ String toolTipText,
+ IGetCaretPosition getCaretPositionInterface,
+ IInsertText insertTextInterface,
+ SelectionListener selectionListener) {
this.toolTipText = toolTipText;
this.getCaretPositionInterface = getCaretPositionInterface;
this.insertTextInterface = insertTextInterface;
this.variables = variables;
- PropsUi.getInstance().setLook( this );
+ PropsUi.getInstance().setLook(this);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
formLayout.marginTop = 0;
formLayout.marginBottom = 0;
- this.setLayout( formLayout );
+ this.setLayout(formLayout);
- Button button = new Button( this, SWT.PUSH );
- PropsUi.getInstance().setLook( button );
- button.setText( "..." );
+ Button button = new Button(this, SWT.PUSH);
+ PropsUi.getInstance().setLook(button);
+ button.setText("...");
FormData fdButton = new FormData();
- fdButton.top = new FormAttachment( 0, 0 );
- fdButton.right = new FormAttachment( 100, 0 );
- fdButton.bottom = new FormAttachment( 100 );
+ fdButton.top = new FormAttachment(0, 0);
+ fdButton.right = new FormAttachment(100, 0);
+ fdButton.bottom = new FormAttachment(100);
fdButton.width = 30;
- button.setLayoutData( fdButton );
- if ( selectionListener != null ) {
- button.addSelectionListener( selectionListener );
+ button.setLayoutData(fdButton);
+ if (selectionListener != null) {
+ button.addSelectionListener(selectionListener);
}
// Add the variable $ image on the top right of the control
//
- Label wlImage = new Label( this, SWT.NONE );
- wlImage.setImage( GuiResource.getInstance().getImageVariable() );
- wlImage.setToolTipText( BaseMessages.getString( PKG, "TextVar.tooltip.InsertVariable" ) );
+ Label wlImage = new Label(this, SWT.NONE);
+ wlImage.setImage(GuiResource.getInstance().getImageVariable());
+ wlImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
FormData fdlImage = new FormData();
- fdlImage.top = new FormAttachment( 0, 0 );
- fdlImage.right = new FormAttachment( button, 0 );
- wlImage.setLayoutData( fdlImage );
+ fdlImage.top = new FormAttachment(0, 0);
+ fdlImage.right = new FormAttachment(button, 0);
+ wlImage.setLayoutData(fdlImage);
// add a text field on it...
- wText = new Text( this, flags );
+ wText = new Text(this, flags);
FormData fdText = new FormData();
- fdText.top = new FormAttachment( 0, 0 );
- fdText.left = new FormAttachment( 0, 0 );
- fdText.right = new FormAttachment( wlImage, 0 );
- fdText.bottom = new FormAttachment( 100, 0 );
- wText.setLayoutData( fdText );
+ fdText.top = new FormAttachment(0, 0);
+ fdText.left = new FormAttachment(0, 0);
+ fdText.right = new FormAttachment(wlImage, 0);
+ fdText.bottom = new FormAttachment(100, 0);
+ wText.setLayoutData(fdText);
- modifyListenerTooltipText = getModifyListenerTooltipText( wText );
- wText.addModifyListener( modifyListenerTooltipText );
+ modifyListenerTooltipText = getModifyListenerTooltipText(wText);
+ wText.addModifyListener(modifyListenerTooltipText);
controlSpaceKeyAdapter =
- new ControlSpaceKeyAdapter( variables, wText, getCaretPositionInterface, insertTextInterface );
- wText.addKeyListener( controlSpaceKeyAdapter );
-
+ new ControlSpaceKeyAdapter(
+ variables, wText, getCaretPositionInterface, insertTextInterface);
+ wText.addKeyListener(controlSpaceKeyAdapter);
}
-
}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/warning/TextVarWarning.java b/ui/src/main/java/org/apache/hop/ui/core/widget/warning/TextVarWarning.java
deleted file mode 100644
index 9a06ab8..0000000
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/warning/TextVarWarning.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.core.widget.warning;
-
-import org.apache.hop.core.variables.IVariables;
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.ui.core.gui.GuiResource;
-import org.apache.hop.ui.core.widget.CheckBoxVar;
-import org.apache.hop.ui.core.widget.TextVar;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Image;
-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 java.util.ArrayList;
-import java.util.List;
-
-/**
- * A Widget that combines a TextVar widget with a "Warning" image to the right. It's shown when
- * there is a warning condition in the text field.
- *
- * @author Matt
- * @since 15-MAR-2009
- */
-public class TextVarWarning extends Composite implements ISupportsWarning {
- private static final Class<?> PKG = CheckBoxVar.class; // For Translator
-
- private ControlDecoration warningControlDecoration;
-
- private TextVar wText;
-
- private List<IWarning> warningInterfaces;
-
- public TextVarWarning(IVariables variables, Composite composite, int flags) {
- super(composite, SWT.NONE);
-
- warningInterfaces = new ArrayList<>();
-
- FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = 0;
- formLayout.marginHeight = 0;
- formLayout.marginTop = 0;
- formLayout.marginBottom = 0;
-
- this.setLayout(formLayout);
-
- // add a text field on it...
- wText = new TextVar(variables, this, flags);
-
- warningControlDecoration = new ControlDecoration(wText, SWT.CENTER | SWT.RIGHT);
- Image warningImage = GuiResource.getInstance().getImageWarning();
- warningControlDecoration.setImage(warningImage);
- warningControlDecoration.setDescriptionText(
- BaseMessages.getString(PKG, "TextVar.tooltip.FieldIsInUse"));
- warningControlDecoration.hide();
-
- // If something has changed, check the warning interfaces
- //
- wText.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent arg0) {
-
- // Verify all the warning interfaces.
- // Show the first that has a warning to show...
- //
- boolean foundOne = false;
- for (IWarning warningInterface : warningInterfaces) {
- IWarningMessage warningSituation =
- warningInterface.getWarningSituation(wText.getText(), wText, this);
- if (warningSituation.isWarning()) {
- foundOne = true;
- warningControlDecoration.show();
- warningControlDecoration.setDescriptionText(warningSituation.getWarningMessage());
- break;
- }
- }
- if (!foundOne) {
- warningControlDecoration.hide();
- }
- }
- });
-
- FormData fdText = new FormData();
- fdText.top = new FormAttachment(0, 0);
- fdText.left = new FormAttachment(0, 0);
- fdText.right = new FormAttachment(100, -warningImage.getBounds().width);
- wText.setLayoutData(fdText);
- }
-
- /** @return the text in the Text widget */
- public String getText() {
- return wText.getText();
- }
-
- /** @param text the text in the Text widget to set. */
- public void setText(String text) {
- wText.setText(text);
- }
-
- public TextVar getTextWidget() {
- return wText;
- }
-
- /**
- * Add a modify listener to the text widget
- *
- * @param modifyListener
- */
- public void addModifyListener(ModifyListener modifyListener) {
- wText.addModifyListener(modifyListener);
- }
-
- public void addSelectionListener(SelectionAdapter lsDef) {
- wText.addSelectionListener(lsDef);
- }
-
- public void addKeyListener(KeyListener lsKey) {
- wText.addKeyListener(lsKey);
- }
-
- public void addFocusListener(FocusListener lsFocus) {
- wText.addFocusListener(lsFocus);
- }
-
- public void setEchoChar(char c) {
- wText.setEchoChar(c);
- }
-
- public void setEnabled(boolean flag) {
- wText.setEnabled(flag);
- }
-
- public boolean setFocus() {
- return wText.setFocus();
- }
-
- public void addTraverseListener(TraverseListener tl) {
- wText.addTraverseListener(tl);
- }
-
- public void setEditable(boolean editable) {
- wText.setEditable(editable);
- }
-
- public void setSelection(int i) {
- wText.setSelection(i);
- }
-
- public void selectAll() {
- wText.selectAll();
- }
-
- public void showSelection() {
- wText.showSelection();
- }
-
- public void addWarning(IWarning warningInterface) {
- warningInterfaces.add(warningInterface);
- }
-
- public void removeWarningInterface(IWarning warningInterface) {
- warningInterfaces.remove(warningInterface);
- }
-
- public List<IWarning> getWarningInterfaces() {
- return warningInterfaces;
- }
-}
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/warning/WarningText.java b/ui/src/main/java/org/apache/hop/ui/core/widget/warning/WarningText.java
deleted file mode 100644
index 422e2e3..0000000
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/warning/WarningText.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.core.widget.warning;
-
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.ui.core.gui.GuiResource;
-import org.apache.hop.ui.core.widget.CheckBoxVar;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Image;
-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.Text;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A Widget that combines a Text widget with a "Warning" image to the left. It's shown when there is
- * a warning condition in the text field.
- *
- * @author Matt
- * @since 25-FEB-2009
- */
-public class WarningText extends Composite implements ISupportsWarning {
- private static final Class<?> PKG = CheckBoxVar.class; // For Translator
-
- private ControlDecoration warningControlDecoration;
-
- private Text wText;
-
- private List<IWarning> warningInterfaces;
-
- public WarningText(Composite composite, int flags) {
- super(composite, SWT.NONE);
-
- warningInterfaces = new ArrayList<>();
-
- FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = 0;
- formLayout.marginHeight = 0;
- formLayout.marginTop = 0;
- formLayout.marginBottom = 0;
-
- this.setLayout(formLayout);
-
- // add a text field on it...
- wText = new Text(this, flags);
-
- warningControlDecoration = new ControlDecoration(wText, SWT.CENTER | SWT.RIGHT);
- Image warningImage = GuiResource.getInstance().getImageWarning();
- warningControlDecoration.setImage(warningImage);
- warningControlDecoration.setDescriptionText(
- BaseMessages.getString(PKG, "TextVar.tooltip.FieldIsInUse"));
- warningControlDecoration.hide();
-
- // If something has changed, check the warning interfaces
- //
- wText.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent arg0) {
-
- // Verify all the warning interfaces.
- // Show the first that has a warning to show...
- //
- boolean foundOne = false;
- for (IWarning warningInterface : warningInterfaces) {
- IWarningMessage warningSituation =
- warningInterface.getWarningSituation(wText.getText(), wText, this);
- if (warningSituation.isWarning()) {
- foundOne = true;
- warningControlDecoration.show();
- warningControlDecoration.setDescriptionText(warningSituation.getWarningMessage());
- break;
- }
- }
- if (!foundOne) {
- warningControlDecoration.hide();
- }
- }
- });
-
- FormData fdText = new FormData();
- fdText.top = new FormAttachment(0, 0);
- fdText.left = new FormAttachment(0, 0);
- fdText.right = new FormAttachment(100, -warningImage.getBounds().width);
- wText.setLayoutData(fdText);
- }
-
- /** @return the text in the Text widget */
- public String getText() {
- return wText.getText();
- }
-
- /** @param text the text in the Text widget to set. */
- public void setText(String text) {
- wText.setText(text);
- }
-
- public Text getTextWidget() {
- return wText;
- }
-
- /**
- * Add a modify listener to the text widget
- *
- * @param modifyListener
- */
- public void addModifyListener(ModifyListener modifyListener) {
- wText.addModifyListener(modifyListener);
- }
-
- public void addSelectionListener(SelectionAdapter lsDef) {
- wText.addSelectionListener(lsDef);
- }
-
- public void addKeyListener(KeyListener lsKey) {
- wText.addKeyListener(lsKey);
- }
-
- public void addFocusListener(FocusListener lsFocus) {
- wText.addFocusListener(lsFocus);
- }
-
- public void setEchoChar(char c) {
- wText.setEchoChar(c);
- }
-
- public void setEnabled(boolean flag) {
- wText.setEnabled(flag);
- }
-
- public boolean setFocus() {
- return wText.setFocus();
- }
-
- public void addTraverseListener(TraverseListener tl) {
- wText.addTraverseListener(tl);
- }
-
- public void setEditable(boolean editable) {
- wText.setEditable(editable);
- }
-
- public void setSelection(int i) {
- wText.setSelection(i);
- }
-
- public void selectAll() {
- wText.selectAll();
- }
-
- public void showSelection() {
- wText.showSelection();
- }
-
- public void addWarning(IWarning warningInterface) {
- warningInterfaces.add(warningInterface);
- }
-
- public void removeWarningInterface(IWarning warningInterface) {
- warningInterfaces.remove(warningInterface);
- }
-
- public List<IWarning> getWarningInterfaces() {
- return warningInterfaces;
- }
-}
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 2651d6f..7427267 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
@@ -42,6 +42,7 @@ import org.apache.hop.pipeline.transform.ITransformMeta;
import org.apache.hop.pipeline.transform.TransformMeta;
import org.apache.hop.ui.core.ConstUi;
import org.apache.hop.ui.core.PropsUi;
+import org.apache.hop.ui.core.dialog.DialogBoxWithButtons;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.WindowProperty;
@@ -50,9 +51,7 @@ import org.apache.hop.ui.core.widget.MetaSelectionLine;
import org.apache.hop.ui.core.widget.TableView;
import org.apache.hop.ui.core.widget.TextVar;
import org.apache.hop.ui.util.HelpUtils;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -62,7 +61,6 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Dialog;
@@ -77,7 +75,6 @@ import org.eclipse.swt.widgets.Text;
import java.util.ArrayList;
import java.util.List;
-import java.util.function.Consumer;
/** This class provides functionality common to Transform Dialogs. */
public class BaseTransformDialog extends Dialog {
@@ -300,11 +297,6 @@ public class BaseTransformDialog extends Dialog {
positionBottomButtons(composite, buttons, margin, buttonAlignment, lastControl);
}
- public static final void positionBottomRightButtons(
- Composite composite, Button[] buttons, int margin, Control lastControl) {
- positionBottomButtons(composite, buttons, margin, BUTTON_ALIGNMENT_RIGHT, lastControl);
- }
-
public static final void positionBottomButtons(
Composite composite, Button[] buttons, int margin, int alignment, Control lastControl) {
// Determine the largest button in the array
@@ -897,7 +889,7 @@ public class BaseTransformDialog extends Dialog {
if (keys.size() > 0) {
// Ask what we should do with the existing data in the transform.
//
- MessageDialog getFieldsChoiceDialog =
+ DialogBoxWithButtons getFieldsChoiceDialog =
getFieldsChoiceDialogProvider.provide(tableView.getShell(), keys.size(), row.size());
int idx = getFieldsChoiceDialog.open();
@@ -960,26 +952,23 @@ public class BaseTransformDialog extends Dialog {
}
}
- static MessageDialog getFieldsChoiceDialog(Shell shell, int existingFields, int newFields) {
- MessageDialog messageDialog =
- new MessageDialog(
+ static DialogBoxWithButtons getFieldsChoiceDialog(
+ Shell shell, int existingFields, int newFields) {
+ DialogBoxWithButtons messageDialog =
+ new DialogBoxWithButtons(
shell,
BaseMessages.getString(PKG, "BaseTransformDialog.GetFieldsChoice.Title"), // "Warning!"
- null,
BaseMessages.getString(
PKG,
"BaseTransformDialog.GetFieldsChoice.Message",
"" + existingFields,
"" + newFields),
- SWT.ICON_WARNING,
new String[] {
BaseMessages.getString(PKG, "BaseTransformDialog.AddNew"),
BaseMessages.getString(PKG, "BaseTransformDialog.Add"),
BaseMessages.getString(PKG, "BaseTransformDialog.ClearAndAdd"),
BaseMessages.getString(PKG, "BaseTransformDialog.Cancel"),
- },
- 0);
- MessageDialog.setDefaultImage(GuiResource.getInstance().getImageHopUi());
+ });
return messageDialog;
}
@@ -1217,7 +1206,7 @@ public class BaseTransformDialog extends Dialog {
}
public interface IFieldsChoiceDialogProvider {
- MessageDialog provide(Shell shell, int existingFields, int newFields);
+ DialogBoxWithButtons provide(Shell shell, int existingFields, int newFields);
}
/**