Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
429bd48c
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
429bd48c
编写于
12月 27, 2017
作者:
S
Sergei.Rider
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/devel' into devel
上级
1735b94c
a67cc282
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
601 addition
and
48 deletion
+601
-48
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
...ns/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
+7
-0
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+26
-0
plugins/org.jkiss.dbeaver.core/schema/org.jkiss.dbeaver.language.exsd
...jkiss.dbeaver.core/schema/org.jkiss.dbeaver.language.exsd
+92
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
...beaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
...dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
+3
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
....core/src/org/jkiss/dbeaver/core/CoreResources.properties
+3
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
....dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
+46
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
...org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/RegistryConstants.java
...ore/src/org/jkiss/dbeaver/registry/RegistryConstants.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/language/PlatformLanguageDescriptor.java
...dbeaver/registry/language/PlatformLanguageDescriptor.java
+64
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/language/PlatformLanguageRegistry.java
...s/dbeaver/registry/language/PlatformLanguageRegistry.java
+78
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseProducerPageExtractSettings.java
...ransfer/database/DatabaseProducerPageExtractSettings.java
+36
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseProducerSettings.java
...ver/tools/transfer/database/DatabaseProducerSettings.java
+18
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferProducer.java
...ver/tools/transfer/database/DatabaseTransferProducer.java
+12
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferWizard.java
...iss/dbeaver/tools/transfer/wizard/DataTransferWizard.java
+6
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCommandHandler.java
...beaver/ui/controls/resultset/ResultSetCommandHandler.java
+16
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetDataContainer.java
...dbeaver/ui/controls/resultset/ResultSetDataContainer.java
+59
-36
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetDataContainerOptions.java
.../ui/controls/resultset/ResultSetDataContainerOptions.java
+60
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/plaintext/PlainTextPresentation.java
...i/controls/resultset/plaintext/PlainTextPresentation.java
+5
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageDatabaseGeneral.java
...jkiss/dbeaver/ui/preferences/PrefPageDatabaseGeneral.java
+28
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageResultSetPresentation.java
...dbeaver/ui/preferences/PrefPageResultSetPresentation.java
+6
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/app/DBPPlatform.java
...er.model/src/org/jkiss/dbeaver/model/app/DBPPlatform.java
+4
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/app/DBPPlatformLanguage.java
.../src/org/jkiss/dbeaver/model/app/DBPPlatformLanguage.java
+29
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
浏览文件 @
429bd48c
...
...
@@ -22,6 +22,7 @@ extension-point.org.jkiss.dbeaver.sql.covertname = SQL text conversions
extension-point.org.jkiss.dbeaver.tools.name
=
Tools
extension-point.org.jkiss.dbeaver.product.bundles.name
=
Product bundles
extension-point.org.jkiss.dbeaver.workbenchHandler.name
=
Workbench handlers
extension-point.org.jkiss.dbeaver.language.name
=
Language
content-type.org.jkiss.dbeaver.sql.name
=
SQL Script
content-type.org.jkiss.dbeaver.bookmark.name
=
Bookmark
...
...
@@ -36,6 +37,12 @@ view.database.output.title=Output
menu.navigate
=
Navigate
language.en.label
=
English
language.zh.label
=
Chinese
language.ru.label
=
Russian
language.it.label
=
Italian
language.de.label
=
German
editor.sql.name
=
SQL Editor
editor.folder.name
=
Folder Editor
editor.entity.name
=
Entity Editor
...
...
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
429bd48c
...
...
@@ -39,6 +39,7 @@
<extension-point
id=
"org.jkiss.dbeaver.tools"
name=
"%extension-point.org.jkiss.dbeaver.tools.name"
schema=
"schema/org.jkiss.dbeaver.tools.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.product.bundles"
name=
"%extension-point.org.jkiss.dbeaver.product.bundles.name"
schema=
"schema/org.jkiss.dbeaver.product.bundles.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.workbenchHandler"
name=
"%extension-point.org.jkiss.dbeaver.workbenchHandler.name"
schema=
"schema/org.jkiss.dbeaver.workbenchHandler.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.language"
name=
"%extension-point.org.jkiss.dbeaver.language.name"
schema=
"schema/org.jkiss.dbeaver.language.exsd"
/>
<extension
point=
"org.eclipse.core.contenttype.contentTypes"
>
<content-type
...
...
@@ -2278,6 +2279,14 @@
</visibleWhen>
</command>
<separator
name=
"misc"
visible=
"true"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.tools.select.connection"
label=
"%command.org.jkiss.dbeaver.ui.tools.select.connection.name"
tooltip=
"%command.org.jkiss.dbeaver.ui.tools.select.connection.description"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.tools.select.schema"
label=
"%command.org.jkiss.dbeaver.ui.tools.select.schema.name"
tooltip=
"%command.org.jkiss.dbeaver.ui.tools.select.schema.description"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
label=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.name"
...
...
@@ -2326,6 +2335,15 @@
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.export.data"
label=
"%command.org.jkiss.dbeaver.ui.editors.sql.export.data.name"
/>
<separator
name=
"additions_active_object"
visible=
"true"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.tools.select.connection"
label=
"%command.org.jkiss.dbeaver.ui.tools.select.connection.name"
tooltip=
"%command.org.jkiss.dbeaver.ui.tools.select.connection.description"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.tools.select.schema"
label=
"%command.org.jkiss.dbeaver.ui.tools.select.schema.name"
tooltip=
"%command.org.jkiss.dbeaver.ui.tools.select.schema.description"
/>
</menu>
<menu
id=
"org.jkiss.dbeaver.ui.editors.sql.SQLEditor.file"
label=
"%menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.file.label"
>
<command
...
...
@@ -3611,6 +3629,14 @@
class=
"org.jkiss.dbeaver.ui.editors.sql.convert.impl.HTMLSQLConverter"
/>
</extension>
<extension
point=
"org.jkiss.dbeaver.language"
>
<language
code=
"en"
label=
"%language.en.label"
/>
<language
code=
"zh"
label=
"%language.zh.label"
/>
<language
code=
"ru"
label=
"%language.ru.label"
/>
<language
code=
"it"
label=
"%language.it.label"
/>
<language
code=
"de"
label=
"%language.de.label"
/>
</extension>
<extension
point=
"org.eclipse.search.searchPages"
>
<page
...
...
plugins/org.jkiss.dbeaver.core/schema/org.jkiss.dbeaver.language.exsd
0 → 100644
浏览文件 @
429bd48c
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema
targetNamespace=
"org.jkiss.dbeaver.core"
xmlns=
"http://www.w3.org/2001/XMLSchema"
>
<annotation>
<appInfo>
<meta.schema
plugin=
"org.jkiss.dbeaver.core"
id=
"org.jkiss.dbeaver.language"
name=
"Language description"
/>
</appInfo>
<documentation>
Plugin Service
</documentation>
</annotation>
<element
name=
"extension"
>
<annotation>
<appInfo>
<meta.element
/>
</appInfo>
</annotation>
<complexType>
<sequence>
<element
ref=
"language"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</sequence>
<attribute
name=
"point"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"class"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"language"
>
<complexType>
<attribute
name=
"class"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
kind=
"java"
basedOn=
":org.jkiss.dbeaver.runtime.IPluginService"
/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section
type=
"since"
/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"examples"
/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"apiinfo"
/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"implementation"
/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
浏览文件 @
429bd48c
...
...
@@ -138,6 +138,7 @@ public final class DBeaverPreferences
public
static
final
String
RESULT_TEXT_MAX_COLUMN_SIZE
=
"resultset.text.max.column.size"
;
//$NON-NLS-1$
public
static
final
String
RESULT_TEXT_VALUE_FORMAT
=
"resultset.text.value.format"
;
//$NON-NLS-1$
public
static
final
String
RESULT_TEXT_SHOW_NULLS
=
"resultset.text.show.nulls"
;
//$NON-NLS-1$
public
static
final
String
RESULT_TEXT_DELIMITER_LEADING
=
"resultset.text.delimiter.leading"
;
//$NON-NLS-1$
public
static
final
String
RESULT_TEXT_DELIMITER_TRAILING
=
"resultset.text.delimiter.trailing"
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
浏览文件 @
429bd48c
...
...
@@ -414,6 +414,8 @@ public class CoreMessages extends NLS {
public
static
String
data_transfer_wizard_output_checkbox_new_connection
;
public
static
String
data_transfer_wizard_output_checkbox_open_folder
;
public
static
String
data_transfer_wizard_output_checkbox_select_row_count
;
public
static
String
data_transfer_wizard_output_checkbox_selected_columns_only
;
public
static
String
data_transfer_wizard_output_checkbox_selected_rows_only
;
public
static
String
data_transfer_wizard_output_combo_extract_type_item_by_segments
;
public
static
String
data_transfer_wizard_output_combo_extract_type_item_single_query
;
public
static
String
data_transfer_wizard_output_description
;
...
...
@@ -994,6 +996,7 @@ public class CoreMessages extends NLS {
public
static
String
pref_page_database_resultsets_group_plain_text
;
public
static
String
pref_page_database_resultsets_lable_value_format
;
public
static
String
pref_page_database_resultsets_label_maximum_column_length
;
public
static
String
pref_page_database_resultsets_label_text_show_nulls
;
public
static
String
pref_page_database_resultsets_label_text_delimiter_leading
;
public
static
String
pref_page_database_resultsets_label_text_delimiter_trailing
;
// Connections
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
浏览文件 @
429bd48c
...
...
@@ -282,6 +282,8 @@ data_transfer_wizard_output_checkbox_compress = Compress
data_transfer_wizard_output_checkbox_new_connection
=
Open new connection(s)
data_transfer_wizard_output_checkbox_open_folder
=
Open output folder at end
data_transfer_wizard_output_checkbox_select_row_count
=
Select row count
data_transfer_wizard_output_checkbox_selected_columns_only
=
Selected columns only
data_transfer_wizard_output_checkbox_selected_rows_only
=
Selected rows only
data_transfer_wizard_output_combo_extract_type_item_by_segments
=
By segments
data_transfer_wizard_output_combo_extract_type_item_single_query
=
Single query
data_transfer_wizard_output_description
=
Configure export output parameters
...
...
@@ -957,6 +959,7 @@ pref_page_database_resultsets_label_double_click_behavior = Double-click behavio
pref_page_database_resultsets_group_plain_text
=
Plain text
pref_page_database_resultsets_lable_value_format
=
Value Format
pref_page_database_resultsets_label_maximum_column_length
=
Maximum column length
pref_page_database_resultsets_label_text_show_nulls
=
Show NULLs
pref_page_database_resultsets_label_text_delimiter_leading
=
Leading delimiter
pref_page_database_resultsets_label_text_delimiter_trailing
=
Trailing delimiter
pref_page_database_client_name_group
=
Client Application Name
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
浏览文件 @
429bd48c
...
...
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.CoreException;
import
org.eclipse.core.runtime.IProgressMonitor
;
import
org.eclipse.core.runtime.NullProgressMonitor
;
import
org.eclipse.core.runtime.Platform
;
import
org.eclipse.e4.core.services.nls.ILocaleChangeService
;
import
org.eclipse.ui.IWorkbench
;
import
org.eclipse.ui.PlatformUI
;
import
org.jkiss.code.NotNull
;
...
...
@@ -46,6 +47,7 @@ import org.jkiss.dbeaver.registry.PluginServiceRegistry;
import
org.jkiss.dbeaver.registry.ProjectRegistry
;
import
org.jkiss.dbeaver.registry.datatype.DataTypeProviderRegistry
;
import
org.jkiss.dbeaver.registry.editor.EntityEditorsRegistry
;
import
org.jkiss.dbeaver.registry.language.PlatformLanguageRegistry
;
import
org.jkiss.dbeaver.registry.sql.SQLFormatterConfigurationRegistry
;
import
org.jkiss.dbeaver.runtime.IPluginService
;
import
org.jkiss.dbeaver.runtime.jobs.KeepAliveJob
;
...
...
@@ -65,6 +67,7 @@ import java.net.ProxySelector;
import
java.nio.file.Files
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
/**
* DBeaverCore
...
...
@@ -77,6 +80,7 @@ public class DBeaverCore implements DBPPlatform {
private
static
final
Log
log
=
Log
.
getLog
(
DBeaverCore
.
class
);
public
static
final
String
TEMP_PROJECT_NAME
=
".dbeaver-temp"
;
//$NON-NLS-1$
public
static
final
String
PLATFORM_LANGUAGE_PROP
=
"platform-language"
;
//$NON-NLS-1$
private
static
final
DBPApplication
DEFAULT_APPLICATION
=
new
EclipseApplication
();
...
...
@@ -88,6 +92,7 @@ public class DBeaverCore implements DBPPlatform {
private
File
tempFolder
;
private
IWorkspace
workspace
;
private
DBPPlatformLanguage
language
;
private
OSDescriptor
localSystem
;
private
DBNModel
navigatorModel
;
...
...
@@ -181,10 +186,26 @@ public class DBeaverCore implements DBPPlatform {
long
startTime
=
System
.
currentTimeMillis
();
log
.
debug
(
"Initialize Core..."
);
DBPPreferenceStore
prefsStore
=
getGlobalPreferenceStore
();
// Register properties adapter
this
.
workspace
=
ResourcesPlugin
.
getWorkspace
();
this
.
localSystem
=
new
OSDescriptor
(
Platform
.
getOS
(),
Platform
.
getOSArch
());
{
String
runtimeLocaleString
=
prefsStore
.
getString
(
PLATFORM_LANGUAGE_PROP
);
if
(!
CommonUtils
.
isEmpty
(
runtimeLocaleString
))
{
this
.
language
=
PlatformLanguageRegistry
.
getInstance
().
getLanguage
(
Locale
.
forLanguageTag
(
runtimeLocaleString
));
if
(
this
.
language
==
null
)
{
log
.
warn
(
"Runtime locale '"
+
runtimeLocaleString
+
"' not found"
);
}
else
{
changeRuntimeLocale
(
this
.
language
);
}
}
if
(
this
.
language
==
null
)
{
this
.
language
=
PlatformLanguageRegistry
.
getInstance
().
getLanguage
(
Locale
.
ENGLISH
);
}
}
QMUtils
.
initApplication
(
this
);
this
.
queryManager
=
new
QMControllerImpl
();
...
...
@@ -326,6 +347,31 @@ public class DBeaverCore implements DBPPlatform {
return
application
;
}
@NotNull
@Override
public
DBPPlatformLanguage
getLanguage
()
{
return
language
;
}
public
void
setPlatformLanguage
(
@NotNull
DBPPlatformLanguage
language
)
{
if
(
CommonUtils
.
equalObjects
(
language
,
this
.
language
))
{
return
;
}
changeRuntimeLocale
(
language
);
this
.
language
=
language
;
getGlobalPreferenceStore
().
setValue
(
PLATFORM_LANGUAGE_PROP
,
language
.
getCode
());
}
private
void
changeRuntimeLocale
(
@NotNull
DBPPlatformLanguage
runtimeLocale
)
{
// Check locale
ILocaleChangeService
localeService
=
PlatformUI
.
getWorkbench
().
getService
(
ILocaleChangeService
.
class
);
if
(
localeService
!=
null
)
{
localeService
.
changeApplicationLocale
(
runtimeLocale
.
getCode
());
}
else
{
log
.
warn
(
"Can't resolve locale change service"
);
}
}
@NotNull
@Override
public
DBNModel
getNavigatorModel
()
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
浏览文件 @
429bd48c
...
...
@@ -184,6 +184,7 @@ public class DBeaverPreferencesInitializer extends AbstractPreferenceInitializer
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_SET_ROW_BATCH_SIZE
,
1
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
,
255
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
,
DBDDisplayFormat
.
EDIT
.
name
());
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_SHOW_NULLS
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_LEADING
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_TRAILING
,
true
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/RegistryConstants.java
浏览文件 @
429bd48c
...
...
@@ -77,6 +77,7 @@ public class RegistryConstants {
public
static
final
String
ATTR_DRIVER
=
"driver"
;
//$NON-NLS-1$
public
static
final
String
ATTR_BUNDLE
=
"bundle"
;
//$NON-NLS-1$
public
static
final
String
ATTR_CODE
=
"code"
;
//$NON-NLS-1$
public
static
final
String
ATTR_LABEL
=
"label"
;
//$NON-NLS-1$
public
static
final
String
ATTR_DEFAULT_PORT
=
"defaultPort"
;
//$NON-NLS-1$
public
static
final
String
ATTR_SAMPLE_URL
=
"sampleURL"
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/language/PlatformLanguageDescriptor.java
0 → 100644
浏览文件 @
429bd48c
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 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.registry.language
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.app.DBPPlatformLanguage
;
import
org.jkiss.dbeaver.registry.AbstractContextDescriptor
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
/**
* PlatformLanguageDescriptor
*/
public
class
PlatformLanguageDescriptor
extends
AbstractContextDescriptor
implements
DBPPlatformLanguage
{
public
static
final
String
EXTENSION_ID
=
"org.jkiss.dbeaver.language"
;
//$NON-NLS-1$
private
final
String
code
;
private
final
String
label
;
private
final
String
description
;
public
PlatformLanguageDescriptor
(
IConfigurationElement
config
)
{
super
(
config
);
this
.
code
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_CODE
);
this
.
label
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_LABEL
);
this
.
description
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_DESCRIPTION
);
}
@NotNull
@Override
public
String
getCode
()
{
return
code
;
}
@NotNull
@Override
public
String
getLabel
()
{
return
label
;
}
public
String
getDescription
()
{
return
description
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/language/PlatformLanguageRegistry.java
0 → 100644
浏览文件 @
429bd48c
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 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.registry.language
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.IExtensionRegistry
;
import
org.eclipse.core.runtime.Platform
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
public
class
PlatformLanguageRegistry
{
private
static
PlatformLanguageRegistry
instance
=
null
;
public
synchronized
static
PlatformLanguageRegistry
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
PlatformLanguageRegistry
(
Platform
.
getExtensionRegistry
());
}
return
instance
;
}
private
final
List
<
PlatformLanguageDescriptor
>
descriptors
=
new
ArrayList
<>();
private
PlatformLanguageRegistry
(
IExtensionRegistry
registry
)
{
// Load data descriptors from external plugins
{
IConfigurationElement
[]
extElements
=
registry
.
getConfigurationElementsFor
(
PlatformLanguageDescriptor
.
EXTENSION_ID
);
for
(
IConfigurationElement
ext
:
extElements
)
{
PlatformLanguageDescriptor
formatterDescriptor
=
new
PlatformLanguageDescriptor
(
ext
);
descriptors
.
add
(
formatterDescriptor
);
}
}
}
public
List
<
PlatformLanguageDescriptor
>
getLanguages
()
{
return
descriptors
;
}
public
PlatformLanguageDescriptor
getLanguage
(
String
id
)
{
for
(
PlatformLanguageDescriptor
descriptor
:
descriptors
)
{
if
(
descriptor
.
getCode
().
equals
(
id
))
{
return
descriptor
;
}
}
return
null
;
}
public
PlatformLanguageDescriptor
getLanguage
(
Locale
locale
)
{
for
(
PlatformLanguageDescriptor
descriptor
:
descriptors
)
{
if
(
descriptor
.
getCode
().
equals
(
locale
.
getLanguage
()))
{
return
descriptor
;
}
}
return
null
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseProducerPageExtractSettings.java
浏览文件 @
429bd48c
...
...
@@ -16,6 +16,7 @@
*/
package
org.jkiss.dbeaver.tools.transfer.database
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.ModifyEvent
;
import
org.eclipse.swt.events.ModifyListener
;
...
...
@@ -27,6 +28,7 @@ import org.eclipse.swt.widgets.*;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.tools.transfer.wizard.DataTransferWizard
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.GridPos
;
import
org.jkiss.dbeaver.ui.dialogs.ActiveWizardPage
;
public
class
DatabaseProducerPageExtractSettings
extends
ActiveWizardPage
<
DataTransferWizard
>
{
...
...
@@ -85,6 +87,7 @@ public class DatabaseProducerPageExtractSettings extends ActiveWizardPage<DataTr
threadsNumText
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
3
,
1
));
{
UIUtils
.
createControlLabel
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_label_extract_type
);
rowsExtractType
=
new
Combo
(
generalSettings
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
rowsExtractType
.
setItems
(
new
String
[]
{
...
...
@@ -118,23 +121,52 @@ public class DatabaseProducerPageExtractSettings extends ActiveWizardPage<DataTr
segmentSizeText
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_END
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
1
,
1
));
}
newConnectionCheckbox
=
UIUtils
.
create
LabelCheckbox
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_new_connection
,
true
);
newConnectionCheckbox
=
UIUtils
.
create
Checkbox
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_new_connection
,
null
,
true
,
4
);
newConnectionCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setOpenNewConnections
(
newConnectionCheckbox
.
getSelection
());
}
});
newConnectionCheckbox
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
3
,
1
));
rowCountCheckbox
=
UIUtils
.
create
LabelCheckbox
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_select_row_count
,
true
);
rowCountCheckbox
=
UIUtils
.
create
Checkbox
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_select_row_count
,
null
,
true
,
4
);
rowCountCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setQueryRowCount
(
rowCountCheckbox
.
getSelection
());
}
});
rowCountCheckbox
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
3
,
1
));
IStructuredSelection
curSelection
=
getWizard
().
getCurrentSelection
();
boolean
hasSelection
=
curSelection
!=
null
&&
!
curSelection
.
isEmpty
()
&&
curSelection
.
getFirstElement
()
instanceof
GridPos
;
if
(
hasSelection
)
{
Button
selectedColumnsOnlyCheckbox
=
UIUtils
.
createCheckbox
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_selected_columns_only
,
null
,
false
,
4
);
selectedColumnsOnlyCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setSelectedColumnsOnly
(
selectedColumnsOnlyCheckbox
.
getSelection
());
}
});
Button
selectedRowsOnlyCheckbox
=
UIUtils
.
createCheckbox
(
generalSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_selected_rows_only
,
null
,
false
,
4
);
selectedRowsOnlyCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setSelectedRowsOnly
(
selectedRowsOnlyCheckbox
.
getSelection
());
}
});
SelectionAdapter
listener
=
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
boolean
selection
=
selectedColumnsOnlyCheckbox
.
getSelection
()
||
selectedRowsOnlyCheckbox
.
getSelection
();
newConnectionCheckbox
.
setEnabled
(!
selection
);
}
};
selectedColumnsOnlyCheckbox
.
addSelectionListener
(
listener
);
selectedRowsOnlyCheckbox
.
addSelectionListener
(
listener
);
}
}
setControl
(
composite
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseProducerSettings.java
浏览文件 @
429bd48c
...
...
@@ -38,6 +38,8 @@ public class DatabaseProducerSettings implements IDataTransferSettings {
private
boolean
openNewConnections
=
true
;
private
boolean
queryRowCount
=
true
;
private
boolean
selectedRowsOnly
=
false
;
private
boolean
selectedColumnsOnly
=
false
;
private
ExtractType
extractType
=
ExtractType
.
SINGLE_QUERY
;
public
DatabaseProducerSettings
()
...
...
@@ -66,6 +68,22 @@ public class DatabaseProducerSettings implements IDataTransferSettings {
this
.
queryRowCount
=
queryRowCount
;
}
public
boolean
isSelectedRowsOnly
()
{
return
selectedRowsOnly
;
}
public
void
setSelectedRowsOnly
(
boolean
selectedRowsOnly
)
{
this
.
selectedRowsOnly
=
selectedRowsOnly
;
}
public
boolean
isSelectedColumnsOnly
()
{
return
selectedColumnsOnly
;
}
public
void
setSelectedColumnsOnly
(
boolean
selectedColumnsOnly
)
{
this
.
selectedColumnsOnly
=
selectedColumnsOnly
;
}
public
boolean
isOpenNewConnections
()
{
return
openNewConnections
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferProducer.java
浏览文件 @
429bd48c
...
...
@@ -31,6 +31,7 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferConsumer
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferProducer
;
import
org.jkiss.dbeaver.ui.controls.resultset.ResultSetDataContainer
;
/**
* Data container transfer producer
...
...
@@ -68,17 +69,25 @@ public class DatabaseTransferProducer implements IDataTransferProducer<DatabaseP
DatabaseProducerSettings
settings
)
throws
DBException
{
String
contextTask
=
CoreMessages
.
data_transfer_wizard_job_task_export
;
DBPDataSource
dataSource
=
getSourceObject
().
getDataSource
();
assert
(
dataSource
!=
null
);
boolean
selectiveExportFromUI
=
settings
.
isSelectedColumnsOnly
()
||
settings
.
isSelectedRowsOnly
();
if
(
dataContainer
instanceof
ResultSetDataContainer
)
{
((
ResultSetDataContainer
)
dataContainer
).
getOptions
().
setExportSelectedRows
(
settings
.
isSelectedRowsOnly
());
((
ResultSetDataContainer
)
dataContainer
).
getOptions
().
setExportSelectedColumns
(
settings
.
isSelectedColumnsOnly
());
}
boolean
newConnection
=
settings
.
isOpenNewConnections
();
boolean
forceDataReadTransactions
=
Boolean
.
TRUE
.
equals
(
dataSource
.
getDataSourceFeature
(
FEATURE_FORCE_TRANSACTIONS
));
DBCExecutionContext
context
=
newConnection
?
DBCExecutionContext
context
=
!
selectiveExportFromUI
&&
newConnection
?
dataSource
.
openIsolatedContext
(
monitor
,
"Data transfer producer"
)
:
dataSource
.
getDefaultContext
(
false
);
try
(
DBCSession
session
=
context
.
openSession
(
monitor
,
DBCExecutionPurpose
.
UTIL
,
contextTask
))
{
try
{
AbstractExecutionSource
transferSource
=
new
AbstractExecutionSource
(
dataContainer
,
context
,
consumer
);
session
.
enableLogging
(
false
);
if
(
newConnection
||
forceDataReadTransactions
)
{
if
(
!
selectiveExportFromUI
&&
(
newConnection
||
forceDataReadTransactions
)
)
{
// Turn off auto-commit in source DB
// Auto-commit has to be turned off because some drivers allows to read LOBs and
// other complex structures only in transactional mode
...
...
@@ -138,7 +147,7 @@ public class DatabaseTransferProducer implements IDataTransferProducer<DatabaseP
}
}
finally
{
if
(
newConnection
||
forceDataReadTransactions
)
{
if
(
!
selectiveExportFromUI
&&
(
newConnection
||
forceDataReadTransactions
)
)
{
DBCTransactionManager
txnManager
=
DBUtils
.
getTransactionManager
(
context
);
if
(
txnManager
!=
null
)
{
try
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferWizard.java
浏览文件 @
429bd48c
...
...
@@ -41,12 +41,17 @@ public class DataTransferWizard extends Wizard implements IExportWizard {
private
static
final
String
RS_EXPORT_WIZARD_DIALOG_SETTINGS
=
"DataTransfer"
;
//$NON-NLS-1$
private
DataTransferSettings
settings
;
private
IStructuredSelection
currentSelection
;
public
DataTransferWizard
(
@Nullable
IDataTransferProducer
[]
producers
,
@Nullable
IDataTransferConsumer
[]
consumers
)
{
this
.
settings
=
new
DataTransferSettings
(
producers
,
consumers
);
loadSettings
();
}
public
IStructuredSelection
getCurrentSelection
()
{
return
currentSelection
;
}
private
void
loadSettings
()
{
IDialogSettings
section
=
UIUtils
.
getDialogSettings
(
RS_EXPORT_WIZARD_DIALOG_SETTINGS
);
...
...
@@ -79,6 +84,7 @@ public class DataTransferWizard extends Wizard implements IExportWizard {
public
void
init
(
IWorkbench
workbench
,
IStructuredSelection
currentSelection
)
{
setWindowTitle
(
CoreMessages
.
data_transfer_wizard_name
);
setNeedsProgressMonitor
(
true
);
this
.
currentSelection
=
currentSelection
;
}
@Nullable
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCommandHandler.java
浏览文件 @
429bd48c
...
...
@@ -414,11 +414,25 @@ public class ResultSetCommandHandler extends AbstractHandler {
break
;
}
case
CMD_EXPORT:
{
List
<
Long
>
selectedRows
=
new
ArrayList
<>();
for
(
ResultSetRow
selectedRow
:
rsv
.
getSelection
().
getSelectedRows
())
{
selectedRows
.
add
(
Long
.
valueOf
(
selectedRow
.
getRowNumber
()));
}
List
<
String
>
selectedAttributes
=
new
ArrayList
<>();
for
(
DBDAttributeBinding
attributeBinding
:
rsv
.
getSelection
().
getSelectedAttributes
())
{
selectedAttributes
.
add
(
attributeBinding
.
getName
());
}
ResultSetDataContainerOptions
options
=
new
ResultSetDataContainerOptions
();
options
.
setSelectedRows
(
selectedRows
);
options
.
setSelectedColumns
(
selectedAttributes
);
ResultSetDataContainer
dataContainer
=
new
ResultSetDataContainer
(
rsv
.
getDataContainer
(),
rsv
.
getModel
(),
options
);
ActiveWizardDialog
dialog
=
new
ActiveWizardDialog
(
HandlerUtil
.
getActiveWorkbenchWindow
(
event
),
new
DataTransferWizard
(
new
IDataTransferProducer
[]{
new
DatabaseTransferProducer
(
rsv
.
getDataContainer
()
,
rsv
.
getModel
().
getDataFilter
())},
new
IDataTransferProducer
[]
{
new
DatabaseTransferProducer
(
dataContainer
,
rsv
.
getModel
().
getDataFilter
())},
null
),
rsv
.
getSelection
()
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetDataContainer.java
浏览文件 @
429bd48c
...
...
@@ -23,16 +23,10 @@ import org.jkiss.dbeaver.model.data.DBDAttributeBinding;
import
org.jkiss.dbeaver.model.data.DBDDataFilter
;
import
org.jkiss.dbeaver.model.data.DBDDataReceiver
;
import
org.jkiss.dbeaver.model.data.DBDValueMeta
;
import
org.jkiss.dbeaver.model.exec.DBCAttributeMetaData
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionSource
;
import
org.jkiss.dbeaver.model.exec.DBCResultSet
;
import
org.jkiss.dbeaver.model.exec.DBCResultSetMetaData
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.DBCStatement
;
import
org.jkiss.dbeaver.model.exec.DBCStatistics
;
import
org.jkiss.dbeaver.model.exec.*
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -45,12 +39,14 @@ public class ResultSetDataContainer implements DBSDataContainer {
private
static
final
Log
log
=
Log
.
getLog
(
ResultSetDataContainer
.
class
);
private
final
ResultSet
DataContainer
dataContainer
;
private
final
DBS
DataContainer
dataContainer
;
private
final
ResultSetModel
model
;
private
ResultSetDataContainerOptions
options
;
public
ResultSetDataContainer
(
ResultSetDataContainer
dataContainer
,
ResultSetModel
model
)
{
public
ResultSetDataContainer
(
DBSDataContainer
dataContainer
,
ResultSetModel
model
,
ResultSetDataContainerOptions
options
)
{
this
.
dataContainer
=
dataContainer
;
this
.
model
=
model
;
this
.
options
=
options
;
}
@Override
...
...
@@ -73,40 +69,63 @@ public class ResultSetDataContainer implements DBSDataContainer {
return
DATA_SELECT
|
DATA_COUNT
;
}
public
ResultSetDataContainerOptions
getOptions
()
{
return
options
;
}
@Override
public
DBCStatistics
readData
(
DBCExecutionSource
source
,
DBCSession
session
,
DBDDataReceiver
dataReceiver
,
DBDDataFilter
dataFilter
,
long
firstRow
,
long
maxRows
,
long
flags
)
throws
DBCException
{
DBCStatistics
statistics
=
new
DBCStatistics
();
long
startTime
=
System
.
currentTimeMillis
();
if
(
proceedSelectedRowsOnly
()
||
proceedSelectedColumnsOnly
())
{
statistics
.
setExecuteTime
(
System
.
currentTimeMillis
()
-
startTime
);
long
startTime
=
System
.
currentTimeMillis
();
DBCStatistics
statistics
=
new
DBCStatistics
();
statistics
.
setExecuteTime
(
System
.
currentTimeMillis
()
-
startTime
);
//LocalSta
ModelResultSet
resultSet
=
new
ModelResultSet
(
session
);
long
resultCount
=
0
;
try
{
dataReceiver
.
fetchStart
(
session
,
resultSet
,
firstRow
,
maxRows
);
while
(
resultSet
.
nextRow
())
{
resultCount
++;
dataReceiver
.
fetchRow
(
session
,
resultSet
);
}
}
finally
{
//LocalSta
ModelResultSet
resultSet
=
new
ModelResultSet
(
session
);
long
resultCount
=
0
;
try
{
dataReceiver
.
fetchEnd
(
session
,
resultSet
);
}
catch
(
DBCException
e
)
{
log
.
error
(
"Error while finishing result set fetch"
,
e
);
//$NON-NLS-1$
dataReceiver
.
fetchStart
(
session
,
resultSet
,
firstRow
,
maxRows
);
while
(
resultSet
.
nextRow
())
{
if
(!
proceedSelectedRowsOnly
()
||
options
.
getSelectedRows
().
contains
(
resultCount
))
{
dataReceiver
.
fetchRow
(
session
,
resultSet
);
}
resultCount
++;
}
}
finally
{
try
{
dataReceiver
.
fetchEnd
(
session
,
resultSet
);
}
catch
(
DBCException
e
)
{
log
.
error
(
"Error while finishing result set fetch"
,
e
);
//$NON-NLS-1$
}
resultSet
.
close
();
dataReceiver
.
close
();
}
resultSet
.
close
();
dataReceiver
.
close
();
statistics
.
setFetchTime
(
System
.
currentTimeMillis
()
-
startTime
);
statistics
.
setRowsFetched
(
resultCount
);
return
statistics
;
}
else
{
return
dataContainer
.
readData
(
source
,
session
,
dataReceiver
,
dataFilter
,
firstRow
,
maxRows
,
flags
);
}
statistics
.
setFetchTime
(
System
.
currentTimeMillis
()
-
startTime
);
statistics
.
setRowsFetched
(
resultCount
);
return
statistics
;
}
private
boolean
proceedSelectedColumnsOnly
()
{
return
options
.
isExportSelectedColumns
()
&&
!
CommonUtils
.
isEmpty
(
options
.
getSelectedColumns
());
}
private
boolean
proceedSelectedRowsOnly
()
{
return
options
.
isExportSelectedRows
()
&&
!
CommonUtils
.
isEmpty
(
options
.
getSelectedRows
());
}
@Override
public
long
countData
(
DBCExecutionSource
source
,
DBCSession
session
,
DBDDataFilter
dataFilter
)
throws
DBCException
{
return
model
.
getRowCount
();
if
(
proceedSelectedRowsOnly
())
{
return
options
.
getSelectedRows
().
size
();
}
else
if
(
proceedSelectedColumnsOnly
())
{
return
model
.
getRowCount
();
}
else
{
return
dataContainer
.
countData
(
source
,
session
,
dataFilter
);
}
}
@Override
...
...
@@ -192,10 +211,14 @@ public class ResultSetDataContainer implements DBSDataContainer {
return
new
DBCResultSetMetaData
()
{
@Override
public
List
<
DBCAttributeMetaData
>
getAttributes
()
{
DBDAttributeBinding
[]
attributes
=
model
.
getAttributes
();
List
<
DBCAttributeMetaData
>
meta
=
new
ArrayList
<>(
attributes
.
length
);
List
<
DBDAttributeBinding
>
attributes
=
model
.
getVisibleAttributes
();
List
<
DBCAttributeMetaData
>
meta
=
new
ArrayList
<>(
attributes
.
size
());
boolean
selectedColumnsOnly
=
proceedSelectedColumnsOnly
();
for
(
DBDAttributeBinding
attribute
:
attributes
)
{
meta
.
add
(
attribute
.
getMetaAttribute
());
DBCAttributeMetaData
metaAttribute
=
attribute
.
getMetaAttribute
();
if
(!
selectedColumnsOnly
||
options
.
getSelectedColumns
().
contains
(
metaAttribute
.
getName
()))
{
meta
.
add
(
metaAttribute
);
}
}
return
meta
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetDataContainerOptions.java
0 → 100644
浏览文件 @
429bd48c
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* Copyright (C) 2010-2017 Eugene Fradkin (eugene.fradkin@gmail.com)
*
* 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.ui.controls.resultset
;
import
java.util.List
;
public
class
ResultSetDataContainerOptions
{
private
boolean
exportSelectedRows
;
private
List
<
Long
>
selectedRows
;
private
boolean
exportSelectedColumns
;
private
List
<
String
>
selectedColumns
;
public
boolean
isExportSelectedRows
()
{
return
exportSelectedRows
;
}
public
void
setExportSelectedRows
(
boolean
exportSelectedRows
)
{
this
.
exportSelectedRows
=
exportSelectedRows
;
}
public
List
<
Long
>
getSelectedRows
()
{
return
selectedRows
;
}
public
void
setSelectedRows
(
List
<
Long
>
selectedRows
)
{
this
.
selectedRows
=
selectedRows
;
}
public
boolean
isExportSelectedColumns
()
{
return
exportSelectedColumns
;
}
public
void
setExportSelectedColumns
(
boolean
exportSelectedColumns
)
{
this
.
exportSelectedColumns
=
exportSelectedColumns
;
}
public
List
<
String
>
getSelectedColumns
()
{
return
selectedColumns
;
}
public
void
setSelectedColumns
(
List
<
String
>
selectedColumns
)
{
this
.
selectedColumns
=
selectedColumns
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/plaintext/PlainTextPresentation.java
浏览文件 @
429bd48c
...
...
@@ -45,6 +45,8 @@ import org.jkiss.code.NotNull;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBConstants
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.data.DBDAttributeBinding
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
...
...
@@ -240,6 +242,7 @@ public class PlainTextPresentation extends AbstractPresentation implements IAdap
private
void
printGrid
(
boolean
append
)
{
DBPPreferenceStore
prefs
=
getController
().
getPreferenceStore
();
int
maxColumnSize
=
prefs
.
getInt
(
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
);
boolean
showNulls
=
prefs
.
getBoolean
(
DBeaverPreferences
.
RESULT_TEXT_SHOW_NULLS
);
boolean
delimLeading
=
prefs
.
getBoolean
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_LEADING
);
boolean
delimTrailing
=
prefs
.
getBoolean
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_TRAILING
);
DBDDisplayFormat
displayFormat
=
DBDDisplayFormat
.
safeValueOf
(
prefs
.
getString
(
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
));
...
...
@@ -311,6 +314,8 @@ public class PlainTextPresentation extends AbstractPresentation implements IAdap
String
displayString
=
getCellString
(
model
,
attr
,
row
,
displayFormat
);
if
(
displayString
.
length
()
>=
colWidths
[
k
]
-
1
)
{
displayString
=
CommonUtils
.
truncateString
(
displayString
,
colWidths
[
k
]
-
1
);
}
else
if
(
showNulls
&&
displayString
.
isEmpty
()
&&
DBUtils
.
isNullValue
(
model
.
getCellValue
(
attr
,
row
)))
{
displayString
=
DBConstants
.
NULL_VALUE_LABEL
;
}
grid
.
append
(
displayString
);
for
(
int
j
=
colWidths
[
k
]
-
displayString
.
length
();
j
>
0
;
j
--)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageDatabaseGeneral.java
浏览文件 @
429bd48c
...
...
@@ -33,13 +33,19 @@ import org.jkiss.code.Nullable;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.app.DBPPlatformLanguage
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.registry.language.PlatformLanguageDescriptor
;
import
org.jkiss.dbeaver.registry.language.PlatformLanguageRegistry
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.TextWithOpenFile
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.dbeaver.utils.SystemVariablesResolver
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.List
;
/**
* PrefPageDatabaseGeneral
...
...
@@ -49,6 +55,7 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
public
static
final
String
PAGE_ID
=
"org.jkiss.dbeaver.preferences.main.common"
;
//$NON-NLS-1$
private
Button
automaticUpdateCheck
;
private
Combo
workspaceLanguage
;
private
Button
longOperationsCheck
;
private
Spinner
longOperationsTimeout
;
...
...
@@ -76,9 +83,23 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
Composite
composite
=
UIUtils
.
createPlaceholder
(
parent
,
1
,
5
);
{
Group
groupObjects
=
UIUtils
.
createControlGroup
(
composite
,
CoreMessages
.
pref_page_ui_general_group_general
,
1
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
300
);
automaticUpdateCheck
=
UIUtils
.
createCheckbox
(
groupObjects
,
CoreMessages
.
pref_page_ui_general_checkbox_automatic_updates
,
false
);
automaticUpdateCheck
.
setLayoutData
(
new
GridData
(
GridData
.
BEGINNING
,
GridData
.
BEGINNING
,
true
,
false
,
2
,
1
));
Group
groupObjects
=
UIUtils
.
createControlGroup
(
composite
,
CoreMessages
.
pref_page_ui_general_group_general
,
2
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
300
);
automaticUpdateCheck
=
UIUtils
.
createCheckbox
(
groupObjects
,
CoreMessages
.
pref_page_ui_general_checkbox_automatic_updates
,
null
,
false
,
2
);
//automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
workspaceLanguage
=
UIUtils
.
createLabelCombo
(
groupObjects
,
"Language"
,
"Application language - used for UI localization"
,
SWT
.
READ_ONLY
|
SWT
.
DROP_DOWN
);
List
<
PlatformLanguageDescriptor
>
languages
=
PlatformLanguageRegistry
.
getInstance
().
getLanguages
();
DBPPlatformLanguage
pLanguage
=
DBeaverCore
.
getInstance
().
getLanguage
();
for
(
int
i
=
0
;
i
<
languages
.
size
();
i
++)
{
PlatformLanguageDescriptor
lang
=
languages
.
get
(
i
);
workspaceLanguage
.
add
(
lang
.
getLabel
());
if
(
CommonUtils
.
equalObjects
(
pLanguage
,
lang
))
{
workspaceLanguage
.
select
(
i
);
}
}
if
(
workspaceLanguage
.
getSelectionIndex
()
<
0
)
{
workspaceLanguage
.
select
(
0
);
}
}
// Agent settings
...
...
@@ -165,6 +186,10 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
@Override
public
boolean
performOk
()
{
if
(
workspaceLanguage
.
getSelectionIndex
()
>=
0
)
{
PlatformLanguageDescriptor
language
=
PlatformLanguageRegistry
.
getInstance
().
getLanguages
().
get
(
workspaceLanguage
.
getSelectionIndex
());
DBeaverCore
.
getInstance
().
setPlatformLanguage
(
language
);
}
DBPPreferenceStore
store
=
DBeaverCore
.
getGlobalPreferenceStore
();
store
.
setValue
(
DBeaverPreferences
.
UI_AUTO_UPDATE_CHECK
,
automaticUpdateCheck
.
getSelection
());
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageResultSetPresentation.java
浏览文件 @
429bd48c
...
...
@@ -54,6 +54,7 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
private
Spinner
textMaxColumnSize
;
private
ValueFormatSelector
textValueFormat
;
private
Button
showNulls
;
private
Button
textDelimiterLeading
;
private
Button
textDelimiterTrailing
;
...
...
@@ -80,6 +81,7 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
store
.
contains
(
DBeaverPreferences
.
RESULT_SET_ROW_BATCH_SIZE
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_TEXT_SHOW_NULLS
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_LEADING
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_TRAILING
)
;
...
...
@@ -125,6 +127,7 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
textMaxColumnSize
=
UIUtils
.
createLabelSpinner
(
uiGroup
,
CoreMessages
.
pref_page_database_resultsets_label_maximum_column_length
,
0
,
10
,
Integer
.
MAX_VALUE
);
textValueFormat
=
new
ValueFormatSelector
(
uiGroup
);
showNulls
=
UIUtils
.
createCheckbox
(
uiGroup
,
CoreMessages
.
pref_page_database_resultsets_label_text_show_nulls
,
null
,
false
,
2
);
textDelimiterLeading
=
UIUtils
.
createCheckbox
(
uiGroup
,
CoreMessages
.
pref_page_database_resultsets_label_text_delimiter_leading
,
null
,
false
,
2
);
textDelimiterTrailing
=
UIUtils
.
createCheckbox
(
uiGroup
,
CoreMessages
.
pref_page_database_resultsets_label_text_delimiter_trailing
,
null
,
false
,
2
);
}
...
...
@@ -152,6 +155,7 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
textMaxColumnSize
.
setSelection
(
store
.
getInt
(
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
));
textValueFormat
.
select
(
DBDDisplayFormat
.
safeValueOf
(
store
.
getString
(
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
)));
showNulls
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RESULT_TEXT_SHOW_NULLS
));
textDelimiterLeading
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_LEADING
));
textDelimiterTrailing
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_TRAILING
));
}
catch
(
Exception
e
)
{
...
...
@@ -176,6 +180,7 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
store
.
setValue
(
DBeaverPreferences
.
RESULT_SET_SHOW_CONNECTION_NAME
,
showConnectionName
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
,
textMaxColumnSize
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
,
textValueFormat
.
getSelection
().
name
());
store
.
setValue
(
DBeaverPreferences
.
RESULT_TEXT_SHOW_NULLS
,
showNulls
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_LEADING
,
textDelimiterLeading
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_TRAILING
,
textDelimiterLeading
.
getSelection
());
}
catch
(
Exception
e
)
{
...
...
@@ -201,6 +206,7 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_SET_SHOW_CONNECTION_NAME
);
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
);
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
);
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_TEXT_SHOW_NULLS
);
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_LEADING
);
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_TEXT_DELIMITER_TRAILING
);
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/app/DBPPlatform.java
浏览文件 @
429bd48c
...
...
@@ -31,6 +31,7 @@ import org.jkiss.dbeaver.model.sql.format.SQLFormatterRegistry;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Locale
;
/**
* DBPPlatform
...
...
@@ -40,6 +41,9 @@ public interface DBPPlatform
@NotNull
DBPApplication
getApplication
();
@NotNull
DBPPlatformLanguage
getLanguage
();
@NotNull
DBNModel
getNavigatorModel
();
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/app/DBPPlatformLanguage.java
0 → 100644
浏览文件 @
429bd48c
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 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.model.app
;
/**
* DBPPlatformLanguage
*/
public
interface
DBPPlatformLanguage
{
String
getCode
();
String
getLabel
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录