Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
4bf6e290
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,发现更多精彩内容 >>
提交
4bf6e290
编写于
4月 19, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3336 Data transfer fix (check for object adaptions). RSV data container refactoring.
Former-commit-id:
0c85da93
上级
08f329da
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
60 addition
and
23 deletion
+60
-23
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/transfer/DataTransferNodeDescriptor.java
...dbeaver/registry/transfer/DataTransferNodeDescriptor.java
+16
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/transfer/DataTransferProcessorDescriptor.java
...er/registry/transfer/DataTransferProcessorDescriptor.java
+14
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/transfer/DataTransferRegistry.java
...jkiss/dbeaver/registry/transfer/DataTransferRegistry.java
+8
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferPagePipes.java
.../dbeaver/tools/transfer/wizard/DataTransferPagePipes.java
+4
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferSettings.java
...s/dbeaver/tools/transfer/wizard/DataTransferSettings.java
+6
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetDataContainer.java
...dbeaver/ui/controls/resultset/ResultSetDataContainer.java
+10
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/handlers/NavigateObjectHandler.java
...beaver/ui/editors/sql/handlers/NavigateObjectHandler.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/AbstractDescriptor.java
.../src/org/jkiss/dbeaver/model/impl/AbstractDescriptor.java
+1
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/transfer/DataTransferNodeDescriptor.java
浏览文件 @
4bf6e290
...
...
@@ -17,6 +17,7 @@
package
org.jkiss.dbeaver.registry.transfer
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.jface.wizard.IWizardPage
;
import
org.jkiss.code.NotNull
;
...
...
@@ -25,6 +26,7 @@ import org.jkiss.dbeaver.Log;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.impl.AbstractDescriptor
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferNode
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferSettings
;
...
...
@@ -170,18 +172,26 @@ public class DataTransferNodeDescriptor extends AbstractDescriptor
/**
* Returns data exporter which supports ALL specified object types
* @param
objectType
s object types
* @param
surceObject
s object types
* @return list of editors
*/
public
Collection
<
DataTransferProcessorDescriptor
>
getAvailableProcessors
(
Collection
<
Class
<?>>
objectType
s
)
public
Collection
<
DataTransferProcessorDescriptor
>
getAvailableProcessors
(
Collection
<
DBSObject
>
surceObject
s
)
{
List
<
DataTransferProcessorDescriptor
>
editors
=
new
ArrayList
<>();
for
(
DataTransferProcessorDescriptor
descriptor
:
processors
)
{
boolean
supports
=
true
;
for
(
Class
objectType
:
objectTypes
)
{
if
(!
descriptor
.
appliesToType
(
objectType
))
{
supports
=
false
;
break
;
for
(
DBSObject
sourceObject
:
surceObjects
)
{
if
(!
descriptor
.
appliesToType
(
sourceObject
.
getClass
()))
{
boolean
adapts
=
false
;
if
(
sourceObject
instanceof
IAdaptable
)
{
if
(
descriptor
.
adaptsToType
((
IAdaptable
)
sourceObject
))
{
adapts
=
true
;
}
}
if
(!
adapts
)
{
supports
=
false
;
break
;
}
}
}
if
(
supports
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/transfer/DataTransferProcessorDescriptor.java
浏览文件 @
4bf6e290
...
...
@@ -17,6 +17,7 @@
package
org.jkiss.dbeaver.registry.transfer
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.DBIcon
;
...
...
@@ -107,6 +108,18 @@ public class DataTransferProcessorDescriptor extends AbstractDescriptor implemen
return
false
;
}
public
boolean
adaptsToType
(
IAdaptable
adaptable
)
{
if
(
sourceTypes
.
isEmpty
())
{
return
true
;
}
for
(
ObjectType
sourceType
:
sourceTypes
)
{
if
(
adaptable
.
getAdapter
(
sourceType
.
getObjectClass
())
!=
null
)
{
return
true
;
}
}
return
false
;
}
public
IDataTransferProcessor
getInstance
()
{
try
{
...
...
@@ -126,4 +139,5 @@ public class DataTransferProcessorDescriptor extends AbstractDescriptor implemen
public
boolean
isBinaryFormat
()
{
return
isBinary
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/transfer/DataTransferRegistry.java
浏览文件 @
4bf6e290
...
...
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import
org.eclipse.core.runtime.IExtensionRegistry
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferNode
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -82,23 +83,23 @@ public class DataTransferRegistry {
nodes
.
sort
(
Comparator
.
comparing
(
DataTransferNodeDescriptor:
:
getName
));
}
public
List
<
DataTransferNodeDescriptor
>
getAvailableProducers
(
Collection
<
Class
<?>>
objectType
s
)
public
List
<
DataTransferNodeDescriptor
>
getAvailableProducers
(
Collection
<
DBSObject
>
sourceObject
s
)
{
return
getAvailableNodes
(
DataTransferNodeDescriptor
.
NodeType
.
PRODUCER
,
objectType
s
);
return
getAvailableNodes
(
DataTransferNodeDescriptor
.
NodeType
.
PRODUCER
,
sourceObject
s
);
}
public
List
<
DataTransferNodeDescriptor
>
getAvailableConsumers
(
Collection
<
Class
<?>>
objectType
s
)
public
List
<
DataTransferNodeDescriptor
>
getAvailableConsumers
(
Collection
<
DBSObject
>
sourceObject
s
)
{
return
getAvailableNodes
(
DataTransferNodeDescriptor
.
NodeType
.
CONSUMER
,
objectType
s
);
return
getAvailableNodes
(
DataTransferNodeDescriptor
.
NodeType
.
CONSUMER
,
sourceObject
s
);
}
List
<
DataTransferNodeDescriptor
>
getAvailableNodes
(
DataTransferNodeDescriptor
.
NodeType
nodeType
,
Collection
<
Class
<?>>
objectType
s
)
List
<
DataTransferNodeDescriptor
>
getAvailableNodes
(
DataTransferNodeDescriptor
.
NodeType
nodeType
,
Collection
<
DBSObject
>
sourceObject
s
)
{
List
<
DataTransferNodeDescriptor
>
result
=
new
ArrayList
<>();
for
(
DataTransferNodeDescriptor
node
:
nodes
)
{
if
(
node
.
getNodeType
()
==
nodeType
)
{
for
(
Class
objectType
:
objectType
s
)
{
if
(
node
.
appliesToType
(
objectType
))
{
for
(
DBSObject
sourceObject
:
sourceObject
s
)
{
if
(
node
.
appliesToType
(
sourceObject
.
getClass
()
))
{
result
.
add
(
node
);
break
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferPagePipes.java
浏览文件 @
4bf6e290
...
...
@@ -26,6 +26,7 @@ import org.eclipse.swt.layout.GridData;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Composite
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.registry.transfer.DataTransferNodeDescriptor
;
import
org.jkiss.dbeaver.registry.transfer.DataTransferProcessorDescriptor
;
import
org.jkiss.dbeaver.registry.transfer.DataTransferRegistry
;
...
...
@@ -180,11 +181,11 @@ class DataTransferPagePipes extends ActiveWizardPage<DataTransferWizard> {
private
void
loadConsumers
()
{
DataTransferSettings
settings
=
getWizard
().
getSettings
();
Collection
<
Class
<?>>
objectTypes
=
settings
.
getObjectType
s
();
Collection
<
DBSObject
>
objects
=
settings
.
getSourceObject
s
();
List
<
TransferTarget
>
transferTargets
=
new
ArrayList
<>();
for
(
DataTransferNodeDescriptor
consumer
:
DataTransferRegistry
.
getInstance
().
getAvailableConsumers
(
object
Type
s
))
{
Collection
<
DataTransferProcessorDescriptor
>
processors
=
consumer
.
getAvailableProcessors
(
object
Type
s
);
for
(
DataTransferNodeDescriptor
consumer
:
DataTransferRegistry
.
getInstance
().
getAvailableConsumers
(
objects
))
{
Collection
<
DataTransferProcessorDescriptor
>
processors
=
consumer
.
getAvailableProcessors
(
objects
);
if
(
CommonUtils
.
isEmpty
(
processors
))
{
transferTargets
.
add
(
new
TransferTarget
(
consumer
,
null
));
}
else
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferSettings.java
浏览文件 @
4bf6e290
...
...
@@ -24,6 +24,7 @@ import org.jkiss.code.Nullable;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.registry.transfer.DataTransferNodeDescriptor
;
import
org.jkiss.dbeaver.registry.transfer.DataTransferProcessorDescriptor
;
import
org.jkiss.dbeaver.registry.transfer.DataTransferRegistry
;
...
...
@@ -119,7 +120,7 @@ public class DataTransferSettings {
throw
new
IllegalArgumentException
(
"Producers or consumers must be specified"
);
}
Collection
<
Class
<?>>
objectTypes
=
getObjectType
s
();
Collection
<
DBSObject
>
objectTypes
=
getSourceObject
s
();
List
<
DataTransferNodeDescriptor
>
nodes
=
new
ArrayList
<>();
DataTransferRegistry
registry
=
DataTransferRegistry
.
getInstance
();
if
(
ArrayUtils
.
isEmpty
(
producers
))
{
...
...
@@ -191,16 +192,16 @@ public class DataTransferSettings {
return
nodeSettings
!=
null
&&
ArrayUtils
.
contains
(
nodeSettings
.
pages
,
page
);
}
public
Collection
<
Class
<?>>
getObjectType
s
()
public
Collection
<
DBSObject
>
getSourceObject
s
()
{
List
<
DataTransferPipe
>
dataPipes
=
getDataPipes
();
Set
<
Class
<?>>
objectType
s
=
new
HashSet
<>();
Set
<
DBSObject
>
object
s
=
new
HashSet
<>();
for
(
DataTransferPipe
transferPipe
:
dataPipes
)
{
if
(
transferPipe
.
getProducer
()
!=
null
)
{
object
Types
.
add
(
transferPipe
.
getProducer
().
getSourceObject
().
getClass
());
object
s
.
add
(
transferPipe
.
getProducer
().
getSourceObject
());
}
}
return
object
Type
s
;
return
objects
;
}
public
IDataTransferSettings
getNodeSettings
(
IWizardPage
page
)
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetDataContainer.java
浏览文件 @
4bf6e290
...
...
@@ -16,6 +16,7 @@
*/
package
org.jkiss.dbeaver.ui.controls.resultset
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBUtils
;
...
...
@@ -35,7 +36,7 @@ import java.util.List;
* Client-side data container.
* Wraps RSV model and original data container.
*/
public
class
ResultSetDataContainer
implements
DBSDataContainer
{
public
class
ResultSetDataContainer
implements
DBSDataContainer
,
IAdaptable
{
private
static
final
Log
log
=
Log
.
getLog
(
ResultSetDataContainer
.
class
);
...
...
@@ -138,6 +139,14 @@ public class ResultSetDataContainer implements DBSDataContainer {
return
dataContainer
.
isPersisted
();
}
@Override
public
<
T
>
T
getAdapter
(
Class
<
T
>
adapter
)
{
if
(
adapter
.
isInstance
(
dataContainer
))
{
return
adapter
.
cast
(
dataContainer
);
}
return
null
;
}
private
class
ModelResultSet
implements
DBCResultSet
{
private
final
DBCSession
session
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/handlers/NavigateObjectHandler.java
浏览文件 @
4bf6e290
...
...
@@ -73,7 +73,7 @@ public class NavigateObjectHandler extends AbstractHandler {
}
String
lastKeyword
=
hyperlinkDetector
.
getLastKeyword
();
if
(!
CommonUtils
.
isEmpty
(
lastKeyword
))
{
IEditorStatusLine
statusLine
=
(
IEditorStatusLine
)
editor
.
getAdapter
(
IEditorStatusLine
.
class
);
IEditorStatusLine
statusLine
=
editor
.
getAdapter
(
IEditorStatusLine
.
class
);
if
(
statusLine
!=
null
)
{
statusLine
.
setMessage
(
true
,
"Can't find metadata object for name '"
+
lastKeyword
+
"'"
,
(
Image
)
null
);
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/AbstractDescriptor.java
浏览文件 @
4bf6e290
...
...
@@ -20,6 +20,7 @@ import org.apache.commons.jexl2.Expression;
import
org.apache.commons.jexl2.JexlContext
;
import
org.apache.commons.jexl2.JexlEngine
;
import
org.apache.commons.jexl2.JexlException
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.code.NotNull
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录