From 2d04e7a5238eba45d86d03c10d0d9e34c825689b Mon Sep 17 00:00:00 2001 From: Serge Rider Date: Mon, 1 Apr 2019 16:35:56 +0300 Subject: [PATCH] Model/UI refactoring --- .../feature.xml | 4 +- .../META-INF/MANIFEST.MF | 1 + .../META-INF/MANIFEST.MF | 1 + .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 1 + .../firebird/model/FireBirdDataTypeCache.java | 2 +- .../META-INF/MANIFEST.MF | 19 + .../OSGI-INF/l10n/bundle.properties | 4 + .../OSGI-INF/l10n/bundle_de.properties | 5 + .../OSGI-INF/l10n/bundle_es.properties | 3 + .../OSGI-INF/l10n/bundle_fr.properties | 1 + .../OSGI-INF/l10n/bundle_it.properties | 3 + .../OSGI-INF/l10n/bundle_ja.properties | 4 + .../OSGI-INF/l10n/bundle_ru.properties | 2 + .../OSGI-INF/l10n/bundle_zh.properties | 3 + .../build.properties | 6 + .../plugin.xml | 56 + .../org.jkiss.dbeaver.ext.generic.ui/pom.xml | 14 + .../generic/internal}/GenericMessages.java | 4 +- .../internal}/GenericResources.properties | 36 +- .../internal}/GenericResources_de.properties | 0 .../internal}/GenericResources_it.properties | 0 .../internal}/GenericResources_ja.properties | 0 .../internal}/GenericResources_ru.properties | 0 .../internal}/GenericResources_zh.properties | 0 .../generic/views/GenericConnectionPage.java | 1214 ++++++++--------- .../META-INF/MANIFEST.MF | 15 +- .../org.jkiss.dbeaver.ext.generic/plugin.xml | 51 - .../generic/model/meta/GenericMetaColumn.java | 5 +- .../meta/GenericMetaModelDescriptor.java | 5 +- .../generic/model/meta/GenericMetaObject.java | 3 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 3 +- plugins/pom.xml | 4 +- 37 files changed, 775 insertions(+), 704 deletions(-) create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/META-INF/MANIFEST.MF create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_de.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_es.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_fr.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_it.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ja.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ru.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_zh.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/build.properties create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/plugin.xml create mode 100644 plugins/org.jkiss.dbeaver.ext.generic.ui/pom.xml rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericMessages.java (95%) rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericResources.properties (97%) rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericResources_de.properties (100%) rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericResources_it.properties (100%) rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericResources_ja.properties (100%) rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericResources_ru.properties (100%) rename plugins/{org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic => org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal}/GenericResources_zh.properties (100%) rename plugins/{org.jkiss.dbeaver.ext.generic => org.jkiss.dbeaver.ext.generic.ui}/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java (97%) diff --git a/features/org.jkiss.dbeaver.ext.generic.feature/feature.xml b/features/org.jkiss.dbeaver.ext.generic.feature/feature.xml index c46597e1a9..d6f7d74a97 100644 --- a/features/org.jkiss.dbeaver.ext.generic.feature/feature.xml +++ b/features/org.jkiss.dbeaver.ext.generic.feature/feature.xml @@ -22,6 +22,9 @@ + + + @@ -30,7 +33,6 @@ - diff --git a/plugins/org.jkiss.dbeaver.ext.athena/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.athena/META-INF/MANIFEST.MF index 49840fe014..fbabe7ef14 100644 --- a/plugins/org.jkiss.dbeaver.ext.athena/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.athena/META-INF/MANIFEST.MF @@ -7,6 +7,7 @@ Bundle-Release-Date: 20190408 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-Activator: org.jkiss.dbeaver.ext.athena.AthenaActivator Bundle-ActivationPolicy: lazy diff --git a/plugins/org.jkiss.dbeaver.ext.bigquery/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.bigquery/META-INF/MANIFEST.MF index f70b8d4618..3157f9f726 100644 --- a/plugins/org.jkiss.dbeaver.ext.bigquery/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.bigquery/META-INF/MANIFEST.MF @@ -7,6 +7,7 @@ Bundle-Release-Date: 20190408 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-Activator: org.jkiss.dbeaver.ext.bigquery.BigQueryActivator Bundle-ActivationPolicy: lazy diff --git a/plugins/org.jkiss.dbeaver.ext.clickhouse/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.clickhouse/META-INF/MANIFEST.MF index 118c95b11f..9289ac3bbb 100644 --- a/plugins/org.jkiss.dbeaver.ext.clickhouse/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.clickhouse/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Release-Date: 20190408 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.views, - org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/plugins/org.jkiss.dbeaver.ext.db2.zos/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.db2.zos/META-INF/MANIFEST.MF index e5402d2536..4b0724820a 100644 --- a/plugins/org.jkiss.dbeaver.ext.db2.zos/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.db2.zos/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Release-Date: 20190408 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.views, - org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/plugins/org.jkiss.dbeaver.ext.derby/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.derby/META-INF/MANIFEST.MF index 375958f092..bb70f0c266 100644 --- a/plugins/org.jkiss.dbeaver.ext.derby/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.derby/META-INF/MANIFEST.MF @@ -8,6 +8,6 @@ Bundle-Release-Date: 20190408 Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime, - org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-ClassPath: . diff --git a/plugins/org.jkiss.dbeaver.ext.es.ui/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.es.ui/META-INF/MANIFEST.MF index b3d53956c7..4363c3bca5 100644 --- a/plugins/org.jkiss.dbeaver.ext.es.ui/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.es.ui/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.0.17.qualifier Bundle-Release-Date: 20190408 Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/plugins/org.jkiss.dbeaver.ext.firebird/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.firebird/META-INF/MANIFEST.MF index 1bfafd4c40..1de7c71e9d 100644 --- a/plugins/org.jkiss.dbeaver.ext.firebird/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.firebird/META-INF/MANIFEST.MF @@ -11,6 +11,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jface.text, org.jkiss.dbeaver.core, org.eclipse.ui.workbench.texteditor, + org.jkiss.dbeaver.model, org.jkiss.dbeaver.ext.generic Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/plugins/org.jkiss.dbeaver.ext.firebird/src/org/jkiss/dbeaver/ext/firebird/model/FireBirdDataTypeCache.java b/plugins/org.jkiss.dbeaver.ext.firebird/src/org/jkiss/dbeaver/ext/firebird/model/FireBirdDataTypeCache.java index 7659066bf7..ec6c4b3ff0 100644 --- a/plugins/org.jkiss.dbeaver.ext.firebird/src/org/jkiss/dbeaver/ext/firebird/model/FireBirdDataTypeCache.java +++ b/plugins/org.jkiss.dbeaver.ext.firebird/src/org/jkiss/dbeaver/ext/firebird/model/FireBirdDataTypeCache.java @@ -34,7 +34,7 @@ import java.util.ArrayList; import java.util.List; /** - * SQLiteDataTypeCache + * FireBirdDataTypeCache */ public class FireBirdDataTypeCache extends JDBCBasicDataTypeCache { diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.generic.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..55594d0943 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: DBeaver Generic UI Plug-in +Bundle-SymbolicName: org.jkiss.dbeaver.ext.generic.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Release-Date: 20190408 +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.jface.text, + org.eclipse.ui.views, + org.eclipse.ui.workbench, + org.eclipse.ui.workbench.texteditor, + org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, + org.jkiss.dbeaver.ext.generic +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Vendor: JKISS +Export-Package: org.jkiss.dbeaver.ext.generic.views diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000000..00abcd1a7e --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,4 @@ +dialog.connection.header = Generic JDBC Connection Settings + +editor.source.name = Source + diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_de.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_de.properties new file mode 100644 index 0000000000..f5ab900ab2 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_de.properties @@ -0,0 +1,5 @@ +#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/) + +dialog.connection.header = Allgemeine JDBC Verbindungseinstellungen + +editor.source.name = Quelle diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_es.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_es.properties new file mode 100644 index 0000000000..e69c201573 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_es.properties @@ -0,0 +1,3 @@ +# Copyright (C) 2012 Roberto Rossi (impiastro@gmail.com) + +dialog.connection.header = Conexión genérica JDBC diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_fr.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_fr.properties new file mode 100644 index 0000000000..7130c9f4e9 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_fr.properties @@ -0,0 +1 @@ +dialog.connection.header = Param\u00E8tres de connexion JDBC g\u00E9n\u00E9riques diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_it.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_it.properties new file mode 100644 index 0000000000..12b3037f1e --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_it.properties @@ -0,0 +1,3 @@ +# Copyright (C) 2012 Roberto Rossi (impiastro@gmail.com) + +dialog.connection.header = Impostazioni Connessione Generica JDBC diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ja.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ja.properties new file mode 100644 index 0000000000..5c2559c2a1 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ja.properties @@ -0,0 +1,4 @@ + +dialog.connection.header=\u4E00\u822C\u7684\u306AJDBC\u63A5\u7D9A\u8A2D\u5B9A + +editor.source.name=\u30BD\u30FC\u30B9 diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ru.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ru.properties new file mode 100644 index 0000000000..6358b94a34 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_ru.properties @@ -0,0 +1,2 @@ + +dialog.connection.header=\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0431\u0430\u0437\u043E\u0432\u043E\u0433\u043E \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_zh.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_zh.properties new file mode 100644 index 0000000000..7c680b23f0 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/OSGI-INF/l10n/bundle_zh.properties @@ -0,0 +1,3 @@ +dialog.connection.header = \u901A\u7528 JDBC \u8FDE\u63A5\u8BBE\u7F6E + +editor.source.name = \u8D44\u6E90 diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/build.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/build.properties new file mode 100644 index 0000000000..3c833df018 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = target/classes/ +bin.includes = .,\ + META-INF/,\ + OSGI-INF/,\ + plugin.xml diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/plugin.xml b/plugins/org.jkiss.dbeaver.ext.generic.ui/plugin.xml new file mode 100644 index 0000000000..aa1b46feff --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/plugin.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.jkiss.dbeaver.ext.generic.ui/pom.xml b/plugins/org.jkiss.dbeaver.ext.generic.ui/pom.xml new file mode 100644 index 0000000000..357065e116 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + org.jkiss.dbeaver + plugins + 1.0.0-SNAPSHOT + ../ + + org.jkiss.dbeaver.ext.generic.ui + 1.0.0-SNAPSHOT + eclipse-plugin + diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericMessages.java b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericMessages.java similarity index 95% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericMessages.java rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericMessages.java index 52e4f92be9..414bf80fa2 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericMessages.java +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericMessages.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.jkiss.dbeaver.ext.generic; +package org.jkiss.dbeaver.ext.generic.internal; import org.eclipse.osgi.util.NLS; public class GenericMessages extends NLS { - static final String BUNDLE_NAME = "org.jkiss.dbeaver.ext.generic.GenericResources"; //$NON-NLS-1$ + static final String BUNDLE_NAME = "org.jkiss.dbeaver.ext.generic.internal.GenericResources"; //$NON-NLS-1$ public static String dialog_connection_advanced_tab; public static String dialog_connection_advanced_tab_tooltip; diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources.properties similarity index 97% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources.properties rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources.properties index 9ec24e59e6..392a45b9d9 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources.properties +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources.properties @@ -1,18 +1,18 @@ - -dialog_connection_advanced_tab=Advanced -dialog_connection_advanced_tab_tooltip=Advanced/custom driver properties -dialog_connection_browse_button=Browse ... -dialog_connection_database_schema_label=Database/Schema: -dialog_connection_db_file_chooser_text=Choose database file -dialog_connection_db_folder_chooser_message=Choose folder with database files -dialog_connection_db_folder_chooser_text=Choose database folder -dialog_connection_general_tab=General -dialog_connection_general_tab_tooltip=General connection properties -dialog_connection_host_label=Host: -dialog_connection_jdbc_url_=JDBC URL: -dialog_connection_password_label=Password: -dialog_connection_path_label=Path: -dialog_connection_port_label=Port: -dialog_connection_server_label=Server: -dialog_connection_test_connection_button=Test Connection ... -dialog_connection_user_name_label=User name: + +dialog_connection_advanced_tab=Advanced +dialog_connection_advanced_tab_tooltip=Advanced/custom driver properties +dialog_connection_browse_button=Browse ... +dialog_connection_database_schema_label=Database/Schema: +dialog_connection_db_file_chooser_text=Choose database file +dialog_connection_db_folder_chooser_message=Choose folder with database files +dialog_connection_db_folder_chooser_text=Choose database folder +dialog_connection_general_tab=General +dialog_connection_general_tab_tooltip=General connection properties +dialog_connection_host_label=Host: +dialog_connection_jdbc_url_=JDBC URL: +dialog_connection_password_label=Password: +dialog_connection_path_label=Path: +dialog_connection_port_label=Port: +dialog_connection_server_label=Server: +dialog_connection_test_connection_button=Test Connection ... +dialog_connection_user_name_label=User name: diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_de.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_de.properties similarity index 100% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_de.properties rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_de.properties diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_it.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_it.properties similarity index 100% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_it.properties rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_it.properties diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_ja.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_ja.properties similarity index 100% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_ja.properties rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_ja.properties diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_ru.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_ru.properties similarity index 100% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_ru.properties rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_ru.properties diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_zh.properties b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_zh.properties similarity index 100% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/GenericResources_zh.properties rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/internal/GenericResources_zh.properties diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java similarity index 97% rename from plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java rename to plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java index e8e677c77f..6968e26bdd 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java +++ b/plugins/org.jkiss.dbeaver.ext.generic.ui/src/org/jkiss/dbeaver/ext/generic/views/GenericConnectionPage.java @@ -1,607 +1,607 @@ -/* - * DBeaver - Universal Database Manager - * Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org) - * - * Licensed 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.jkiss.dbeaver.ext.generic.views; - -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; -import org.jkiss.dbeaver.DBException; -import org.jkiss.dbeaver.ext.generic.GenericConstants; -import org.jkiss.dbeaver.ext.generic.GenericMessages; -import org.jkiss.dbeaver.model.DBPDataSourceContainer; -import org.jkiss.dbeaver.model.DBPImage; -import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; -import org.jkiss.dbeaver.model.connection.DBPDriver; -import org.jkiss.dbeaver.model.impl.jdbc.JDBCConstants; -import org.jkiss.dbeaver.model.impl.jdbc.JDBCURL; -import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; -import org.jkiss.dbeaver.registry.DataSourceDescriptor; -import org.jkiss.dbeaver.runtime.DBWorkbench; -import org.jkiss.dbeaver.ui.DBeaverIcons; -import org.jkiss.dbeaver.ui.ICompositeDialogPage; -import org.jkiss.dbeaver.ui.UIUtils; -import org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract; -import org.jkiss.dbeaver.ui.dialogs.connection.DriverPropertiesDialogPage; -import org.jkiss.utils.CommonUtils; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.util.*; -import java.util.List; - -/** - * GenericConnectionPage - */ -public class GenericConnectionPage extends ConnectionPageAbstract implements ICompositeDialogPage -{ - // Host/port - private Text hostText; - private Text portText; - // server/DB/path - private Text serverText; - private Text dbText; - private Text pathText; - // Login - private Text userNameText; - private Text passwordText; - // URL - private Text urlText; - - private boolean isCustom; - private JDBCURL.MetaURL metaURL; - - private Composite settingsGroup; - - private Map> propGroupMap = new HashMap<>(); - - private static final String GROUP_URL = "url"; //$NON-NLS-1$ - private static final String GROUP_HOST = "host"; //$NON-NLS-1$ - private static final String GROUP_SERVER = "server"; //$NON-NLS-1$ - private static final String GROUP_DB = "db"; //$NON-NLS-1$ - private static final String GROUP_PATH = "path"; //$NON-NLS-1$ - private static final String GROUP_LOGIN = "login"; //$NON-NLS-1$ - private boolean activated; - private Button createButton; - - @Override - public void createControl(Composite composite) - { - ModifyListener textListener = e -> { - if (activated) { - saveAndUpdate(); - } - }; - - settingsGroup = new Composite(composite, SWT.NONE); - GridLayout gl = new GridLayout(4, false); - gl.marginHeight = 10; - gl.marginWidth = 10; - settingsGroup.setLayout(gl); - GridData gd = new GridData(GridData.FILL_BOTH); - settingsGroup.setLayoutData(gd); - - { - Label urlLabel = new Label(settingsGroup, SWT.NONE); - urlLabel.setText(GenericMessages.dialog_connection_jdbc_url_); - gd = new GridData(GridData.HORIZONTAL_ALIGN_END); - urlLabel.setLayoutData(gd); - - urlText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 3; - gd.grabExcessHorizontalSpace = true; - gd.widthHint = 355; - urlText.setLayoutData(gd); - urlText.addModifyListener(e -> site.updateButtons()); - - addControlToGroup(GROUP_URL, urlLabel); - addControlToGroup(GROUP_URL, urlText); - } - { - Label hostLabel = new Label(settingsGroup, SWT.NONE); - hostLabel.setText(GenericMessages.dialog_connection_host_label); - hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - hostText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.grabExcessHorizontalSpace = true; - hostText.setLayoutData(gd); - hostText.addModifyListener(textListener); - - Label portLabel = new Label(settingsGroup, SWT.NONE); - portLabel.setText(GenericMessages.dialog_connection_port_label); - portLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - portText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.CENTER); - gd.widthHint = 60; - portText.setLayoutData(gd); - //portText.addVerifyListener(UIUtils.INTEGER_VERIFY_LISTENER); - portText.addModifyListener(textListener); - - addControlToGroup(GROUP_HOST, hostLabel); - addControlToGroup(GROUP_HOST, hostText); - addControlToGroup(GROUP_HOST, portLabel); - addControlToGroup(GROUP_HOST, portText); - } - - { - Label serverLabel = new Label(settingsGroup, SWT.NONE); - serverLabel.setText(GenericMessages.dialog_connection_server_label); - serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - serverText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.grabExcessHorizontalSpace = true; - //gd.widthHint = 270; - serverText.setLayoutData(gd); - serverText.addModifyListener(textListener); - - Control emptyLabel = UIUtils.createEmptyLabel(settingsGroup, 2, 1); - - addControlToGroup(GROUP_SERVER, serverLabel); - addControlToGroup(GROUP_SERVER, serverText); - addControlToGroup(GROUP_SERVER, emptyLabel); - } - - { - Label dbLabel = new Label(settingsGroup, SWT.NONE); - dbLabel.setText(GenericMessages.dialog_connection_database_schema_label); - dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - dbText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.grabExcessHorizontalSpace = true; - //gd.widthHint = 270; - //gd.horizontalSpan = 3; - dbText.setLayoutData(gd); - dbText.addModifyListener(textListener); - - Control emptyLabel = UIUtils.createEmptyLabel(settingsGroup, 2, 1); - - addControlToGroup(GROUP_DB, dbLabel); - addControlToGroup(GROUP_DB, dbText); - addControlToGroup(GROUP_DB, emptyLabel); - } - - // Path - { - Label pathLabel = new Label(settingsGroup, SWT.NONE); - pathLabel.setText(GenericMessages.dialog_connection_path_label); - pathLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - pathText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.grabExcessHorizontalSpace = true; - gd.widthHint = 200; - gd.horizontalSpan = 2; - pathText.setLayoutData(gd); - pathText.addModifyListener(textListener); - pathText.addModifyListener(e -> updateCreateButton(site.getDriver())); - - Composite buttonsPanel = new Composite(settingsGroup, SWT.NONE); - gl = new GridLayout(2, true); - gl.marginHeight = 0; - gl.marginWidth = 0; - buttonsPanel.setLayout(gl); - gd = new GridData(GridData.HORIZONTAL_ALIGN_END); - gd.widthHint = 150; - buttonsPanel.setLayoutData(gd); - - Button browseButton = new Button(buttonsPanel, SWT.PUSH); - browseButton.setText(GenericMessages.dialog_connection_browse_button); - gd = new GridData(GridData.FILL_HORIZONTAL); - browseButton.setLayoutData(gd); - browseButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) - { - if (metaURL.getAvailableProperties().contains(JDBCConstants.PROP_FILE)) { - FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SINGLE); - dialog.setFileName(pathText.getText()); - dialog.setText(GenericMessages.dialog_connection_db_file_chooser_text); - String file = dialog.open(); - if (file != null) { - pathText.setText(file); - } - } else { - DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); - final String curPath = pathText.getText(); - File curFolder = new File(curPath); - if (curFolder.exists()) { - if (curFolder.isDirectory()) { - dialog.setFilterPath(curFolder.getAbsolutePath()); - } else { - dialog.setFilterPath(curFolder.getParentFile().getAbsolutePath()); - } - } - dialog.setText(GenericMessages.dialog_connection_db_folder_chooser_text); - dialog.setMessage(GenericMessages.dialog_connection_db_folder_chooser_message); - String folder = dialog.open(); - if (folder != null) { - pathText.setText(folder); - } - } - } - }); - - createButton = new Button(buttonsPanel, SWT.PUSH); - createButton.setText("Create"); - createButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - createButton.setEnabled(false); - createButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - createEmbeddedDatabase(); - } - }); - - addControlToGroup(GROUP_PATH, pathLabel); - addControlToGroup(GROUP_PATH, pathText); - addControlToGroup(GROUP_PATH, buttonsPanel); - } - - { - Label userNameLabel = new Label(settingsGroup, SWT.NONE); - userNameLabel.setText(GenericMessages.dialog_connection_user_name_label); - userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - userNameText = new Text(settingsGroup, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.grabExcessHorizontalSpace = true; - userNameText.setLayoutData(gd); - userNameText.addModifyListener(textListener); - - Control emptyLabel = UIUtils.createEmptyLabel(settingsGroup, 2, 1); - - Label passwordLabel = new Label(settingsGroup, SWT.NONE); - passwordLabel.setText(GenericMessages.dialog_connection_password_label); - passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - passwordText = new Text(settingsGroup, SWT.BORDER | SWT.PASSWORD); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.grabExcessHorizontalSpace = true; - passwordText.setLayoutData(gd); - passwordText.addModifyListener(textListener); - - createSavePasswordButton(settingsGroup, 2); - - addControlToGroup(GROUP_LOGIN, userNameLabel); - addControlToGroup(GROUP_LOGIN, userNameText); - addControlToGroup(GROUP_LOGIN, emptyLabel); - addControlToGroup(GROUP_LOGIN, passwordLabel); - addControlToGroup(GROUP_LOGIN, passwordText); - addControlToGroup(GROUP_LOGIN, savePasswordCheck); - } - - createDriverPanel(settingsGroup); - setControl(settingsGroup); - } - - @Override - protected void updateDriverInfo(DBPDriver driver) { - parseSampleURL(driver); - saveAndUpdate(); - } - - @Override - public boolean isComplete() - { - if (isCustom) { - return !CommonUtils.isEmpty(urlText.getText()); - } else { - if (metaURL == null) { - return false; - } - for (String prop : metaURL.getRequiredProperties()) { - if ( - (prop.equals(JDBCConstants.PROP_HOST) && CommonUtils.isEmptyTrimmed(hostText.getText())) || - (prop.equals(JDBCConstants.PROP_PORT) && CommonUtils.isEmptyTrimmed(portText.getText())) || - (prop.equals(JDBCConstants.PROP_DATABASE) && CommonUtils.isEmptyTrimmed(dbText.getText())) || - ((prop.equals(JDBCConstants.PROP_FILE) || prop.equals(JDBCConstants.PROP_FOLDER)) && CommonUtils.isEmptyTrimmed(pathText.getText()))) - { - return false; - } - } - return true; - } - } - - @Override - protected boolean isCustomURL() - { - return isCustom; - } - - @Override - public void loadSettings() - { - super.loadSettings(); - - { - DBPDriver driver = getSite().getDriver(); - DBPImage iconBig = driver.getIconBig(); - if (iconBig != null) { - ImageDescriptor imageDescriptor = DBeaverIcons.getImageDescriptor(iconBig); - if (imageDescriptor.getImageData().width >= 64) { - setImageDescriptor(imageDescriptor); - } else { - setImageDescriptor(null); - } - } - } - - // Load values from new connection info - DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration(); - this.parseSampleURL(site.getDriver()); - if (!isCustom) { - if (hostText != null) { - if (!CommonUtils.isEmpty(connectionInfo.getHostName())) { - hostText.setText(CommonUtils.notEmpty(connectionInfo.getHostName())); - } else { - hostText.setText("localhost"); //$NON-NLS-1$ - } - } - if (portText != null) { - if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) { - portText.setText(String.valueOf(connectionInfo.getHostPort())); - } else if (site.getDriver().getDefaultPort() != null) { - portText.setText(site.getDriver().getDefaultPort()); - } else { - portText.setText(""); //$NON-NLS-1$ - } - } - if (serverText != null) { - serverText.setText(CommonUtils.notEmpty(connectionInfo.getServerName())); - } - if (dbText != null) { - dbText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName())); - } - if (pathText != null) { - pathText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName())); - } - } else { - hostText.setText(""); //$NON-NLS-1$ - portText.setText(""); //$NON-NLS-1$ - serverText.setText(""); //$NON-NLS-1$ - dbText.setText(""); //$NON-NLS-1$ - pathText.setText(""); //$NON-NLS-1$ - } - if (userNameText != null) { - userNameText.setText(CommonUtils.notEmpty(connectionInfo.getUserName())); - } - if (passwordText != null) { - passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword())); - } - - if (urlText != null) { - if (CommonUtils.isEmpty(connectionInfo.getUrl())) { - try { - saveSettings(site.getActiveDataSource()); - } catch (Exception e) { - setMessage(e.getMessage()); - } - } - if (connectionInfo.getUrl() != null) { - urlText.setText(CommonUtils.notEmpty(connectionInfo.getUrl())); - } else { - urlText.setText(""); //$NON-NLS-1$ - } - } - - activated = true; - - UIUtils.asyncExec(() -> { - // Set first control - if (CommonUtils.isEmpty(site.getDriver().getSampleURL())) { - urlText.setFocus(); - } else if (hostText != null && hostText.isVisible()) { - hostText.setFocus(); - } else if (serverText != null && serverText.isVisible()) { - serverText.setFocus(); - } else if (dbText != null && dbText.isVisible()) { - dbText.setFocus(); - } else if (pathText != null && pathText.isVisible()) { - pathText.setFocus(); - } else if (userNameText != null && userNameText.isVisible()) { - userNameText.setFocus(); - } - }); - - } - - @Override - public void saveSettings(DBPDataSourceContainer dataSource) - { - DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration(); - final Set properties = metaURL == null ? Collections.emptySet() : metaURL.getAvailableProperties(); - - if (hostText != null && properties.contains(JDBCConstants.PROP_HOST)) { - connectionInfo.setHostName(hostText.getText().trim()); - } - if (portText != null && properties.contains(JDBCConstants.PROP_PORT)) { - connectionInfo.setHostPort(portText.getText().trim()); - } - if (serverText != null && properties.contains(JDBCConstants.PROP_SERVER)) { - connectionInfo.setServerName(serverText.getText().trim()); - } - if (dbText != null && properties.contains(JDBCConstants.PROP_DATABASE)) { - connectionInfo.setDatabaseName(dbText.getText().trim()); - } - if (pathText != null && (properties.contains(JDBCConstants.PROP_FOLDER) || properties.contains(JDBCConstants.PROP_FILE))) { - connectionInfo.setDatabaseName(pathText.getText().trim()); - } - if (userNameText != null) { - connectionInfo.setUserName(userNameText.getText().trim()); - } - if (passwordText != null) { - connectionInfo.setUserPassword(passwordText.getText()); - } - super.saveSettings(dataSource); - if (isCustom) { - if (urlText != null) { - connectionInfo.setUrl(urlText.getText().trim()); - } - } else { - if (urlText != null && connectionInfo.getUrl() != null) { - urlText.setText(connectionInfo.getUrl()); - } - } - } - - private void parseSampleURL(DBPDriver driver) - { - metaURL = null; - - if (!CommonUtils.isEmpty(driver.getSampleURL())) { - isCustom = false; - try { - metaURL = JDBCURL.parseSampleURL(driver.getSampleURL()); - } catch (DBException e) { - setErrorMessage(e.getMessage()); - } - final Set properties = metaURL.getAvailableProperties(); - urlText.setEditable(false); - - showControlGroup(GROUP_HOST, properties.contains(JDBCConstants.PROP_HOST)); - showControlGroup(GROUP_SERVER, properties.contains(JDBCConstants.PROP_SERVER)); - showControlGroup(GROUP_DB, properties.contains(JDBCConstants.PROP_DATABASE)); - showControlGroup(GROUP_PATH, properties.contains(JDBCConstants.PROP_FOLDER) || properties.contains(JDBCConstants.PROP_FILE)); - } else { - isCustom = true; - showControlGroup(GROUP_HOST, false); - showControlGroup(GROUP_SERVER, false); - showControlGroup(GROUP_DB, false); - showControlGroup(GROUP_PATH, false); - urlText.setEditable(true); - } - UIUtils.fixReadonlyTextBackground(urlText); - showControlGroup(GROUP_LOGIN, !driver.isAnonymousAccess()); - updateCreateButton(driver); - - - settingsGroup.layout(); - } - - private void updateCreateButton(DBPDriver driver) { - if (driver == null) { - createButton.setEnabled(false); - return; - } - // Enable ""Create" button - String paramCreate = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_CREATE_URL_PARAM)); - createButton.setEnabled(!CommonUtils.isEmpty(paramCreate) && !CommonUtils.isEmpty(pathText.getText())); - } - - private void createEmbeddedDatabase() { - String paramCreate = CommonUtils.toString(site.getDriver().getDriverParameter(GenericConstants.PARAM_CREATE_URL_PARAM)); - - DataSourceDescriptor dataSource = (DataSourceDescriptor) site.getActiveDataSource(); - final DataSourceDescriptor testDataSource = new DataSourceDescriptor( - site.getDataSourceRegistry(), - dataSource.getId(), - dataSource.getDriver(), - new DBPConnectionConfiguration(dataSource.getConnectionConfiguration())); - - saveSettings(testDataSource); - DBPConnectionConfiguration cfg = testDataSource.getConnectionConfiguration(); - cfg.setUrl(cfg.getUrl() + paramCreate); - String databaseName = cfg.getDatabaseName(); - testDataSource.setName(databaseName); - - if (!UIUtils.confirmAction(getShell(), "Create Database", "Are you sure you want to create database '" + databaseName + "'?")) { - testDataSource.dispose(); - return; - } - - try { - site.getRunnableContext().run(true, true, monitor -> { - try { - createEmbeddedDatabase(monitor, testDataSource); - } catch (DBException e1) { - throw new InvocationTargetException(e1); - } - }); - MessageDialog.openInformation(getShell(), "Database Create", "Database '" + databaseName + "' created!"); - } catch (InvocationTargetException e1) { - DBWorkbench.getPlatformUI().showError("Create database", "Error creating database", e1.getTargetException()); - } catch (InterruptedException e1) { - // Just ignore - } - } - - private void createEmbeddedDatabase(DBRProgressMonitor monitor, DataSourceDescriptor testDataSource) throws DBException { - try { - // Connect and disconnect immediately - testDataSource.connect(monitor, true, true); - - testDataSource.disconnect(monitor); - } finally { - testDataSource.dispose(); - } - } - - private void saveAndUpdate() - { - // Save settings to update URL - saveSettings(site.getActiveDataSource()); - // Update buttons - site.updateButtons(); - } - - private void showControlGroup(String group, boolean show) - { - List controlList = propGroupMap.get(group); - if (controlList != null) { - for (Control control : controlList) { - GridData gd = (GridData)control.getLayoutData(); - if (gd == null) { - gd = new GridData(GridData.BEGINNING); - control.setLayoutData(gd); - } - gd.exclude = !show; - control.setVisible(show); - } - } - } - - private void addControlToGroup(String group, Control control) - { - List controlList = propGroupMap.get(group); - if (controlList == null) { - controlList = new ArrayList<>(); - propGroupMap.put(group, controlList); - } - controlList.add(control); - } - - @Override - public IDialogPage[] getSubPages() - { - return new IDialogPage[] { - new DriverPropertiesDialogPage(this) - }; - } - -} +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org) + * + * Licensed 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.jkiss.dbeaver.ext.generic.views; + +import org.eclipse.jface.dialogs.IDialogPage; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.*; +import org.jkiss.dbeaver.DBException; +import org.jkiss.dbeaver.ext.generic.GenericConstants; +import org.jkiss.dbeaver.ext.generic.internal.GenericMessages; +import org.jkiss.dbeaver.model.DBPDataSourceContainer; +import org.jkiss.dbeaver.model.DBPImage; +import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; +import org.jkiss.dbeaver.model.connection.DBPDriver; +import org.jkiss.dbeaver.model.impl.jdbc.JDBCConstants; +import org.jkiss.dbeaver.model.impl.jdbc.JDBCURL; +import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; +import org.jkiss.dbeaver.registry.DataSourceDescriptor; +import org.jkiss.dbeaver.runtime.DBWorkbench; +import org.jkiss.dbeaver.ui.DBeaverIcons; +import org.jkiss.dbeaver.ui.ICompositeDialogPage; +import org.jkiss.dbeaver.ui.UIUtils; +import org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract; +import org.jkiss.dbeaver.ui.dialogs.connection.DriverPropertiesDialogPage; +import org.jkiss.utils.CommonUtils; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.*; +import java.util.List; + +/** + * GenericConnectionPage + */ +public class GenericConnectionPage extends ConnectionPageAbstract implements ICompositeDialogPage +{ + // Host/port + private Text hostText; + private Text portText; + // server/DB/path + private Text serverText; + private Text dbText; + private Text pathText; + // Login + private Text userNameText; + private Text passwordText; + // URL + private Text urlText; + + private boolean isCustom; + private JDBCURL.MetaURL metaURL; + + private Composite settingsGroup; + + private Map> propGroupMap = new HashMap<>(); + + private static final String GROUP_URL = "url"; //$NON-NLS-1$ + private static final String GROUP_HOST = "host"; //$NON-NLS-1$ + private static final String GROUP_SERVER = "server"; //$NON-NLS-1$ + private static final String GROUP_DB = "db"; //$NON-NLS-1$ + private static final String GROUP_PATH = "path"; //$NON-NLS-1$ + private static final String GROUP_LOGIN = "login"; //$NON-NLS-1$ + private boolean activated; + private Button createButton; + + @Override + public void createControl(Composite composite) + { + ModifyListener textListener = e -> { + if (activated) { + saveAndUpdate(); + } + }; + + settingsGroup = new Composite(composite, SWT.NONE); + GridLayout gl = new GridLayout(4, false); + gl.marginHeight = 10; + gl.marginWidth = 10; + settingsGroup.setLayout(gl); + GridData gd = new GridData(GridData.FILL_BOTH); + settingsGroup.setLayoutData(gd); + + { + Label urlLabel = new Label(settingsGroup, SWT.NONE); + urlLabel.setText(GenericMessages.dialog_connection_jdbc_url_); + gd = new GridData(GridData.HORIZONTAL_ALIGN_END); + urlLabel.setLayoutData(gd); + + urlText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 3; + gd.grabExcessHorizontalSpace = true; + gd.widthHint = 355; + urlText.setLayoutData(gd); + urlText.addModifyListener(e -> site.updateButtons()); + + addControlToGroup(GROUP_URL, urlLabel); + addControlToGroup(GROUP_URL, urlText); + } + { + Label hostLabel = new Label(settingsGroup, SWT.NONE); + hostLabel.setText(GenericMessages.dialog_connection_host_label); + hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + hostText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.grabExcessHorizontalSpace = true; + hostText.setLayoutData(gd); + hostText.addModifyListener(textListener); + + Label portLabel = new Label(settingsGroup, SWT.NONE); + portLabel.setText(GenericMessages.dialog_connection_port_label); + portLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + portText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.CENTER); + gd.widthHint = 60; + portText.setLayoutData(gd); + //portText.addVerifyListener(UIUtils.INTEGER_VERIFY_LISTENER); + portText.addModifyListener(textListener); + + addControlToGroup(GROUP_HOST, hostLabel); + addControlToGroup(GROUP_HOST, hostText); + addControlToGroup(GROUP_HOST, portLabel); + addControlToGroup(GROUP_HOST, portText); + } + + { + Label serverLabel = new Label(settingsGroup, SWT.NONE); + serverLabel.setText(GenericMessages.dialog_connection_server_label); + serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + serverText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.grabExcessHorizontalSpace = true; + //gd.widthHint = 270; + serverText.setLayoutData(gd); + serverText.addModifyListener(textListener); + + Control emptyLabel = UIUtils.createEmptyLabel(settingsGroup, 2, 1); + + addControlToGroup(GROUP_SERVER, serverLabel); + addControlToGroup(GROUP_SERVER, serverText); + addControlToGroup(GROUP_SERVER, emptyLabel); + } + + { + Label dbLabel = new Label(settingsGroup, SWT.NONE); + dbLabel.setText(GenericMessages.dialog_connection_database_schema_label); + dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + dbText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.grabExcessHorizontalSpace = true; + //gd.widthHint = 270; + //gd.horizontalSpan = 3; + dbText.setLayoutData(gd); + dbText.addModifyListener(textListener); + + Control emptyLabel = UIUtils.createEmptyLabel(settingsGroup, 2, 1); + + addControlToGroup(GROUP_DB, dbLabel); + addControlToGroup(GROUP_DB, dbText); + addControlToGroup(GROUP_DB, emptyLabel); + } + + // Path + { + Label pathLabel = new Label(settingsGroup, SWT.NONE); + pathLabel.setText(GenericMessages.dialog_connection_path_label); + pathLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + pathText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.grabExcessHorizontalSpace = true; + gd.widthHint = 200; + gd.horizontalSpan = 2; + pathText.setLayoutData(gd); + pathText.addModifyListener(textListener); + pathText.addModifyListener(e -> updateCreateButton(site.getDriver())); + + Composite buttonsPanel = new Composite(settingsGroup, SWT.NONE); + gl = new GridLayout(2, true); + gl.marginHeight = 0; + gl.marginWidth = 0; + buttonsPanel.setLayout(gl); + gd = new GridData(GridData.HORIZONTAL_ALIGN_END); + gd.widthHint = 150; + buttonsPanel.setLayoutData(gd); + + Button browseButton = new Button(buttonsPanel, SWT.PUSH); + browseButton.setText(GenericMessages.dialog_connection_browse_button); + gd = new GridData(GridData.FILL_HORIZONTAL); + browseButton.setLayoutData(gd); + browseButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) + { + if (metaURL.getAvailableProperties().contains(JDBCConstants.PROP_FILE)) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SINGLE); + dialog.setFileName(pathText.getText()); + dialog.setText(GenericMessages.dialog_connection_db_file_chooser_text); + String file = dialog.open(); + if (file != null) { + pathText.setText(file); + } + } else { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); + final String curPath = pathText.getText(); + File curFolder = new File(curPath); + if (curFolder.exists()) { + if (curFolder.isDirectory()) { + dialog.setFilterPath(curFolder.getAbsolutePath()); + } else { + dialog.setFilterPath(curFolder.getParentFile().getAbsolutePath()); + } + } + dialog.setText(GenericMessages.dialog_connection_db_folder_chooser_text); + dialog.setMessage(GenericMessages.dialog_connection_db_folder_chooser_message); + String folder = dialog.open(); + if (folder != null) { + pathText.setText(folder); + } + } + } + }); + + createButton = new Button(buttonsPanel, SWT.PUSH); + createButton.setText("Create"); + createButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + createButton.setEnabled(false); + createButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + createEmbeddedDatabase(); + } + }); + + addControlToGroup(GROUP_PATH, pathLabel); + addControlToGroup(GROUP_PATH, pathText); + addControlToGroup(GROUP_PATH, buttonsPanel); + } + + { + Label userNameLabel = new Label(settingsGroup, SWT.NONE); + userNameLabel.setText(GenericMessages.dialog_connection_user_name_label); + userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + userNameText = new Text(settingsGroup, SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.grabExcessHorizontalSpace = true; + userNameText.setLayoutData(gd); + userNameText.addModifyListener(textListener); + + Control emptyLabel = UIUtils.createEmptyLabel(settingsGroup, 2, 1); + + Label passwordLabel = new Label(settingsGroup, SWT.NONE); + passwordLabel.setText(GenericMessages.dialog_connection_password_label); + passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + passwordText = new Text(settingsGroup, SWT.BORDER | SWT.PASSWORD); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.grabExcessHorizontalSpace = true; + passwordText.setLayoutData(gd); + passwordText.addModifyListener(textListener); + + createSavePasswordButton(settingsGroup, 2); + + addControlToGroup(GROUP_LOGIN, userNameLabel); + addControlToGroup(GROUP_LOGIN, userNameText); + addControlToGroup(GROUP_LOGIN, emptyLabel); + addControlToGroup(GROUP_LOGIN, passwordLabel); + addControlToGroup(GROUP_LOGIN, passwordText); + addControlToGroup(GROUP_LOGIN, savePasswordCheck); + } + + createDriverPanel(settingsGroup); + setControl(settingsGroup); + } + + @Override + protected void updateDriverInfo(DBPDriver driver) { + parseSampleURL(driver); + saveAndUpdate(); + } + + @Override + public boolean isComplete() + { + if (isCustom) { + return !CommonUtils.isEmpty(urlText.getText()); + } else { + if (metaURL == null) { + return false; + } + for (String prop : metaURL.getRequiredProperties()) { + if ( + (prop.equals(JDBCConstants.PROP_HOST) && CommonUtils.isEmptyTrimmed(hostText.getText())) || + (prop.equals(JDBCConstants.PROP_PORT) && CommonUtils.isEmptyTrimmed(portText.getText())) || + (prop.equals(JDBCConstants.PROP_DATABASE) && CommonUtils.isEmptyTrimmed(dbText.getText())) || + ((prop.equals(JDBCConstants.PROP_FILE) || prop.equals(JDBCConstants.PROP_FOLDER)) && CommonUtils.isEmptyTrimmed(pathText.getText()))) + { + return false; + } + } + return true; + } + } + + @Override + protected boolean isCustomURL() + { + return isCustom; + } + + @Override + public void loadSettings() + { + super.loadSettings(); + + { + DBPDriver driver = getSite().getDriver(); + DBPImage iconBig = driver.getIconBig(); + if (iconBig != null) { + ImageDescriptor imageDescriptor = DBeaverIcons.getImageDescriptor(iconBig); + if (imageDescriptor.getImageData().width >= 64) { + setImageDescriptor(imageDescriptor); + } else { + setImageDescriptor(null); + } + } + } + + // Load values from new connection info + DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration(); + this.parseSampleURL(site.getDriver()); + if (!isCustom) { + if (hostText != null) { + if (!CommonUtils.isEmpty(connectionInfo.getHostName())) { + hostText.setText(CommonUtils.notEmpty(connectionInfo.getHostName())); + } else { + hostText.setText("localhost"); //$NON-NLS-1$ + } + } + if (portText != null) { + if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) { + portText.setText(String.valueOf(connectionInfo.getHostPort())); + } else if (site.getDriver().getDefaultPort() != null) { + portText.setText(site.getDriver().getDefaultPort()); + } else { + portText.setText(""); //$NON-NLS-1$ + } + } + if (serverText != null) { + serverText.setText(CommonUtils.notEmpty(connectionInfo.getServerName())); + } + if (dbText != null) { + dbText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName())); + } + if (pathText != null) { + pathText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName())); + } + } else { + hostText.setText(""); //$NON-NLS-1$ + portText.setText(""); //$NON-NLS-1$ + serverText.setText(""); //$NON-NLS-1$ + dbText.setText(""); //$NON-NLS-1$ + pathText.setText(""); //$NON-NLS-1$ + } + if (userNameText != null) { + userNameText.setText(CommonUtils.notEmpty(connectionInfo.getUserName())); + } + if (passwordText != null) { + passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword())); + } + + if (urlText != null) { + if (CommonUtils.isEmpty(connectionInfo.getUrl())) { + try { + saveSettings(site.getActiveDataSource()); + } catch (Exception e) { + setMessage(e.getMessage()); + } + } + if (connectionInfo.getUrl() != null) { + urlText.setText(CommonUtils.notEmpty(connectionInfo.getUrl())); + } else { + urlText.setText(""); //$NON-NLS-1$ + } + } + + activated = true; + + UIUtils.asyncExec(() -> { + // Set first control + if (CommonUtils.isEmpty(site.getDriver().getSampleURL())) { + urlText.setFocus(); + } else if (hostText != null && hostText.isVisible()) { + hostText.setFocus(); + } else if (serverText != null && serverText.isVisible()) { + serverText.setFocus(); + } else if (dbText != null && dbText.isVisible()) { + dbText.setFocus(); + } else if (pathText != null && pathText.isVisible()) { + pathText.setFocus(); + } else if (userNameText != null && userNameText.isVisible()) { + userNameText.setFocus(); + } + }); + + } + + @Override + public void saveSettings(DBPDataSourceContainer dataSource) + { + DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration(); + final Set properties = metaURL == null ? Collections.emptySet() : metaURL.getAvailableProperties(); + + if (hostText != null && properties.contains(JDBCConstants.PROP_HOST)) { + connectionInfo.setHostName(hostText.getText().trim()); + } + if (portText != null && properties.contains(JDBCConstants.PROP_PORT)) { + connectionInfo.setHostPort(portText.getText().trim()); + } + if (serverText != null && properties.contains(JDBCConstants.PROP_SERVER)) { + connectionInfo.setServerName(serverText.getText().trim()); + } + if (dbText != null && properties.contains(JDBCConstants.PROP_DATABASE)) { + connectionInfo.setDatabaseName(dbText.getText().trim()); + } + if (pathText != null && (properties.contains(JDBCConstants.PROP_FOLDER) || properties.contains(JDBCConstants.PROP_FILE))) { + connectionInfo.setDatabaseName(pathText.getText().trim()); + } + if (userNameText != null) { + connectionInfo.setUserName(userNameText.getText().trim()); + } + if (passwordText != null) { + connectionInfo.setUserPassword(passwordText.getText()); + } + super.saveSettings(dataSource); + if (isCustom) { + if (urlText != null) { + connectionInfo.setUrl(urlText.getText().trim()); + } + } else { + if (urlText != null && connectionInfo.getUrl() != null) { + urlText.setText(connectionInfo.getUrl()); + } + } + } + + private void parseSampleURL(DBPDriver driver) + { + metaURL = null; + + if (!CommonUtils.isEmpty(driver.getSampleURL())) { + isCustom = false; + try { + metaURL = JDBCURL.parseSampleURL(driver.getSampleURL()); + } catch (DBException e) { + setErrorMessage(e.getMessage()); + } + final Set properties = metaURL.getAvailableProperties(); + urlText.setEditable(false); + + showControlGroup(GROUP_HOST, properties.contains(JDBCConstants.PROP_HOST)); + showControlGroup(GROUP_SERVER, properties.contains(JDBCConstants.PROP_SERVER)); + showControlGroup(GROUP_DB, properties.contains(JDBCConstants.PROP_DATABASE)); + showControlGroup(GROUP_PATH, properties.contains(JDBCConstants.PROP_FOLDER) || properties.contains(JDBCConstants.PROP_FILE)); + } else { + isCustom = true; + showControlGroup(GROUP_HOST, false); + showControlGroup(GROUP_SERVER, false); + showControlGroup(GROUP_DB, false); + showControlGroup(GROUP_PATH, false); + urlText.setEditable(true); + } + UIUtils.fixReadonlyTextBackground(urlText); + showControlGroup(GROUP_LOGIN, !driver.isAnonymousAccess()); + updateCreateButton(driver); + + + settingsGroup.layout(); + } + + private void updateCreateButton(DBPDriver driver) { + if (driver == null) { + createButton.setEnabled(false); + return; + } + // Enable ""Create" button + String paramCreate = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_CREATE_URL_PARAM)); + createButton.setEnabled(!CommonUtils.isEmpty(paramCreate) && !CommonUtils.isEmpty(pathText.getText())); + } + + private void createEmbeddedDatabase() { + String paramCreate = CommonUtils.toString(site.getDriver().getDriverParameter(GenericConstants.PARAM_CREATE_URL_PARAM)); + + DataSourceDescriptor dataSource = (DataSourceDescriptor) site.getActiveDataSource(); + final DataSourceDescriptor testDataSource = new DataSourceDescriptor( + site.getDataSourceRegistry(), + dataSource.getId(), + dataSource.getDriver(), + new DBPConnectionConfiguration(dataSource.getConnectionConfiguration())); + + saveSettings(testDataSource); + DBPConnectionConfiguration cfg = testDataSource.getConnectionConfiguration(); + cfg.setUrl(cfg.getUrl() + paramCreate); + String databaseName = cfg.getDatabaseName(); + testDataSource.setName(databaseName); + + if (!UIUtils.confirmAction(getShell(), "Create Database", "Are you sure you want to create database '" + databaseName + "'?")) { + testDataSource.dispose(); + return; + } + + try { + site.getRunnableContext().run(true, true, monitor -> { + try { + createEmbeddedDatabase(monitor, testDataSource); + } catch (DBException e1) { + throw new InvocationTargetException(e1); + } + }); + MessageDialog.openInformation(getShell(), "Database Create", "Database '" + databaseName + "' created!"); + } catch (InvocationTargetException e1) { + DBWorkbench.getPlatformUI().showError("Create database", "Error creating database", e1.getTargetException()); + } catch (InterruptedException e1) { + // Just ignore + } + } + + private void createEmbeddedDatabase(DBRProgressMonitor monitor, DataSourceDescriptor testDataSource) throws DBException { + try { + // Connect and disconnect immediately + testDataSource.connect(monitor, true, true); + + testDataSource.disconnect(monitor); + } finally { + testDataSource.dispose(); + } + } + + private void saveAndUpdate() + { + // Save settings to update URL + saveSettings(site.getActiveDataSource()); + // Update buttons + site.updateButtons(); + } + + private void showControlGroup(String group, boolean show) + { + List controlList = propGroupMap.get(group); + if (controlList != null) { + for (Control control : controlList) { + GridData gd = (GridData)control.getLayoutData(); + if (gd == null) { + gd = new GridData(GridData.BEGINNING); + control.setLayoutData(gd); + } + gd.exclude = !show; + control.setVisible(show); + } + } + } + + private void addControlToGroup(String group, Control control) + { + List controlList = propGroupMap.get(group); + if (controlList == null) { + controlList = new ArrayList<>(); + propGroupMap.put(group, controlList); + } + controlList.add(control); + } + + @Override + public IDialogPage[] getSubPages() + { + return new IDialogPage[] { + new DriverPropertiesDialogPage(this) + }; + } + +} diff --git a/plugins/org.jkiss.dbeaver.ext.generic/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.generic/META-INF/MANIFEST.MF index d4a877c8ca..c615c7f7f8 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.generic/META-INF/MANIFEST.MF @@ -1,22 +1,21 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: DBeaver Generic Plug-in -Bundle-SymbolicName: org.jkiss.dbeaver.ext.generic; singleton:=true +Bundle-SymbolicName: org.jkiss.dbeaver.ext.generic;singleton:=true Bundle-Version: 2.3.92.qualifier Bundle-Release-Date: 20190408 -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.jkiss.dbeaver.core, +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui, org.eclipse.jface.text, org.eclipse.ui.views, org.eclipse.ui.workbench, - org.eclipse.ui.workbench.texteditor, - org.apache.commons.logging + org.jkiss.dbeaver.model, + org.jkiss.dbeaver.ui, + org.jkiss.dbeaver.ui.editors.base Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: JKISS Export-Package: org.jkiss.dbeaver.ext.generic, org.jkiss.dbeaver.ext.generic.edit, org.jkiss.dbeaver.ext.generic.model, - org.jkiss.dbeaver.ext.generic.model.meta, - org.jkiss.dbeaver.ext.generic.views + org.jkiss.dbeaver.ext.generic.model.meta diff --git a/plugins/org.jkiss.dbeaver.ext.generic/plugin.xml b/plugins/org.jkiss.dbeaver.ext.generic/plugin.xml index 8ee0ef661c..ddd303854e 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/plugin.xml +++ b/plugins/org.jkiss.dbeaver.ext.generic/plugin.xml @@ -20,7 +20,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaColumn.java b/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaColumn.java index 928dc292bb..acb944b997 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaColumn.java +++ b/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaColumn.java @@ -17,7 +17,6 @@ package org.jkiss.dbeaver.ext.generic.model.meta; import org.eclipse.core.runtime.IConfigurationElement; -import org.jkiss.dbeaver.registry.RegistryConstants; import org.jkiss.utils.CommonUtils; /** @@ -32,8 +31,8 @@ public class GenericMetaColumn { public GenericMetaColumn(IConfigurationElement cfg) { - this.id = cfg.getAttribute(RegistryConstants.ATTR_ID); - this.columnName = cfg.getAttribute(RegistryConstants.ATTR_NAME); + this.id = cfg.getAttribute("id"); + this.columnName = cfg.getAttribute("name"); String indexStr = cfg.getAttribute("index"); if (!CommonUtils.isEmpty(indexStr)) { this.columnIndex = Integer.valueOf(indexStr); diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaModelDescriptor.java b/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaModelDescriptor.java index df65fd14bd..5d23831db6 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaModelDescriptor.java +++ b/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaModelDescriptor.java @@ -19,10 +19,7 @@ package org.jkiss.dbeaver.ext.generic.model.meta; import org.eclipse.core.runtime.IConfigurationElement; import org.jkiss.code.NotNull; import org.jkiss.dbeaver.DBException; -import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel; -import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaObject; import org.jkiss.dbeaver.model.impl.AbstractDescriptor; -import org.jkiss.dbeaver.registry.RegistryConstants; import org.jkiss.utils.ArrayUtils; import org.jkiss.utils.CommonUtils; @@ -50,7 +47,7 @@ public class GenericMetaModelDescriptor extends AbstractDescriptor { super(cfg); this.contributorConfig = cfg; - this.id = cfg.getAttribute(RegistryConstants.ATTR_ID); + this.id = cfg.getAttribute("id"); IConfigurationElement[] objectList = cfg.getChildren("object"); if (!ArrayUtils.isEmpty(objectList)) { for (IConfigurationElement childConfig : objectList) { diff --git a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaObject.java b/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaObject.java index 1d5b2af6b5..8e436b44b5 100644 --- a/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaObject.java +++ b/plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaObject.java @@ -17,7 +17,6 @@ package org.jkiss.dbeaver.ext.generic.model.meta; import org.eclipse.core.runtime.IConfigurationElement; -import org.jkiss.dbeaver.registry.RegistryConstants; import java.util.HashMap; import java.util.Map; @@ -33,7 +32,7 @@ public class GenericMetaObject { public GenericMetaObject(IConfigurationElement cfg) { - this.type = cfg.getAttribute(RegistryConstants.ATTR_TYPE); + this.type = cfg.getAttribute("type"); this.readQuery = cfg.getAttribute("read-query"); for (IConfigurationElement columnCfg : cfg.getChildren("column")) { GenericMetaColumn column = new GenericMetaColumn(columnCfg); diff --git a/plugins/org.jkiss.dbeaver.ext.h2/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.h2/META-INF/MANIFEST.MF index cc4a4d5e67..49ee63622d 100644 --- a/plugins/org.jkiss.dbeaver.ext.h2/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.h2/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.views, org.eclipse.jface, org.eclipse.jface.text, - org.jkiss.dbeaver.core, + org.jkiss.dbeaver.model, org.eclipse.ui.workbench.texteditor, org.jkiss.dbeaver.ext.generic Bundle-ActivationPolicy: lazy diff --git a/plugins/org.jkiss.dbeaver.ext.vertica/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.ext.vertica/META-INF/MANIFEST.MF index 141ab31b5b..46796f74a8 100644 --- a/plugins/org.jkiss.dbeaver.ext.vertica/META-INF/MANIFEST.MF +++ b/plugins/org.jkiss.dbeaver.ext.vertica/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jface.text, org.jkiss.dbeaver.core, org.eclipse.ui.workbench.texteditor, - org.jkiss.dbeaver.ext.generic + org.jkiss.dbeaver.ext.generic, + org.jkiss.dbeaver.ext.generic.ui Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: %Bundle-Vendor diff --git a/plugins/pom.xml b/plugins/pom.xml index 9be4ea7540..e16564de2a 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -35,6 +35,9 @@ org.jkiss.dbeaver.core.application org.jkiss.dbeaver.core.eclipse + org.jkiss.dbeaver.ext.generic + org.jkiss.dbeaver.ext.generic.ui + org.jkiss.dbeaver.ext.athena org.jkiss.dbeaver.ext.bigquery org.jkiss.dbeaver.ext.clickhouse @@ -44,7 +47,6 @@ org.jkiss.dbeaver.ext.erd org.jkiss.dbeaver.ext.es.ui org.jkiss.dbeaver.ext.firebird - org.jkiss.dbeaver.ext.generic org.jkiss.dbeaver.ext.greenplum org.jkiss.dbeaver.ext.import_config org.jkiss.dbeaver.ext.format.sqlworkbenchj -- GitLab