Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
fa62338c
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,发现更多精彩内容 >>
提交
fa62338c
编写于
2月 13, 2018
作者:
E
Evgeny Fradkin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1599 Mock Data. Persist the selected generators for the attributes.
上级
1ca9e17a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
9 deletion
+33
-9
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataExecuteWizard.java
...org/jkiss/dbeaver/ext/mockdata/MockDataExecuteWizard.java
+1
-2
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataSettings.java
.../src/org/jkiss/dbeaver/ext/mockdata/MockDataSettings.java
+28
-5
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataWizardPageSettings.java
...kiss/dbeaver/ext/mockdata/MockDataWizardPageSettings.java
+4
-2
未找到文件。
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataExecuteWizard.java
浏览文件 @
fa62338c
...
...
@@ -65,12 +65,11 @@ public class MockDataExecuteWizard extends AbstractToolWizard<DBSDataManipulato
setWindowTitle
(
task
);
setNeedsProgressMonitor
(
true
);
loadSettings
();
settingsPage
=
new
MockDataWizardPageSettings
(
mockDataSettings
);
}
private
void
loadSettings
()
{
void
loadSettings
()
{
IDialogSettings
section
=
UIUtils
.
getDialogSettings
(
RS_EXPORT_WIZARD_DIALOG_SETTINGS
);
setDialogSettings
(
section
);
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataSettings.java
浏览文件 @
fa62338c
...
...
@@ -29,6 +29,7 @@ import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.runtime.properties.PropertySourceCustom
;
import
org.jkiss.dbeaver.runtime.ui.DBUserInterface
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.lang.reflect.InvocationTargetException
;
...
...
@@ -38,18 +39,22 @@ public class MockDataSettings {
public
static
final
String
FK_GENERATOR_ID
=
"fkGenerator"
;
//$NON-NLS-1$
private
DBSEntity
dbsEntity
;
private
Collection
<
DBSAttributeBase
>
attributes
;
private
boolean
removeOldData
;
private
long
rowsNumber
=
1000
;
private
Map
<
String
,
MockGeneratorDescriptor
>
generatorDescriptors
=
new
HashMap
<>();
// generatorId -> MockGeneratorDescriptor
private
Map
<
String
,
AttributeGeneratorProperties
>
attributeGenerators
=
new
HashMap
<>();
// attribute.name -> generators properties
// populate attribute generators properties map
public
Collection
<?
extends
DBSAttributeBase
>
init
(
MockDataExecuteWizard
wizard
)
throws
DBException
{
public
void
init
(
MockDataExecuteWizard
wizard
)
throws
DBException
{
List
<
DBSDataManipulator
>
databaseObjects
=
wizard
.
getDatabaseObjects
();
DBSDataManipulator
dataManipulator
=
databaseObjects
.
iterator
().
next
();
// TODO only the first
DBSEntity
dbsEntity
=
(
DBSEntity
)
dataManipulator
;
dbsEntity
=
(
DBSEntity
)
dataManipulator
;
attributes
=
new
ArrayList
<>();
final
Collection
<
DBSAttributeBase
>
attributes
=
new
ArrayList
<>();
try
{
DBeaverUI
.
run
(
wizard
.
getContainer
(),
true
,
true
,
new
DBRRunnableWithProgress
()
{
@Override
...
...
@@ -81,11 +86,12 @@ public class MockDataSettings {
});
}
catch
(
InvocationTargetException
e
)
{
DBUserInterface
.
getInstance
().
showError
(
"Transfer init failed"
,
"Can't start data transfer"
,
e
.
getTargetException
());
return
null
;
}
catch
(
InterruptedException
e
)
{
return
null
;
e
.
printStackTrace
()
;
}
}
public
Collection
<
DBSAttributeBase
>
getAttributes
()
{
return
attributes
;
}
...
...
@@ -140,11 +146,28 @@ public class MockDataSettings {
}
catch
(
NumberFormatException
e
)
{
// do nothing
}
// load selected generators
IDialogSettings
tableSection
=
UIUtils
.
getSettingsSection
(
dialogSettings
,
dbsEntity
.
getName
());
for
(
Map
.
Entry
<
String
,
AttributeGeneratorProperties
>
entry
:
attributeGenerators
.
entrySet
())
{
String
attributeName
=
entry
.
getKey
();
String
selectedGenerator
=
tableSection
.
get
(
attributeName
);
if
(
selectedGenerator
!=
null
)
{
entry
.
getValue
().
setSelectedGeneratorId
(
selectedGenerator
);
}
}
}
void
saveTo
(
IDialogSettings
dialogSettings
)
{
dialogSettings
.
put
(
"removeOldData"
,
removeOldData
);
dialogSettings
.
put
(
"rowsNumber"
,
rowsNumber
);
// save selected generators
IDialogSettings
tableSection
=
UIUtils
.
getSettingsSection
(
dialogSettings
,
dbsEntity
.
getName
());
for
(
Map
.
Entry
<
String
,
AttributeGeneratorProperties
>
entry
:
attributeGenerators
.
entrySet
())
{
tableSection
.
put
(
entry
.
getKey
(),
entry
.
getValue
().
getSelectedGeneratorId
());
}
}
public
static
class
AttributeGeneratorProperties
{
...
...
plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/MockDataWizardPageSettings.java
浏览文件 @
fa62338c
...
...
@@ -282,8 +282,10 @@ public class MockDataWizardPageSettings extends ActiveWizardPage<MockDataExecute
// init the generators properties
if
(
firstInit
)
{
firstInit
=
false
;
Collection
<?
extends
DBSAttributeBase
>
attributes
=
this
.
mockDataSettings
.
init
(
getWizard
());
columnsTableViewer
.
setInput
(
attributes
);
MockDataExecuteWizard
wizard
=
getWizard
();
mockDataSettings
.
init
(
wizard
);
wizard
.
loadSettings
();
columnsTableViewer
.
setInput
(
mockDataSettings
.
getAttributes
());
}
// select the first item
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录