Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
5e6e15dc
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,发现更多精彩内容 >>
提交
5e6e15dc
编写于
5月 21, 2016
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#438 Properties custom format.
DB2 plan costs format. Former-commit-id:
7e105cd2
上级
779cafb4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
7 deletion
+45
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/properties/ObjectPropertyDescriptor.java
.../dbeaver/runtime/properties/ObjectPropertyDescriptor.java
+35
-0
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Constants.java
...r.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Constants.java
+2
-0
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/plan/DB2PlanObject.java
...c/org/jkiss/dbeaver/ext/db2/model/plan/DB2PlanObject.java
+1
-1
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/plan/DB2PlanOperator.java
...org/jkiss/dbeaver/ext/db2/model/plan/DB2PlanOperator.java
+7
-6
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/properties/ObjectPropertyDescriptor.java
浏览文件 @
5e6e15dc
...
...
@@ -34,6 +34,10 @@ import org.osgi.framework.FrameworkUtil;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.text.DecimalFormat
;
import
java.text.Format
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.ResourceBundle
;
/**
...
...
@@ -48,6 +52,7 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
private
IPropertyValueTransformer
valueTransformer
;
private
IPropertyValueTransformer
valueRenderer
;
private
final
Class
<?>
declaringClass
;
private
Format
displayFormat
=
null
;
public
ObjectPropertyDescriptor
(
DBPPropertySource
source
,
...
...
@@ -123,6 +128,12 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
return
propType
!=
null
&&
BeanUtils
.
isNumericType
(
propType
);
}
public
boolean
isDateTime
()
{
Class
<?>
propType
=
getGetter
().
getReturnType
();
return
propType
!=
null
&&
Date
.
class
.
isAssignableFrom
(
propType
);
}
public
boolean
supportsPreview
()
{
return
propInfo
.
supportsPreview
();
...
...
@@ -177,6 +188,24 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
return
propName
;
}
public
Format
getDisplayFormat
()
{
if
(
displayFormat
==
null
)
{
final
String
format
=
propInfo
.
format
();
if
(
format
==
null
||
format
.
isEmpty
())
{
return
null
;
}
if
(
isNumeric
())
{
displayFormat
=
new
DecimalFormat
(
format
);
}
else
if
(
isDateTime
())
{
displayFormat
=
new
SimpleDateFormat
(
format
);
}
else
{
log
.
debug
(
"Don't know how to apply format to property "
+
getId
());
displayFormat
=
null
;
}
}
return
displayFormat
;
}
public
Object
readValue
(
Object
object
,
DBRProgressMonitor
progressMonitor
)
throws
IllegalAccessException
,
IllegalArgumentException
,
InvocationTargetException
{
...
...
@@ -202,6 +231,12 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
if
(
valueRenderer
!=
null
)
{
value
=
valueRenderer
.
transform
(
object
,
value
);
}
if
(
value
instanceof
Number
)
{
final
Format
displayFormat
=
getDisplayFormat
();
if
(
displayFormat
!=
null
)
{
return
displayFormat
.
format
(
value
);
}
}
return
value
;
}
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Constants.java
浏览文件 @
5e6e15dc
...
...
@@ -92,6 +92,8 @@ public class DB2Constants {
public
static
final
String
CAT_STATS
=
"Statistics"
;
public
static
final
String
CAT_TABLESPACE
=
"Tablespace"
;
public
static
final
String
PLAN_COST_FORMAT
=
"###,###,###,##0.000"
;
// Schema for system datatypes
public
static
final
String
SYSTEM_DATATYPE_SCHEMA
=
"SYSIBM"
;
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/plan/DB2PlanObject.java
浏览文件 @
5e6e15dc
...
...
@@ -209,7 +209,7 @@ public class DB2PlanObject extends DB2PlanNode {
return
displayName
;
}
@Property
(
editable
=
false
,
viewable
=
true
,
order
=
2
,
category
=
DB2Constants
.
CAT_PERFORMANCE
)
@Property
(
editable
=
false
,
viewable
=
true
,
order
=
2
,
category
=
DB2Constants
.
CAT_PERFORMANCE
,
format
=
DB2Constants
.
PLAN_COST_FORMAT
)
public
Double
getEstimatedCardinality
()
{
return
Double
.
valueOf
(
rowCount
);
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/model/plan/DB2PlanOperator.java
浏览文件 @
5e6e15dc
...
...
@@ -18,10 +18,7 @@
*/
package
org.jkiss.dbeaver.ext.db2.model.plan
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.jkiss.dbeaver.ext.db2.DB2Constants
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
...
...
@@ -29,6 +26,10 @@ import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* DB2 EXPLAIN_OPERATOR table
*
...
...
@@ -141,13 +142,13 @@ public class DB2PlanOperator extends DB2PlanNode {
return
""
;
// Looks better without a name...
}
@Property
(
viewable
=
true
,
order
=
4
)
@Property
(
viewable
=
true
,
order
=
4
,
format
=
DB2Constants
.
PLAN_COST_FORMAT
)
public
Double
getTotalCost
()
{
return
totalCost
;
}
@Property
(
viewable
=
true
,
order
=
5
)
@Property
(
viewable
=
true
,
order
=
5
,
format
=
DB2Constants
.
PLAN_COST_FORMAT
)
public
Double
getEstimatedCardinality
()
{
return
estimatedCardinality
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录