Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d1554582
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,发现更多精彩内容 >>
提交
d1554582
编写于
6月 13, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3618 Data transfer - finish messagebox config
Former-commit-id:
d3f7b1de
上级
e07dbc0f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
59 deletion
+67
-59
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerPageLoadSettings.java
...s/transfer/database/DatabaseConsumerPageLoadSettings.java
+7
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/stream/StreamConsumerPageOutput.java
...eaver/tools/transfer/stream/StreamConsumerPageOutput.java
+10
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferJob.java
.../jkiss/dbeaver/tools/transfer/wizard/DataTransferJob.java
+10
-10
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferSettings.java
...s/dbeaver/tools/transfer/wizard/DataTransferSettings.java
+40
-49
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerPageLoadSettings.java
浏览文件 @
d1554582
...
...
@@ -108,6 +108,13 @@ public class DatabaseConsumerPageLoadSettings extends ActiveWizardPage<DataTrans
settings
.
setOpenTableOnFinish
(
showTableCheckbox
.
getSelection
());
}
});
final
Button
showFinalMessageCheckbox
=
UIUtils
.
createCheckbox
(
generalSettings
,
"Show finish message"
,
null
,
getWizard
().
getSettings
().
isShowFinalMessage
(),
4
);
showFinalMessageCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
getWizard
().
getSettings
().
setShowFinalMessage
(
showFinalMessageCheckbox
.
getSelection
());
}
});
}
setControl
(
composite
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/stream/StreamConsumerPageOutput.java
浏览文件 @
d1554582
...
...
@@ -44,6 +44,7 @@ public class StreamConsumerPageOutput extends ActiveWizardPage<DataTransferWizar
private
Button
execProcessCheckbox
;
private
Text
execProcessText
;
private
Button
clipboardCheck
;
private
Button
showFinalMessageCheckbox
;
public
StreamConsumerPageOutput
()
{
super
(
CoreMessages
.
data_transfer_wizard_output_name
);
...
...
@@ -190,6 +191,14 @@ public class StreamConsumerPageOutput extends ActiveWizardPage<DataTransferWizar
GeneralUtils
.
variablePattern
(
StreamTransferConsumer
.
VARIABLE_PROJECT
),
GeneralUtils
.
variablePattern
(
StreamTransferConsumer
.
VARIABLE_FILE
)
}));
showFinalMessageCheckbox
=
UIUtils
.
createCheckbox
(
resultsSettings
,
"Show finish message"
,
null
,
getWizard
().
getSettings
().
isShowFinalMessage
(),
4
);
showFinalMessageCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
getWizard
().
getSettings
().
setShowFinalMessage
(
showFinalMessageCheckbox
.
getSelection
());
}
});
}
setControl
(
composite
);
...
...
@@ -239,6 +248,7 @@ public class StreamConsumerPageOutput extends ActiveWizardPage<DataTransferWizar
clipboardCheck
.
setSelection
(
false
);
encodingBOMCheckbox
.
setSelection
(
false
);
}
showFinalMessageCheckbox
.
setSelection
(
getWizard
().
getSettings
().
isShowFinalMessage
());
updatePageCompletion
();
toggleClipboardOutput
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferJob.java
浏览文件 @
d1554582
...
...
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.Status;
import
org.eclipse.osgi.util.NLS
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
...
...
@@ -76,16 +77,15 @@ public class DataTransferJob extends AbstractJob {
private
void
showResult
(
final
long
time
,
final
boolean
hasErrors
)
{
// Run async to avoid blocking progress monitor dialog
UIUtils
.
asyncExec
(
new
Runnable
()
{
@Override
public
void
run
()
{
// Make a sound
Display
.
getCurrent
().
beep
();
// Notify agent
if
(
time
>
DBeaverCore
.
getGlobalPreferenceStore
().
getLong
(
DBeaverPreferences
.
AGENT_LONG_OPERATION_TIMEOUT
)
*
1000
)
{
DBeaverUI
.
notifyAgent
(
"Data transfer completed"
,
!
hasErrors
?
IStatus
.
INFO
:
IStatus
.
ERROR
);
}
UIUtils
.
asyncExec
(()
->
{
// Make a sound
Display
.
getCurrent
().
beep
();
// Notify agent
if
(
time
>
DBeaverCore
.
getGlobalPreferenceStore
().
getLong
(
DBeaverPreferences
.
AGENT_LONG_OPERATION_TIMEOUT
)
*
1000
)
{
DBeaverUI
.
notifyAgent
(
"Data transfer completed"
,
!
hasErrors
?
IStatus
.
INFO
:
IStatus
.
ERROR
);
}
if
(
settings
.
isShowFinalMessage
())
{
// Show message box
UIUtils
.
showMessageBox
(
null
,
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferSettings.java
浏览文件 @
d1554582
...
...
@@ -52,8 +52,7 @@ public class DataTransferSettings {
IDataTransferSettings
settings
;
IWizardPage
[]
pages
;
private
NodeSettings
(
DataTransferNodeDescriptor
sourceNode
)
throws
DBException
{
private
NodeSettings
(
DataTransferNodeDescriptor
sourceNode
)
throws
DBException
{
this
.
sourceNode
=
sourceNode
;
this
.
settings
=
sourceNode
.
createSettings
();
this
.
pages
=
sourceNode
.
createWizardPages
();
...
...
@@ -67,7 +66,7 @@ public class DataTransferSettings {
private
DataTransferNodeDescriptor
consumer
;
private
DataTransferProcessorDescriptor
processor
;
private
Map
<
DataTransferProcessorDescriptor
,
Map
<
Object
,
Object
>>
processorPropsHistory
=
new
HashMap
<>();
private
Map
<
DataTransferProcessorDescriptor
,
Map
<
Object
,
Object
>>
processorPropsHistory
=
new
HashMap
<>();
private
Map
<
Class
,
NodeSettings
>
nodeSettings
=
new
LinkedHashMap
<>();
...
...
@@ -76,8 +75,9 @@ public class DataTransferSettings {
private
transient
int
curPipeNum
=
0
;
public
DataTransferSettings
(
@Nullable
IDataTransferProducer
[]
producers
,
@Nullable
IDataTransferConsumer
[]
consumers
)
{
private
boolean
showFinalMessage
=
true
;
public
DataTransferSettings
(
@Nullable
IDataTransferProducer
[]
producers
,
@Nullable
IDataTransferConsumer
[]
consumers
)
{
dataPipes
=
new
ArrayList
<>();
if
(!
ArrayUtils
.
isEmpty
(
producers
)
&&
!
ArrayUtils
.
isEmpty
(
consumers
))
{
if
(
producers
.
length
!=
consumers
.
length
)
{
...
...
@@ -149,8 +149,7 @@ public class DataTransferSettings {
}
}
private
void
addNodeSettings
(
DataTransferNodeDescriptor
node
)
{
private
void
addNodeSettings
(
DataTransferNodeDescriptor
node
)
{
if
(
node
==
null
)
{
return
;
}
...
...
@@ -165,8 +164,7 @@ public class DataTransferSettings {
}
}
void
addWizardPages
(
DataTransferWizard
wizard
)
{
void
addWizardPages
(
DataTransferWizard
wizard
)
{
for
(
NodeSettings
nodeSettings
:
this
.
nodeSettings
.
values
())
{
if
(
nodeSettings
.
pages
!=
null
)
{
for
(
IWizardPage
page
:
nodeSettings
.
pages
)
{
...
...
@@ -176,24 +174,20 @@ public class DataTransferSettings {
}
}
public
boolean
isConsumerOptional
()
{
public
boolean
isConsumerOptional
()
{
return
consumerOptional
;
}
public
boolean
isPageValid
(
IWizardPage
page
)
{
public
boolean
isPageValid
(
IWizardPage
page
)
{
return
isPageValid
(
page
,
producer
)
||
isPageValid
(
page
,
consumer
);
}
private
boolean
isPageValid
(
IWizardPage
page
,
DataTransferNodeDescriptor
node
)
{
private
boolean
isPageValid
(
IWizardPage
page
,
DataTransferNodeDescriptor
node
)
{
NodeSettings
nodeSettings
=
node
==
null
?
null
:
this
.
nodeSettings
.
get
(
node
.
getNodeClass
());
return
nodeSettings
!=
null
&&
ArrayUtils
.
contains
(
nodeSettings
.
pages
,
page
);
}
public
Collection
<
DBSObject
>
getSourceObjects
()
{
public
Collection
<
DBSObject
>
getSourceObjects
()
{
List
<
DataTransferPipe
>
dataPipes
=
getDataPipes
();
Set
<
DBSObject
>
objects
=
new
HashSet
<>();
for
(
DataTransferPipe
transferPipe
:
dataPipes
)
{
...
...
@@ -204,8 +198,7 @@ public class DataTransferSettings {
return
objects
;
}
public
IDataTransferSettings
getNodeSettings
(
IWizardPage
page
)
{
public
IDataTransferSettings
getNodeSettings
(
IWizardPage
page
)
{
for
(
NodeSettings
nodeSettings
:
this
.
nodeSettings
.
values
())
{
if
(
nodeSettings
.
pages
!=
null
)
{
for
(
IWizardPage
nodePage
:
nodeSettings
.
pages
)
{
...
...
@@ -218,22 +211,19 @@ public class DataTransferSettings {
return
null
;
}
public
IDataTransferSettings
getNodeSettings
(
IDataTransferNode
node
)
{
public
IDataTransferSettings
getNodeSettings
(
IDataTransferNode
node
)
{
NodeSettings
nodeSettings
=
this
.
nodeSettings
.
get
(
node
.
getClass
());
return
nodeSettings
==
null
?
null
:
nodeSettings
.
settings
;
}
public
Map
<
Object
,
Object
>
getProcessorProperties
()
{
public
Map
<
Object
,
Object
>
getProcessorProperties
()
{
if
(
processor
==
null
)
{
throw
new
IllegalStateException
(
"No processor selected"
);
}
return
processorPropsHistory
.
get
(
processor
);
}
public
void
setProcessorProperties
(
Map
<
Object
,
Object
>
properties
)
{
public
void
setProcessorProperties
(
Map
<
Object
,
Object
>
properties
)
{
if
(
processor
==
null
)
{
throw
new
IllegalStateException
(
"No processor selected"
);
}
...
...
@@ -241,13 +231,11 @@ public class DataTransferSettings {
}
public
List
<
DataTransferPipe
>
getDataPipes
()
{
public
List
<
DataTransferPipe
>
getDataPipes
()
{
return
dataPipes
;
}
public
synchronized
DataTransferPipe
acquireDataPipe
(
DBRProgressMonitor
monitor
)
{
public
synchronized
DataTransferPipe
acquireDataPipe
(
DBRProgressMonitor
monitor
)
{
if
(
curPipeNum
>=
dataPipes
.
size
())
{
// End of transfer
// Signal last pipe about it
...
...
@@ -263,28 +251,23 @@ public class DataTransferSettings {
return
result
;
}
public
DataTransferNodeDescriptor
getProducer
()
{
public
DataTransferNodeDescriptor
getProducer
()
{
return
producer
;
}
public
DataTransferNodeDescriptor
getConsumer
()
{
public
DataTransferNodeDescriptor
getConsumer
()
{
return
consumer
;
}
public
DataTransferProcessorDescriptor
getProcessor
()
{
public
DataTransferProcessorDescriptor
getProcessor
()
{
return
processor
;
}
private
void
selectProducer
(
DataTransferNodeDescriptor
producer
)
{
private
void
selectProducer
(
DataTransferNodeDescriptor
producer
)
{
this
.
producer
=
producer
;
}
void
selectConsumer
(
DataTransferNodeDescriptor
consumer
,
DataTransferProcessorDescriptor
processor
)
{
void
selectConsumer
(
DataTransferNodeDescriptor
consumer
,
DataTransferProcessorDescriptor
processor
)
{
this
.
consumer
=
consumer
;
this
.
processor
=
processor
;
if
(
consumer
!=
null
&&
processor
!=
null
)
{
...
...
@@ -307,25 +290,33 @@ public class DataTransferSettings {
}
}
public
int
getMaxJobCount
()
{
public
int
getMaxJobCount
()
{
return
maxJobCount
;
}
public
void
setMaxJobCount
(
int
maxJobCount
)
{
public
void
setMaxJobCount
(
int
maxJobCount
)
{
if
(
maxJobCount
>
0
)
{
this
.
maxJobCount
=
maxJobCount
;
}
}
void
loadFrom
(
IRunnableContext
runnableContext
,
IDialogSettings
dialogSettings
)
{
public
boolean
isShowFinalMessage
()
{
return
showFinalMessage
;
}
public
void
setShowFinalMessage
(
boolean
showFinalMessage
)
{
this
.
showFinalMessage
=
showFinalMessage
;
}
void
loadFrom
(
IRunnableContext
runnableContext
,
IDialogSettings
dialogSettings
)
{
try
{
maxJobCount
=
dialogSettings
.
getInt
(
"maxJobCount"
);
}
catch
(
NumberFormatException
e
)
{
maxJobCount
=
DEFAULT_THREADS_NUM
;
}
if
(
dialogSettings
.
get
(
"showFinalMessage"
)
!=
null
)
{
showFinalMessage
=
dialogSettings
.
getBoolean
(
"showFinalMessage"
);
}
String
producerId
=
dialogSettings
.
get
(
"producer"
);
if
(!
CommonUtils
.
isEmpty
(
producerId
))
{
DataTransferNodeDescriptor
producerNode
=
DataTransferRegistry
.
getInstance
().
getNodeById
(
producerId
);
...
...
@@ -387,9 +378,9 @@ public class DataTransferSettings {
}
void
saveTo
(
IDialogSettings
dialogSettings
)
{
void
saveTo
(
IDialogSettings
dialogSettings
)
{
dialogSettings
.
put
(
"maxJobCount"
,
maxJobCount
);
dialogSettings
.
put
(
"showFinalMessage"
,
showFinalMessage
);
// Save nodes' settings
for
(
Map
.
Entry
<
Class
,
NodeSettings
>
entry
:
nodeSettings
.
entrySet
())
{
IDialogSettings
nodeSection
=
DialogSettings
.
getOrCreateSection
(
dialogSettings
,
entry
.
getKey
().
getSimpleName
());
...
...
@@ -414,11 +405,11 @@ public class DataTransferSettings {
Map
<
Object
,
Object
>
props
=
processorPropsHistory
.
get
(
procDescriptor
);
if
(
props
!=
null
)
{
StringBuilder
propNames
=
new
StringBuilder
();
for
(
Map
.
Entry
<
Object
,
Object
>
prop
:
props
.
entrySet
())
{
for
(
Map
.
Entry
<
Object
,
Object
>
prop
:
props
.
entrySet
())
{
propNames
.
append
(
prop
.
getKey
()).
append
(
','
);
}
procSettings
.
put
(
"@propNames"
,
propNames
.
toString
());
for
(
Map
.
Entry
<
Object
,
Object
>
prop
:
props
.
entrySet
())
{
for
(
Map
.
Entry
<
Object
,
Object
>
prop
:
props
.
entrySet
())
{
procSettings
.
put
(
CommonUtils
.
toString
(
prop
.
getKey
()),
CommonUtils
.
toString
(
prop
.
getValue
()));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录