Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
7b95dc16
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
7b95dc16
编写于
5月 04, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Complex editor - support raw types
上级
4abc5d16
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
59 addition
and
12 deletion
+59
-12
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/dialogs/ComplexObjectEditor.java
...rg/jkiss/dbeaver/ui/data/dialogs/ComplexObjectEditor.java
+58
-11
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/editors/ComplexValueInlineEditor.java
...iss/dbeaver/ui/data/editors/ComplexValueInlineEditor.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/dialogs/ComplexObjectEditor.java
浏览文件 @
7b95dc16
...
...
@@ -64,6 +64,7 @@ import org.jkiss.utils.ArrayUtils;
import
org.jkiss.utils.CommonUtils
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Collection
;
import
java.util.IdentityHashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
...
...
@@ -80,6 +81,10 @@ public class ComplexObjectEditor extends TreeViewer {
Object
value
;
}
private
interface
ComplexElementWrapper
{
Object
getValue
();
}
private
static
class
CompositeField
extends
ComplexElement
{
final
DBSAttributeBase
attribute
;
DBDValueHandler
valueHandler
;
...
...
@@ -92,16 +97,6 @@ public class ComplexObjectEditor extends TreeViewer {
}
}
private
static
class
MapEntry
extends
ComplexElement
{
String
name
;
Object
value
;
public
MapEntry
(
String
name
,
Object
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
}
private
static
class
ArrayInfo
{
private
DBDValueHandler
valueHandler
;
private
DBSDataType
componentType
;
...
...
@@ -119,6 +114,36 @@ public class ComplexObjectEditor extends TreeViewer {
}
}
private
static
class
MapEntry
extends
ComplexElement
implements
ComplexElementWrapper
{
String
name
;
Object
value
;
public
MapEntry
(
String
name
,
Object
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
@Override
public
Object
getValue
()
{
return
value
;
}
}
private
static
class
CollItem
extends
ComplexElement
implements
ComplexElementWrapper
{
int
index
;
Object
value
;
public
CollItem
(
int
index
,
Object
value
)
{
this
.
index
=
index
;
this
.
value
=
value
;
}
@Override
public
Object
getValue
()
{
return
value
;
}
}
private
final
IValueController
parentController
;
private
final
IValueEditor
editor
;
private
DBCExecutionContext
executionContext
;
...
...
@@ -370,6 +395,8 @@ public class ComplexObjectEditor extends TreeViewer {
return
getValueText
(
item
.
array
.
valueHandler
,
item
.
array
.
componentType
,
item
.
value
,
format
);
}
else
if
(
obj
instanceof
MapEntry
)
{
return
columnIndex
==
0
?
((
MapEntry
)
obj
).
name
:
CommonUtils
.
toString
(((
MapEntry
)
obj
).
value
);
}
else
if
(
obj
instanceof
CollItem
)
{
return
columnIndex
==
0
?
String
.
valueOf
(((
CollItem
)
obj
).
index
)
:
CommonUtils
.
toString
(((
CollItem
)
obj
).
value
);
}
return
String
.
valueOf
(
columnIndex
);
}
...
...
@@ -479,6 +506,9 @@ public class ComplexObjectEditor extends TreeViewer {
@Override
public
IValueManager
getValueManager
()
{
DBSTypedObject
valueType
=
getValueType
();
if
(
valueType
==
null
)
{
return
null
;
}
return
ValueManagerRegistry
.
findValueManager
(
getExecutionContext
().
getDataSource
(),
valueType
,
...
...
@@ -568,6 +598,11 @@ public class ComplexObjectEditor extends TreeViewer {
return
children
;
}
// Unwrap complex items
if
(
parent
instanceof
ComplexElementWrapper
)
{
parent
=
((
ComplexElementWrapper
)
parent
).
getValue
();
}
if
(
parent
instanceof
DBDComposite
)
{
DBDComposite
structure
=
(
DBDComposite
)
parent
;
try
{
...
...
@@ -623,6 +658,13 @@ public class ComplexObjectEditor extends TreeViewer {
Map
.
Entry
<?,
?>
entry
=
entries
.
next
();
children
[
i
]
=
new
MapEntry
(
CommonUtils
.
toString
(
entry
.
getKey
()),
entry
.
getValue
());
}
}
else
if
(
parent
instanceof
Collection
)
{
Collection
coll
=
(
Collection
)
parent
;
children
=
new
CollItem
[
coll
.
size
()];
Iterator
iterator
=
coll
.
iterator
();
for
(
int
i
=
0
;
i
<
children
.
length
;
i
++)
{
children
[
i
]
=
new
CollItem
(
i
,
iterator
.
next
());
}
}
if
(
children
!=
null
)
{
childrenMap
.
put
(
parent
,
children
);
...
...
@@ -637,13 +679,18 @@ public class ComplexObjectEditor extends TreeViewer {
@Override
public
boolean
hasChildren
(
Object
parent
)
{
if
(
parent
instanceof
ComplexElementWrapper
)
{
parent
=
((
ComplexElementWrapper
)
parent
).
getValue
();
}
return
parent
instanceof
DBDComposite
||
parent
instanceof
DBDCollection
||
parent
instanceof
DBDReference
||
(
parent
instanceof
CompositeField
&&
hasChildren
(((
CompositeField
)
parent
).
value
))
||
(
parent
instanceof
ArrayItem
&&
hasChildren
(((
ArrayItem
)
parent
).
value
))
||
(
parent
instanceof
Map
&&
!(((
Map
)
parent
).
isEmpty
()));
(
parent
instanceof
Map
&&
!(((
Map
)
parent
).
isEmpty
()))
||
(
parent
instanceof
Collection
&&
!(((
Collection
)
parent
).
isEmpty
()));
}
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/editors/ComplexValueInlineEditor.java
浏览文件 @
7b95dc16
...
...
@@ -51,7 +51,7 @@ public class ComplexValueInlineEditor extends BaseValueEditor<Tree> {
{
final
boolean
inline
=
valueController
.
getEditType
()
==
IValueController
.
EditType
.
INLINE
;
editor
=
new
ComplexObjectEditor
(
controller
,
this
,
inline
?
SWT
.
NONE
:
SWT
.
BORDER
);
editor
.
setModel
(
controller
.
getExecutionContext
(),
(
DBDComplexValue
)
controller
.
getValue
());
editor
.
setModel
(
controller
.
getExecutionContext
(),
controller
.
getValue
());
return
editor
.
getTree
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录