Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
00754e84
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,发现更多精彩内容 >>
提交
00754e84
编写于
6月 24, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Value managers extracted from value handlers
上级
192c4d92
变更
50
隐藏空白更改
内联
并排
Showing
50 changed file
with
1111 addition
and
552 deletion
+1111
-552
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+34
-2
plugins/org.jkiss.dbeaver.core/schema/org.jkiss.dbeaver.dataManager.exsd
...ss.dbeaver.core/schema/org.jkiss.dbeaver.dataManager.exsd
+164
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/data/DBDValueHandler.java
...ore/src/org/jkiss/dbeaver/model/data/DBDValueHandler.java
+2
-41
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/data/BaseValueHandler.java
...c/org/jkiss/dbeaver/model/impl/data/BaseValueHandler.java
+0
-16
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/data/DateTimeValueHandler.java
...g/jkiss/dbeaver/model/impl/data/DateTimeValueHandler.java
+2
-52
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/data/DefaultValueHandler.java
...rg/jkiss/dbeaver/model/impl/data/DefaultValueHandler.java
+1
-19
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCArrayValueHandler.java
...s/dbeaver/model/impl/jdbc/data/JDBCArrayValueHandler.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCBooleanValueHandler.java
...dbeaver/model/impl/jdbc/data/JDBCBooleanValueHandler.java
+1
-23
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCComplexValueHandler.java
...dbeaver/model/impl/jdbc/data/JDBCComplexValueHandler.java
+0
-40
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentValueHandler.java
...dbeaver/model/impl/jdbc/data/JDBCContentValueHandler.java
+1
-64
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCNumberValueHandler.java
.../dbeaver/model/impl/jdbc/data/JDBCNumberValueHandler.java
+31
-28
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCObjectValueHandler.java
.../dbeaver/model/impl/jdbc/data/JDBCObjectValueHandler.java
+1
-46
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCReferenceValueHandler.java
...eaver/model/impl/jdbc/data/JDBCReferenceValueHandler.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStringValueHandler.java
.../dbeaver/model/impl/jdbc/data/JDBCStringValueHandler.java
+1
-21
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStructValueHandler.java
.../dbeaver/model/impl/jdbc/data/JDBCStructValueHandler.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/sql/SQLQueryParameterBindDialog.java
...kiss/dbeaver/runtime/sql/SQLQueryParameterBindDialog.java
+14
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/ColumnInfoPanel.java
...re/src/org/jkiss/dbeaver/ui/controls/ColumnInfoPanel.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/FilterValueEditDialog.java
.../dbeaver/ui/controls/resultset/FilterValueEditDialog.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetValueController.java
...eaver/ui/controls/resultset/ResultSetValueController.java
+11
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/ViewValuePanel.java
...ver/ui/controls/resultset/spreadsheet/ViewValuePanel.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/IValueController.java
....core/src/org/jkiss/dbeaver/ui/data/IValueController.java
+6
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/IValueManager.java
...ver.core/src/org/jkiss/dbeaver/ui/data/IValueManager.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ComplexValueInlineEditor.java
...iss/dbeaver/ui/data/editors/ComplexValueInlineEditor.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ContentInlineEditor.java
...rg/jkiss/dbeaver/ui/data/editors/ContentInlineEditor.java
+3
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ContentPanelEditor.java
...org/jkiss/dbeaver/ui/data/editors/ContentPanelEditor.java
+2
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/DateTimeEditorHelper.java
...g/jkiss/dbeaver/ui/data/editors/DateTimeEditorHelper.java
+3
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/DateTimeInlineEditor.java
...g/jkiss/dbeaver/ui/data/editors/DateTimeInlineEditor.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/DateTimeStandaloneEditor.java
...iss/dbeaver/ui/data/editors/DateTimeStandaloneEditor.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/NumberInlineEditor.java
...org/jkiss/dbeaver/ui/data/editors/NumberInlineEditor.java
+25
-10
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ArrayValueManager.java
...org/jkiss/dbeaver/ui/data/managers/ArrayValueManager.java
+26
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/BaseValueManager.java
.../org/jkiss/dbeaver/ui/data/managers/BaseValueManager.java
+45
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ComplexValueManager.java
...g/jkiss/dbeaver/ui/data/managers/ComplexValueManager.java
+46
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ContentValueManager.java
...g/jkiss/dbeaver/ui/data/managers/ContentValueManager.java
+101
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/DateTimeValueManager.java
.../jkiss/dbeaver/ui/data/managers/DateTimeValueManager.java
+110
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/DefaultValueManager.java
...g/jkiss/dbeaver/ui/data/managers/DefaultValueManager.java
+1
-16
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/NumericValueManager.java
...g/jkiss/dbeaver/ui/data/managers/NumericValueManager.java
+55
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ObjectValueManager.java
...rg/jkiss/dbeaver/ui/data/managers/ObjectValueManager.java
+73
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ReferenceValueManager.java
...jkiss/dbeaver/ui/data/managers/ReferenceValueManager.java
+26
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/StringValueManager.java
...rg/jkiss/dbeaver/ui/data/managers/StringValueManager.java
+47
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/StructValueManager.java
...rg/jkiss/dbeaver/ui/data/managers/StructValueManager.java
+26
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/UUIDValueManager.java
.../org/jkiss/dbeaver/ui/data/managers/UUIDValueManager.java
+58
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/data/ComplexObjectEditor.java
...rg/jkiss/dbeaver/ui/dialogs/data/ComplexObjectEditor.java
+13
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/data/ValueViewDialog.java
...rc/org/jkiss/dbeaver/ui/dialogs/data/ValueViewDialog.java
+8
-1
plugins/org.jkiss.dbeaver.mysql/plugin.xml
plugins/org.jkiss.dbeaver.mysql/plugin.xml
+6
-0
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLEnumValueHandler.java
...g/jkiss/dbeaver/ext/mysql/data/MySQLEnumValueHandler.java
+1
-129
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLEnumValueManager.java
...g/jkiss/dbeaver/ext/mysql/data/MySQLEnumValueManager.java
+150
-0
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLSetValueHandler.java
...rg/jkiss/dbeaver/ext/mysql/data/MySQLSetValueHandler.java
+2
-16
plugins/org.jkiss.dbeaver.oracle/src/org/jkiss/dbeaver/ext/oracle/data/OracleObjectValueHandler.java
...iss/dbeaver/ext/oracle/data/OracleObjectValueHandler.java
+1
-10
未找到文件。
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
00754e84
...
...
@@ -24,6 +24,7 @@
<extension-point
id=
"org.jkiss.dbeaver.dataSourceProvider"
name=
"DataSource provider"
schema=
"schema/org.jkiss.dbeaver.dataSourceProvider.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.databaseEditor"
name=
"Custom Entity Editor"
schema=
"schema/org.jkiss.dbeaver.databaseEditor.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataTypeProvider"
name=
"DataType provider"
schema=
"schema/org.jkiss.dbeaver.dataTypeProvider.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataManager"
name=
"Data managers"
schema=
"schema/org.jkiss.dbeaver.dataManager.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataTransfer"
name=
"Data Transformer Provider"
schema=
"schema/org.jkiss.dbeaver.dataTransfer.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataFormatter"
name=
"Data Formatters"
schema=
"schema/org.jkiss.dbeaver.dataFormatter.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resourceHandler"
name=
"Resource Handlers"
schema=
"schema/org.jkiss.dbeaver.resourceHandler.exsd"
/>
...
...
@@ -2261,12 +2262,43 @@
</extension>
<extension
point=
"org.jkiss.dbeaver.dataManager"
>
<manager
class=
"org.jkiss.dbeaver.ui.data.manager
.BooleanValueManager"
id=
"org.jkiss.dbeaver.ui.data.manager
.BooleanValueManager"
>
<manager
class=
"org.jkiss.dbeaver.ui.data.manager
s.BooleanValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers
.BooleanValueManager"
>
<supports
kind=
"BOOLEAN"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.manager
.NumericValueManager"
id=
"org.jkiss.dbeaver.ui.data.manager
.NumericValueManager"
>
<manager
class=
"org.jkiss.dbeaver.ui.data.manager
s.NumericValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers
.NumericValueManager"
>
<supports
kind=
"NUMERIC"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.StringValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.StringValueManager"
>
<supports
kind=
"STRING"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.DateTimeValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.DateTimeValueManager"
>
<supports
kind=
"DATETIME"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.ArrayValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.ArrayValueManager"
>
<supports
kind=
"ARRAY"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.ReferenceValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.ReferenceValueManager"
>
<supports
kind=
"REF"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.StructValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.StructValueManager"
>
<supports
kind=
"STRUCT"
/>
<supports
type=
"java.util.Map"
/>
<supports
type=
"java.util.List"
/>
<supports
type=
"java.util.Set"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.ContentValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.ContentValueManager"
>
<supports
kind=
"LOB"
/>
<supports
kind=
"BINARY"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.ObjectValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.ObjectValueManager"
>
<supports
kind=
"OBJECT"
/>
<supports
kind=
"DOCUMENT"
/>
<supports
kind=
"ROWID"
/>
<supports
kind=
"ANY"
/>
</manager>
<manager
class=
"org.jkiss.dbeaver.ui.data.managers.UUIDValueManager"
id=
"org.jkiss.dbeaver.ui.data.managers.UUIDValueManager"
>
<supports
type=
"java.util.UUID"
/>
</manager>
</extension>
<extension
point=
"org.jkiss.dbeaver.dataTransfer"
>
...
...
plugins/org.jkiss.dbeaver.core/schema/org.jkiss.dbeaver.dataManager.exsd
0 → 100644
浏览文件 @
00754e84
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema
targetNamespace=
"org.jkiss.dbeaver.core"
xmlns=
"http://www.w3.org/2001/XMLSchema"
>
<annotation>
<appInfo>
<meta.schema
plugin=
"org.jkiss.dbeaver.core"
id=
"org.jkiss.dbeaver.dataManager"
name=
"Data Manager"
/>
</appInfo>
<documentation>
DBeaver custom data manager
</documentation>
</annotation>
<element
name=
"extension"
>
<annotation>
<appInfo>
<meta.element
/>
</appInfo>
</annotation>
<complexType>
<sequence
minOccurs=
"1"
maxOccurs=
"unbounded"
>
<element
ref=
"manager"
/>
</sequence>
<attribute
name=
"point"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"id"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"name"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"provider"
>
<complexType>
<sequence
minOccurs=
"1"
maxOccurs=
"unbounded"
>
<element
ref=
"type"
minOccurs=
"1"
maxOccurs=
"unbounded"
/>
<element
ref=
"datasource"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</sequence>
<attribute
name=
"id"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"class"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
kind=
"java"
basedOn=
":org.jkiss.dbeaver.model.data.DBDDataTypeProvider"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"description"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"label"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"datasource"
>
<complexType>
<attribute
name=
"id"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"type"
>
<complexType>
<attribute
name=
"standard"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"name"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section
type=
"since"
/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"examples"
/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"apiinfo"
/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"implementation"
/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/data/DBDValueHandler.java
浏览文件 @
00754e84
...
...
@@ -18,15 +18,10 @@
package
org.jkiss.dbeaver.model.data
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.exec.*
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
/**
* DBD Value Handler.
...
...
@@ -59,9 +54,10 @@ public interface DBDValueHandler
* May return base interface of object's type -
* it is not required to return exact implementation class
* (moreover it may be unknown before certain value is extracted)
* @param valueType value type
* @return value object type
*/
Class
getValueObjectType
();
Class
getValueObjectType
(
DBSTypedObject
valueType
);
/**
* Extracts object from result set
...
...
@@ -125,41 +121,6 @@ public interface DBDValueHandler
@NotNull
String
getValueDisplayString
(
@NotNull
DBSTypedObject
column
,
@Nullable
Object
value
,
@NotNull
DBDDisplayFormat
format
);
/**
* Fills context menu for certain value
*
* @param manager context menu manager
* @param controller value controller
* @throws DBCException on error
*/
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
IValueController
controller
)
throws
DBCException
;
/**
* Fills value's custom properties
* @param propertySource property source
* @param controller value controller
*/
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
);
/**
* Creates value editor.
* Value editor could be:
* <li>inline editor (control created withing inline placeholder)</li>
* <li>dialog (modal or modeless)</li>
* <li>workbench editor</li>
* Modeless dialogs and editors must implement IValueEditor and
* must register themselves within value controller. On close they must unregister themselves within
* value controller.
* @param controller value controller @return true if editor was successfully opened.
* makes since only for inline editors, otherwise return value is ignored.
* @return true on success
* @throws org.jkiss.dbeaver.DBException on error
*/
@Nullable
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
;
DBCLogicalOperator
[]
getSupportedOperators
(
@NotNull
DBDAttributeBinding
attribute
);
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/data/BaseValueHandler.java
浏览文件 @
00754e84
...
...
@@ -17,15 +17,11 @@
*/
package
org.jkiss.dbeaver.model.impl.data
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCLogicalOperator
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
/**
* Base value handler
...
...
@@ -46,18 +42,6 @@ public abstract class BaseValueHandler implements DBDValueHandler {
return
DBUtils
.
getDefaultValueDisplayString
(
value
,
format
);
}
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
IValueController
controller
)
throws
DBCException
{
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
}
@Override
public
DBCLogicalOperator
[]
getSupportedOperators
(
@NotNull
DBDAttributeBinding
attribute
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/data/DateTimeValueHandler.java
浏览文件 @
00754e84
...
...
@@ -17,26 +17,15 @@
*/
package
org.jkiss.dbeaver.model.impl.data
;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.DateTimeEditorHelper
;
import
org.jkiss.dbeaver.ui.data.editors.DateTimeInlineEditor
;
import
org.jkiss.dbeaver.ui.data.editors.DateTimeStandaloneEditor
;
import
org.jkiss.dbeaver.model.impl.data.formatters.DefaultDataFormatter
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
java.text.ParseException
;
import
java.util.Date
;
...
...
@@ -44,7 +33,7 @@ import java.util.Date;
/**
* Date/time value handler
*/
public
abstract
class
DateTimeValueHandler
extends
BaseValueHandler
implements
DateTimeEditorHelper
{
public
abstract
class
DateTimeValueHandler
extends
BaseValueHandler
{
protected
static
final
Log
log
=
Log
.
getLog
(
DateTimeValueHandler
.
class
);
...
...
@@ -56,21 +45,6 @@ public abstract class DateTimeValueHandler extends BaseValueHandler implements D
this
.
formatterProfile
=
formatterProfile
;
}
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
return
new
DateTimeInlineEditor
(
controller
,
this
);
case
EDITOR:
return
new
DateTimeStandaloneEditor
(
controller
,
this
);
default
:
return
null
;
}
}
@Override
public
int
getFeatures
()
{
...
...
@@ -78,7 +52,7 @@ public abstract class DateTimeValueHandler extends BaseValueHandler implements D
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
Date
.
class
;
}
...
...
@@ -114,29 +88,6 @@ public abstract class DateTimeValueHandler extends BaseValueHandler implements D
}
}
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
final
IValueController
controller
)
throws
DBCException
{
manager
.
add
(
new
Action
(
CoreMessages
.
model_jdbc_set_to_current_time
,
DBeaverIcons
.
getImageDescriptor
(
DBIcon
.
TYPE_DATETIME
))
{
@Override
public
void
run
()
{
controller
.
updateValue
(
new
Date
());
}
});
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
super
.
contributeProperties
(
propertySource
,
controller
);
propertySource
.
addProperty
(
"Date/Time"
,
"format"
,
//$NON-NLS-1$
"Pattern"
,
getFormatter
(
controller
.
getValueType
()).
getPattern
());
}
@NotNull
@Override
public
String
getValueDisplayString
(
@NotNull
DBSTypedObject
column
,
Object
value
,
@NotNull
DBDDisplayFormat
format
)
...
...
@@ -212,7 +163,6 @@ public abstract class DateTimeValueHandler extends BaseValueHandler implements D
}
}
@Override
@NotNull
public
DBDDataFormatter
getFormatter
(
DBSTypedObject
column
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/data/DefaultValueHandler.java
浏览文件 @
00754e84
...
...
@@ -18,13 +18,8 @@
package
org.jkiss.dbeaver.model.impl.data
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.exec.*
;
import
org.jkiss.dbeaver.ui.data.editors.StringInlineEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.TextViewDialog
;
/**
* Default value handler
...
...
@@ -40,7 +35,7 @@ public class DefaultValueHandler extends BaseValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
Object
.
class
;
}
...
...
@@ -72,17 +67,4 @@ public class DefaultValueHandler extends BaseValueHandler {
return
object
;
}
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
return
new
StringInlineEditor
(
controller
);
case
EDITOR:
return
new
TextViewDialog
(
controller
);
default
:
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCArrayValueHandler.java
浏览文件 @
00754e84
...
...
@@ -41,7 +41,7 @@ public class JDBCArrayValueHandler extends JDBCComplexValueHandler {
public
static
final
JDBCArrayValueHandler
INSTANCE
=
new
JDBCArrayValueHandler
();
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
JDBCArray
.
class
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCBooleanValueHandler.java
浏览文件 @
00754e84
...
...
@@ -19,18 +19,12 @@ package org.jkiss.dbeaver.model.impl.jdbc.data;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.BooleanInlineEditor
;
import
org.jkiss.dbeaver.ui.data.editors.BooleanPanelEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
import
java.sql.SQLException
;
...
...
@@ -69,7 +63,7 @@ public class JDBCBooleanValueHandler extends JDBCAbstractValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
Boolean
.
class
;
}
...
...
@@ -91,20 +85,4 @@ public class JDBCBooleanValueHandler extends JDBCAbstractValueHandler {
}
}
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
return
new
BooleanInlineEditor
(
controller
);
case
PANEL:
return
new
BooleanPanelEditor
(
controller
);
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCComplexValueHandler.java
浏览文件 @
00754e84
...
...
@@ -18,18 +18,12 @@
package
org.jkiss.dbeaver.model.impl.jdbc.data
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.impl.data.ComplexValueInlineEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
import
java.sql.SQLException
;
...
...
@@ -75,38 +69,4 @@ public abstract class JDBCComplexValueHandler extends JDBCAbstractValueHandler {
throw
new
DBCException
(
"Unsupported value type: "
+
value
);
}
/*
@Override
public void contributeProperties(@NotNull PropertySourceAbstract propertySource, @NotNull IValueController controller)
{
super.contributeProperties(propertySource, controller);
try {
Object value = controller.getValue();
if (value instanceof DBDComplexValue) {
propertySource.addProperty(
PROP_CATEGORY_COMPLEX,
"object_type", //$NON-NLS-1$
CoreMessages.model_jdbc_type_name,
((DBDComplexValue) value).getObjectDataType().getName());
}
} catch (Exception e) {
log.warn("Can't extract complex type information", e); //$NON-NLS-1$
}
}
*/
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
PANEL:
return
new
ComplexValueInlineEditor
(
controller
);
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentValueHandler.java
浏览文件 @
00754e84
...
...
@@ -17,24 +17,16 @@
*/
package
org.jkiss.dbeaver.model.impl.jdbc.data
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.ContentInlineEditor
;
import
org.jkiss.dbeaver.ui.data.editors.ContentPanelEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
java.sql.Blob
;
import
java.sql.Clob
;
...
...
@@ -116,7 +108,7 @@ public class JDBCContentValueHandler extends JDBCAbstractValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
DBDContent
.
class
;
}
...
...
@@ -190,59 +182,4 @@ public class JDBCContentValueHandler extends JDBCAbstractValueHandler {
return
super
.
getValueDisplayString
(
column
,
value
,
format
);
}
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
final
IValueController
controller
)
throws
DBCException
{
ContentUtils
.
contributeContentActions
(
manager
,
controller
);
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
super
.
contributeProperties
(
propertySource
,
controller
);
try
{
Object
value
=
controller
.
getValue
();
if
(
value
instanceof
DBDContent
)
{
propertySource
.
addProperty
(
PROP_CATEGORY_CONTENT
,
"content_type"
,
//$NON-NLS-1$
CoreMessages
.
model_jdbc_content_type
,
((
DBDContent
)
value
).
getContentType
());
final
long
contentLength
=
((
DBDContent
)
value
).
getContentLength
();
if
(
contentLength
>=
0
)
{
propertySource
.
addProperty
(
PROP_CATEGORY_CONTENT
,
"content_length"
,
//$NON-NLS-1$
CoreMessages
.
model_jdbc_content_length
,
contentLength
);
}
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"Can't extract LOB value information"
,
e
);
//$NON-NLS-1$
}
}
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
// Open inline/panel editor
if
(
controller
.
getValue
()
instanceof
DBDContentCached
)
{
return
new
ContentInlineEditor
(
controller
);
}
else
{
return
null
;
}
case
EDITOR:
return
ContentUtils
.
openContentEditor
(
controller
);
case
PANEL:
return
new
ContentPanelEditor
(
controller
);
default
:
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCNumberValueHandler.java
浏览文件 @
00754e84
...
...
@@ -19,8 +19,6 @@ package org.jkiss.dbeaver.model.impl.jdbc.data;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataKind
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
...
...
@@ -28,14 +26,10 @@ import org.jkiss.dbeaver.model.exec.DBCSession;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.BitInlineEditor
;
import
org.jkiss.dbeaver.model.impl.data.formatters.DefaultDataFormatter
;
import
org.jkiss.dbeaver.ui.data.editors.NumberEditorHelper
;
import
org.jkiss.dbeaver.ui.data.editors.NumberInlineEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
...
...
@@ -215,26 +209,6 @@ public class JDBCNumberValueHandler extends JDBCAbstractValueHandler implements
}
}
@Nullable
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
if
(
controller
.
getValueType
().
getDataKind
()
==
DBPDataKind
.
BOOLEAN
)
{
return
new
BitInlineEditor
(
controller
);
}
else
{
return
new
NumberInlineEditor
(
controller
,
this
);
}
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
@Override
public
int
getFeatures
()
{
...
...
@@ -242,9 +216,9 @@ public class JDBCNumberValueHandler extends JDBCAbstractValueHandler implements
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
Number
.
class
;
return
getNumberType
(
valueType
)
;
}
@Nullable
...
...
@@ -305,4 +279,33 @@ public class JDBCNumberValueHandler extends JDBCAbstractValueHandler implements
}
}
}
public
Class
<?
extends
Number
>
getNumberType
(
DBSTypedObject
type
)
{
switch
(
type
.
getTypeID
())
{
case
java
.
sql
.
Types
.
BIGINT
:
return
Long
.
class
;
case
java
.
sql
.
Types
.
DECIMAL
:
case
java
.
sql
.
Types
.
DOUBLE
:
case
java
.
sql
.
Types
.
REAL
:
return
Double
.
class
;
case
java
.
sql
.
Types
.
FLOAT
:
return
Float
.
class
;
case
java
.
sql
.
Types
.
INTEGER
:
return
Integer
.
class
;
case
java
.
sql
.
Types
.
SMALLINT
:
case
java
.
sql
.
Types
.
TINYINT
:
return
Short
.
class
;
case
java
.
sql
.
Types
.
BIT
:
return
Byte
.
class
;
case
java
.
sql
.
Types
.
NUMERIC
:
return
BigDecimal
.
class
;
default
:
if
(
type
.
getScale
()
>
0
)
{
return
Double
.
class
;
}
else
{
return
Long
.
class
;
}
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCObjectValueHandler.java
浏览文件 @
00754e84
...
...
@@ -18,12 +18,7 @@
package
org.jkiss.dbeaver.model.impl.jdbc.data
;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
...
...
@@ -31,12 +26,7 @@ import org.jkiss.dbeaver.model.exec.DBCSession;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.BaseValueEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.CursorViewDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.ResultSet
;
import
java.sql.RowId
;
...
...
@@ -99,7 +89,7 @@ public class JDBCObjectValueHandler extends JDBCAbstractValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
Object
.
class
;
}
...
...
@@ -126,39 +116,4 @@ public class JDBCObjectValueHandler extends JDBCAbstractValueHandler {
return
DBUtils
.
getDefaultValueDisplayString
(
value
,
format
);
}
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
PANEL:
return
new
BaseValueEditor
<
Text
>(
controller
)
{
@Override
protected
Text
createControl
(
Composite
editPlaceholder
)
{
return
new
Text
(
valueController
.
getEditPlaceholder
(),
SWT
.
BORDER
|
SWT
.
MULTI
|
SWT
.
WRAP
|
SWT
.
V_SCROLL
|
SWT
.
READ_ONLY
);
}
@Override
public
void
primeEditorValue
(
@Nullable
Object
value
)
throws
DBException
{
control
.
setText
(
CommonUtils
.
toString
(
value
));
}
@Override
public
Object
extractEditorValue
()
{
return
null
;
}
};
case
EDITOR:
final
Object
value
=
controller
.
getValue
();
if
(
value
instanceof
DBDCursor
)
{
return
new
CursorViewDialog
(
controller
);
}
return
null
;
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCReferenceValueHandler.java
浏览文件 @
00754e84
...
...
@@ -76,7 +76,7 @@ public class JDBCReferenceValueHandler extends JDBCComplexValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
Ref
.
class
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStringValueHandler.java
浏览文件 @
00754e84
...
...
@@ -18,17 +18,12 @@
package
org.jkiss.dbeaver.model.impl.jdbc.data
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.StringInlineEditor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.dialogs.data.TextViewDialog
;
import
java.sql.SQLException
;
...
...
@@ -62,21 +57,6 @@ public class JDBCStringValueHandler extends JDBCAbstractValueHandler {
}
}
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
return
new
StringInlineEditor
(
controller
);
case
EDITOR:
return
new
TextViewDialog
(
controller
);
default
:
return
null
;
}
}
@Override
public
int
getFeatures
()
{
...
...
@@ -84,7 +64,7 @@ public class JDBCStringValueHandler extends JDBCAbstractValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
String
.
class
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCStructValueHandler.java
浏览文件 @
00754e84
...
...
@@ -67,7 +67,7 @@ public class JDBCStructValueHandler extends JDBCComplexValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
JDBCStruct
.
class
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/sql/SQLQueryParameterBindDialog.java
浏览文件 @
00754e84
...
...
@@ -36,19 +36,21 @@ import org.eclipse.ui.IWorkbenchPartSite;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBeaverConstants
;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.model.data.DBDValueHandler
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.sql.SQLQueryParameter
;
import
org.jkiss.dbeaver.model.struct.DBSDataType
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.registry.DataSourceProviderRegistry
;
import
org.jkiss.dbeaver.registry.DataTypeProviderDescriptor
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.IValueEditorStandalone
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.dbeaver.ui.data.registry.DataManagerRegistry
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.*
;
...
...
@@ -219,7 +221,7 @@ public class SQLQueryParameterBindDialog extends StatusDialog {
//placeholder.setLayout(new FillLayout(SWT.HORIZONTAL));
ParameterValueController
valueController
=
new
ParameterValueController
(
param
,
placeholder
,
item
);
try
{
IValueEditor
editor
=
value
Handler
.
createEditor
(
valueController
);
IValueEditor
editor
=
value
Controller
.
getValueManager
()
.
createEditor
(
valueController
);
if
(
editor
!=
null
)
{
editor
.
createControl
();
editor
.
primeEditorValue
(
param
.
getValue
());
...
...
@@ -408,6 +410,15 @@ public class SQLQueryParameterBindDialog extends StatusDialog {
return
parameter
.
getValueHandler
();
}
@Override
public
IValueManager
getValueManager
()
{
DBSTypedObject
valueType
=
getValueType
();
return
DataManagerRegistry
.
getInstance
().
getManager
(
getExecutionContext
().
getDataSource
(),
valueType
.
getDataKind
(),
getValueHandler
().
getValueObjectType
(
valueType
));
}
@Override
public
EditType
getEditType
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/ColumnInfoPanel.java
浏览文件 @
00754e84
...
...
@@ -55,7 +55,7 @@ public class ColumnInfoPanel extends Composite {
{
PropertyCollector
infoItem
=
new
PropertyCollector
(
valueController
.
getBinding
().
getMetaAttribute
(),
false
);
infoItem
.
collectProperties
();
valueController
.
getValue
Handl
er
().
contributeProperties
(
infoItem
,
valueController
);
valueController
.
getValue
Manag
er
().
contributeProperties
(
infoItem
,
valueController
);
DBDRowIdentifier
rowIdentifier
=
valueController
.
getRowIdentifier
();
if
(
rowIdentifier
!=
null
)
{
infoItem
.
addProperty
(
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/FilterValueEditDialog.java
浏览文件 @
00754e84
...
...
@@ -76,7 +76,7 @@ class FilterValueEditDialog extends BaseDialog {
label
.
setText
(
valueController
.
getBinding
().
getName
()
+
" "
+
operator
.
getStringValue
()
+
" :"
);
try
{
editor
=
valueController
.
getValue
Handl
er
().
createEditor
(
valueController
);
editor
=
valueController
.
getValue
Manag
er
().
createEditor
(
valueController
);
if
(
editor
!=
null
)
{
editor
.
createControl
();
editor
.
primeEditorValue
(
valueController
.
getValue
());
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetValueController.java
浏览文件 @
00754e84
...
...
@@ -30,6 +30,8 @@ import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import
org.jkiss.dbeaver.ui.data.IAttributeController
;
import
org.jkiss.dbeaver.ui.data.IRowController
;
import
org.jkiss.dbeaver.ui.data.IValueEditorStandalone
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.dbeaver.ui.data.registry.DataManagerRegistry
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -144,6 +146,15 @@ public class ResultSetValueController implements IAttributeController, IRowContr
return
binding
.
getValueHandler
();
}
@Override
public
IValueManager
getValueManager
()
{
DBSTypedObject
valueType
=
getValueType
();
return
DataManagerRegistry
.
getInstance
().
getManager
(
getExecutionContext
().
getDataSource
(),
valueType
.
getDataKind
(),
getValueHandler
().
getValueObjectType
(
valueType
));
}
@Override
public
EditType
getEditType
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
00754e84
...
...
@@ -1206,7 +1206,7 @@ public class ResultSetViewer extends Viewer
// Menus from value handler
try
{
manager
.
add
(
new
Separator
());
attr
.
getValueHandl
er
().
contributeActions
(
manager
,
valueController
);
valueController
.
getValueManag
er
().
contributeActions
(
manager
,
valueController
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
00754e84
...
...
@@ -735,7 +735,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
placeholder
);
final
IValueEditor
editor
;
try
{
editor
=
attr
.
getValueHandl
er
().
createEditor
(
valueController
);
editor
=
valueController
.
getValueManag
er
().
createEditor
(
valueController
);
}
catch
(
Exception
e
)
{
UIUtils
.
showErrorDialog
(
spreadsheet
.
getShell
(),
"Cannot edit value"
,
null
,
e
);
...
...
@@ -953,7 +953,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
null
);
PropertyCollector
props
=
new
PropertyCollector
(
valueController
.
getBinding
().
getAttribute
(),
false
);
props
.
collectProperties
();
valueController
.
getValue
Handl
er
().
contributeProperties
(
props
,
valueController
);
valueController
.
getValue
Manag
er
().
contributeProperties
(
props
,
valueController
);
return
new
PropertySourceDelegate
(
props
);
}
return
null
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/ViewValuePanel.java
浏览文件 @
00754e84
...
...
@@ -122,14 +122,14 @@ abstract class ViewValuePanel extends Composite {
columnNameLabel
.
setText
(
valueController
.
getValueName
());
// Create a new one
try
{
valueViewer
=
valueController
.
getValue
Handl
er
().
createEditor
(
valueController
);
valueViewer
=
valueController
.
getValue
Manag
er
().
createEditor
(
valueController
);
}
catch
(
DBException
e
)
{
UIUtils
.
showErrorDialog
(
getShell
(),
"Value preview"
,
"Can't create value viewer"
,
e
);
return
;
}
toolBarManager
.
removeAll
();
try
{
valueController
.
getValue
Handl
er
().
contributeActions
(
toolBarManager
,
valueController
);
valueController
.
getValue
Manag
er
().
contributeActions
(
toolBarManager
,
valueController
);
}
catch
(
DBCException
e
)
{
log
.
error
(
"Error filling toolbar actions"
,
e
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/IValueController.java
浏览文件 @
00754e84
...
...
@@ -80,6 +80,12 @@ public interface IValueController
*/
DBDValueHandler
getValueHandler
();
/**
* Associated value manager
* @return value manager
*/
IValueManager
getValueManager
();
EditType
getEditType
();
/**
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/IValueManager.java
浏览文件 @
00754e84
...
...
@@ -23,6 +23,7 @@ import org.jkiss.code.NotNull;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.data.DBDValueHandler
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
/**
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/
model/impl/data
/ComplexValueInlineEditor.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/
ui/data/editors
/ComplexValueInlineEditor.java
浏览文件 @
00754e84
...
...
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.
model.impl.data
;
package
org.jkiss.dbeaver.
ui.data.editors
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ContentInlineEditor.java
浏览文件 @
00754e84
...
...
@@ -17,6 +17,7 @@
*/
package
org.jkiss.dbeaver.ui.data.editors
;
import
org.eclipse.jface.resource.JFaceResources
;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
...
...
@@ -77,6 +78,7 @@ public class ContentInlineEditor extends BaseValueEditor<Text> {
{
final
Text
editor
=
new
Text
(
editPlaceholder
,
SWT
.
BORDER
);
editor
.
setEditable
(!
valueController
.
isReadOnly
());
editor
.
setFont
(
JFaceResources
.
getFont
(
JFaceResources
.
TEXT_FONT
));
long
maxLength
=
valueController
.
getValueType
().
getMaxLength
();
if
(
maxLength
<=
0
)
{
maxLength
=
MAX_STRING_LENGTH
;
...
...
@@ -92,6 +94,7 @@ public class ContentInlineEditor extends BaseValueEditor<Text> {
{
String
newValue
=
control
.
getText
();
final
DBDContent
content
=
(
DBDContent
)
valueController
.
getValue
();
assert
content
!=
null
;
try
{
if
(
isText
)
{
content
.
updateContents
(
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ContentPanelEditor.java
浏览文件 @
00754e84
...
...
@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.ui.data.editors;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.eclipse.jface.resource.JFaceResources
;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.ImageData
;
...
...
@@ -173,6 +174,7 @@ public class ContentPanelEditor extends BaseValueEditor<Control> implements IVal
if
(
ContentUtils
.
isTextContent
(
content
))
{
Text
text
=
new
Text
(
editPlaceholder
,
SWT
.
MULTI
|
SWT
.
WRAP
|
SWT
.
V_SCROLL
|
SWT
.
BORDER
);
text
.
setEditable
(!
valueController
.
isReadOnly
());
text
.
setFont
(
JFaceResources
.
getFont
(
JFaceResources
.
TEXT_FONT
));
return
text
;
}
else
{
ImageDetector
imageDetector
=
new
ImageDetector
(
content
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/DateTimeEditorHelper.java
浏览文件 @
00754e84
...
...
@@ -17,14 +17,16 @@
*/
package
org.jkiss.dbeaver.ui.data.editors
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.data.DBDDataFormatter
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
/**
* DateTimeEditorHelper
*/
public
interface
DateTimeEditorHelper
{
DBDDataFormatter
getFormatter
(
DBSTypedObject
column
);
DBDDataFormatter
getFormatter
(
@NotNull
IValueController
controller
,
DBSTypedObject
column
);
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/DateTimeInlineEditor.java
浏览文件 @
00754e84
...
...
@@ -58,7 +58,7 @@ public class DateTimeInlineEditor extends BaseValueEditor<Control> {
}
timeEditor
=
new
CustomTimeEditor
(
dateTimeGroup
,
(
inline
?
SWT
.
BORDER
:
SWT
.
NONE
)
|
SWT
.
TIME
|
SWT
.
LONG
,
helper
.
getFormatter
(
valueController
.
getValueType
()));
helper
.
getFormatter
(
valueController
,
valueController
.
getValueType
()));
timeEditor
.
setEnabled
(!
valueController
.
isReadOnly
());
if
(!
inline
)
{
timeEditor
.
getControl
().
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/DateTimeStandaloneEditor.java
浏览文件 @
00754e84
...
...
@@ -64,7 +64,7 @@ public class DateTimeStandaloneEditor extends ValueViewDialog {
}
UIUtils
.
createControlLabel
(
panel
,
"Time"
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
DBDDataFormatter
formatter
=
helper
.
getFormatter
(
valueController
.
getValueType
());
DBDDataFormatter
formatter
=
helper
.
getFormatter
(
valueController
,
valueController
.
getValueType
());
timeEditor
=
new
CustomTimeEditor
(
panel
,
style
,
formatter
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/NumberInlineEditor.java
浏览文件 @
00754e84
...
...
@@ -17,21 +17,23 @@
*/
package
org.jkiss.dbeaver.ui.data.editors
;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.data.DBDDataFormatter
;
import
org.jkiss.dbeaver.model.data.DBDDataFormatterProfile
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.utils.CommonUtils
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.text.ParseException
;
import
java.util.Locale
;
/**
* NumberInlineEditor
...
...
@@ -41,11 +43,12 @@ public class NumberInlineEditor extends BaseValueEditor<Text> {
static
final
Log
log
=
Log
.
getLog
(
NumberInlineEditor
.
class
);
private
static
final
int
MAX_NUMBER_LENGTH
=
100
;
private
static
final
String
BAD_DOUBLE_VALUE
=
"2.2250738585072012e-308"
;
//$NON-NLS-1$
private
final
NumberEditorHelper
helper
;
public
NumberInlineEditor
(
IValueController
controller
,
NumberEditorHelper
helper
)
{
private
DBDDataFormatterProfile
formatterProfile
;
public
NumberInlineEditor
(
IValueController
controller
)
{
super
(
controller
);
this
.
helper
=
helper
;
this
.
formatterProfile
=
valueController
.
getExecutionContext
().
getDataSource
().
getContainer
().
getDataFormatterProfile
()
;
}
@Override
...
...
@@ -54,11 +57,15 @@ public class NumberInlineEditor extends BaseValueEditor<Text> {
final
Text
editor
=
new
Text
(
valueController
.
getEditPlaceholder
(),
SWT
.
BORDER
);
editor
.
setEditable
(!
valueController
.
isReadOnly
());
editor
.
setTextLimit
(
MAX_NUMBER_LENGTH
);
Class
<?
extends
Number
>
type
=
helper
.
getNumberType
(
valueController
.
getValueType
(),
valueController
.
getValue
());
Object
curValue
=
valueController
.
getValue
();
Class
type
=
curValue
instanceof
Number
?
curValue
.
getClass
()
:
valueController
.
getValueHandler
().
getValueObjectType
(
valueController
.
getValueType
());
Locale
locale
=
formatterProfile
.
getLocale
();
if
(
type
==
Float
.
class
||
type
==
Double
.
class
||
type
==
BigDecimal
.
class
)
{
editor
.
addVerifyListener
(
UIUtils
.
getNumberVerifyListener
(
helper
.
getLocale
()
));
editor
.
addVerifyListener
(
UIUtils
.
getNumberVerifyListener
(
locale
));
}
else
{
editor
.
addVerifyListener
(
UIUtils
.
getIntegerVerifyListener
(
helper
.
getLocale
()
));
editor
.
addVerifyListener
(
UIUtils
.
getIntegerVerifyListener
(
locale
));
}
return
editor
;
}
...
...
@@ -84,8 +91,16 @@ public class NumberInlineEditor extends BaseValueEditor<Text> {
if
(
CommonUtils
.
isEmpty
(
text
))
{
return
null
;
}
Class
<?
extends
Number
>
hintType
=
helper
.
getNumberType
(
valueController
.
getValueType
(),
valueController
.
getValue
());
return
convertStringToNumber
(
text
,
hintType
,
helper
.
getFormatter
());
Object
curValue
=
valueController
.
getValue
();
Class
hintType
=
curValue
instanceof
Number
?
curValue
.
getClass
()
:
valueController
.
getValueHandler
().
getValueObjectType
(
valueController
.
getValueType
());
try
{
return
convertStringToNumber
(
text
,
hintType
,
formatterProfile
.
createFormatter
(
DBDDataFormatter
.
TYPE_NAME_NUMBER
));
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
return
null
;
}
}
@Nullable
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ArrayValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
/**
* Array value manager.
*/
public
class
ArrayValueManager
extends
ComplexValueManager
{
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/BaseValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
/**
* Base value manager
*/
public
abstract
class
BaseValueManager
implements
IValueManager
{
public
static
final
String
PROP_CATEGORY_COMPLEX
=
"Complex"
;
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
IValueController
controller
)
throws
DBCException
{
// nothing
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
// nothing
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ComplexValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ui.data.editors.ComplexValueInlineEditor
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
/**
* Complex value manager.
*/
public
abstract
class
ComplexValueManager
extends
BaseValueManager
{
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
PANEL:
return
new
ComplexValueInlineEditor
(
controller
);
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ContentValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.ContentInlineEditor
;
import
org.jkiss.dbeaver.ui.data.editors.ContentPanelEditor
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
/**
* JDBC Content value handler.
* Handle LOBs, LONGs and BINARY types.
*
* @author Serge Rider
*/
public
class
ContentValueManager
extends
BaseValueManager
{
static
final
Log
log
=
Log
.
getLog
(
ContentValueManager
.
class
);
public
static
final
String
PROP_CATEGORY_CONTENT
=
"LOB"
;
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
final
IValueController
controller
)
throws
DBCException
{
ContentUtils
.
contributeContentActions
(
manager
,
controller
);
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
super
.
contributeProperties
(
propertySource
,
controller
);
try
{
Object
value
=
controller
.
getValue
();
if
(
value
instanceof
DBDContent
)
{
propertySource
.
addProperty
(
PROP_CATEGORY_CONTENT
,
"content_type"
,
//$NON-NLS-1$
CoreMessages
.
model_jdbc_content_type
,
((
DBDContent
)
value
).
getContentType
());
final
long
contentLength
=
((
DBDContent
)
value
).
getContentLength
();
if
(
contentLength
>=
0
)
{
propertySource
.
addProperty
(
PROP_CATEGORY_CONTENT
,
"content_length"
,
//$NON-NLS-1$
CoreMessages
.
model_jdbc_content_length
,
contentLength
);
}
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"Can't extract LOB value information"
,
e
);
//$NON-NLS-1$
}
}
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
// Open inline/panel editor
if
(
controller
.
getValue
()
instanceof
DBDContentCached
)
{
return
new
ContentInlineEditor
(
controller
);
}
else
{
return
null
;
}
case
EDITOR:
return
ContentUtils
.
openContentEditor
(
controller
);
case
PANEL:
return
new
ContentPanelEditor
(
controller
);
default
:
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/DateTimeValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.data.DBDDataFormatter
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.impl.data.formatters.DefaultDataFormatter
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.DateTimeEditorHelper
;
import
org.jkiss.dbeaver.ui.data.editors.DateTimeInlineEditor
;
import
org.jkiss.dbeaver.ui.data.editors.DateTimeStandaloneEditor
;
import
java.util.Date
;
/**
* JDBC string value handler
*/
public
class
DateTimeValueManager
extends
BaseValueManager
implements
DateTimeEditorHelper
{
protected
static
final
Log
log
=
Log
.
getLog
(
DateTimeValueManager
.
class
);
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
final
IValueController
controller
)
throws
DBCException
{
manager
.
add
(
new
Action
(
CoreMessages
.
model_jdbc_set_to_current_time
,
DBeaverIcons
.
getImageDescriptor
(
DBIcon
.
TYPE_DATETIME
))
{
@Override
public
void
run
()
{
controller
.
updateValue
(
new
Date
());
}
});
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
super
.
contributeProperties
(
propertySource
,
controller
);
propertySource
.
addProperty
(
"Date/Time"
,
"format"
,
//$NON-NLS-1$
"Pattern"
,
getFormatter
(
controller
,
controller
.
getValueType
()).
getPattern
());
}
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
return
new
DateTimeInlineEditor
(
controller
,
this
);
case
EDITOR:
return
new
DateTimeStandaloneEditor
(
controller
,
this
);
default
:
return
null
;
}
}
public
DBDDataFormatter
getFormatter
(
@NotNull
IValueController
controller
,
String
typeId
)
{
try
{
return
controller
.
getExecutionContext
().
getDataSource
().
getContainer
().
getDataFormatterProfile
().
createFormatter
(
typeId
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Can't create formatter for datetime value handler"
,
e
);
//$NON-NLS-1$
return
DefaultDataFormatter
.
INSTANCE
;
}
}
@Override
@NotNull
public
DBDDataFormatter
getFormatter
(
@NotNull
IValueController
controller
,
DBSTypedObject
column
)
{
switch
(
column
.
getTypeID
())
{
case
java
.
sql
.
Types
.
TIME
:
return
getFormatter
(
controller
,
DBDDataFormatter
.
TYPE_NAME_TIME
);
case
java
.
sql
.
Types
.
DATE
:
return
getFormatter
(
controller
,
DBDDataFormatter
.
TYPE_NAME_DATE
);
default
:
return
getFormatter
(
controller
,
DBDDataFormatter
.
TYPE_NAME_TIMESTAMP
);
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/DefaultValueManager.java
浏览文件 @
00754e84
...
...
@@ -17,35 +17,20 @@
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPPropertyManager
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.dbeaver.ui.data.editors.StringInlineEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.TextViewDialog
;
/**
* Default value handler
*/
public
class
DefaultValueManager
implements
I
ValueManager
{
public
class
DefaultValueManager
extends
Base
ValueManager
{
public
static
final
DefaultValueManager
INSTANCE
=
new
DefaultValueManager
();
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
IValueController
controller
)
throws
DBCException
{
// nothing
}
@Override
public
void
contributeProperties
(
@NotNull
DBPPropertyManager
propertySource
,
@NotNull
IValueController
controller
)
{
// nothing
}
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/NumericValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataKind
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.BitInlineEditor
;
import
org.jkiss.dbeaver.ui.data.editors.NumberInlineEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
/**
* JDBC number value handler
*/
public
class
NumericValueManager
extends
BaseValueManager
{
@Nullable
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
if
(
controller
.
getValueType
().
getDataKind
()
==
DBPDataKind
.
BOOLEAN
)
{
return
new
BitInlineEditor
(
controller
);
}
else
{
return
new
NumberInlineEditor
(
controller
);
}
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ObjectValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.data.DBDCursor
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.BaseValueEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.CursorViewDialog
;
import
org.jkiss.utils.CommonUtils
;
/**
* Object value manager.
*/
public
class
ObjectValueManager
extends
BaseValueManager
{
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
PANEL:
return
new
BaseValueEditor
<
Text
>(
controller
)
{
@Override
protected
Text
createControl
(
Composite
editPlaceholder
)
{
return
new
Text
(
valueController
.
getEditPlaceholder
(),
SWT
.
BORDER
|
SWT
.
MULTI
|
SWT
.
WRAP
|
SWT
.
V_SCROLL
|
SWT
.
READ_ONLY
);
}
@Override
public
void
primeEditorValue
(
@Nullable
Object
value
)
throws
DBException
{
control
.
setText
(
CommonUtils
.
toString
(
value
));
}
@Override
public
Object
extractEditorValue
()
{
return
null
;
}
};
case
EDITOR:
final
Object
value
=
controller
.
getValue
();
if
(
value
instanceof
DBDCursor
)
{
return
new
CursorViewDialog
(
controller
);
}
return
null
;
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/ReferenceValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
/**
* Reference value manager.
*/
public
class
ReferenceValueManager
extends
ComplexValueManager
{
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/StringValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.StringInlineEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.TextViewDialog
;
/**
* String value manager
*/
public
class
StringValueManager
extends
BaseValueManager
{
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
return
new
StringInlineEditor
(
controller
);
case
EDITOR:
return
new
TextViewDialog
(
controller
);
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/StructValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
/**
* Struct value manager.
*/
public
class
StructValueManager
extends
ComplexValueManager
{
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/managers/UUIDValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.data.managers
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.StringInlineEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.TextViewDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.UUID
;
/**
* UUID value manager
*/
public
class
UUIDValueManager
extends
BaseValueManager
{
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
case
PANEL:
return
new
StringInlineEditor
(
controller
)
{
@Override
public
Object
extractEditorValue
()
{
return
UUID
.
fromString
(
CommonUtils
.
toString
(
super
.
extractEditorValue
()));
}
};
case
EDITOR:
return
new
TextViewDialog
(
controller
)
{
@Override
public
Object
extractEditorValue
()
{
return
UUID
.
fromString
(
CommonUtils
.
toString
(
super
.
extractEditorValue
()));
}
};
default
:
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/data/ComplexObjectEditor.java
浏览文件 @
00754e84
...
...
@@ -47,6 +47,8 @@ import org.jkiss.dbeaver.ui.UIUtils;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.IValueEditorStandalone
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.dbeaver.ui.data.registry.DataManagerRegistry
;
import
java.lang.reflect.InvocationTargetException
;
...
...
@@ -202,7 +204,7 @@ public class ComplexObjectEditor extends TreeViewer {
value
,
advanced
?
IValueController
.
EditType
.
EDITOR
:
IValueController
.
EditType
.
INLINE
);
try
{
curCellEditor
=
value
Handler
.
createEditor
(
valueController
);
curCellEditor
=
value
Controller
.
getValueManager
()
.
createEditor
(
valueController
);
if
(
curCellEditor
!=
null
)
{
curCellEditor
.
createControl
();
if
(
curCellEditor
instanceof
IValueEditorStandalone
)
{
...
...
@@ -269,6 +271,7 @@ public class ComplexObjectEditor extends TreeViewer {
this
.
editType
=
editType
;
}
@NotNull
@Override
public
DBCExecutionContext
getExecutionContext
()
{
...
...
@@ -306,6 +309,15 @@ public class ComplexObjectEditor extends TreeViewer {
return
valueHandler
;
}
@Override
public
IValueManager
getValueManager
()
{
DBSTypedObject
valueType
=
getValueType
();
return
DataManagerRegistry
.
getInstance
().
getManager
(
getExecutionContext
().
getDataSource
(),
valueType
.
getDataKind
(),
getValueHandler
().
getValueObjectType
(
valueType
));
}
@Override
public
EditType
getEditType
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/data/ValueViewDialog.java
浏览文件 @
00754e84
...
...
@@ -18,6 +18,7 @@
package
org.jkiss.dbeaver.ui.dialogs.data
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.core.runtime.Status
;
...
...
@@ -123,7 +124,8 @@ public abstract class ValueViewDialog extends Dialog implements IValueEditorStan
protected
IValueEditor
createPanelEditor
(
final
Composite
placeholder
)
throws
DBException
{
IValueEditor
editor
=
valueController
.
getValueHandler
().
createEditor
(
new
IValueController
()
{
IValueEditor
editor
=
valueController
.
getValueManager
().
createEditor
(
new
IValueController
()
{
@NotNull
@Override
public
DBCExecutionContext
getExecutionContext
()
{
return
valueController
.
getExecutionContext
();
...
...
@@ -159,6 +161,11 @@ public abstract class ValueViewDialog extends Dialog implements IValueEditorStan
return
valueController
.
getValueHandler
();
}
@Override
public
IValueManager
getValueManager
()
{
return
valueController
.
getValueManager
();
}
@Override
public
EditType
getEditType
()
{
...
...
plugins/org.jkiss.dbeaver.mysql/plugin.xml
浏览文件 @
00754e84
...
...
@@ -330,6 +330,12 @@
</provider>
</extension>
<extension
point=
"org.jkiss.dbeaver.dataManager"
>
<manager
class=
"org.jkiss.dbeaver.ext.mysql.data.MySQLEnumValueManager"
id=
"org.jkiss.dbeaver.ext.mysql.data.MySQLEnumValueManager"
>
<supports
type=
"org.jkiss.dbeaver.ext.mysql.data.MySQLTypeEnum"
/>
</manager>
</extension>
<extension
point=
"org.eclipse.ui.editors"
>
<editor
name=
"%editor.session_manager.name"
...
...
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLEnumValueHandler.java
浏览文件 @
00754e84
...
...
@@ -17,34 +17,23 @@
*/
package
org.jkiss.dbeaver.ext.mysql.data
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Combo
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.List
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.data.DBDAttributeBinding
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.ui.data.editors.BaseValueEditor
;
import
org.jkiss.dbeaver.model.impl.jdbc.data.JDBCAbstractValueHandler
;
import
org.jkiss.dbeaver.model.struct.DBSEntityAttribute
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSTableColumn
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.SQLException
;
import
java.util.Collection
;
/**
* MySQL ENUM value handler
...
...
@@ -123,114 +112,6 @@ public class MySQLEnumValueHandler extends JDBCAbstractValueHandler {
}
}
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
{
return
new
BaseValueEditor
<
Combo
>(
controller
)
{
@Override
public
void
primeEditorValue
(
@Nullable
Object
value
)
throws
DBException
{
MySQLTypeEnum
enumValue
=
(
MySQLTypeEnum
)
value
;
control
.
setText
(
DBUtils
.
isNullValue
(
enumValue
)
?
""
:
enumValue
.
getValue
());
}
@Override
public
Object
extractEditorValue
()
{
int
selIndex
=
control
.
getSelectionIndex
();
if
(
selIndex
<
0
)
{
return
new
MySQLTypeEnum
(
getColumn
(),
null
);
}
else
{
return
new
MySQLTypeEnum
(
getColumn
(),
control
.
getItem
(
selIndex
));
}
}
@Override
protected
Combo
createControl
(
Composite
editPlaceholder
)
{
final
Combo
editor
=
new
Combo
(
controller
.
getEditPlaceholder
(),
SWT
.
READ_ONLY
);
Collection
<
String
>
enumValues
=
getColumn
().
getEnumValues
();
if
(
enumValues
!=
null
)
{
for
(
String
enumValue
:
enumValues
)
{
editor
.
add
(
enumValue
);
}
}
if
(
editor
.
getSelectionIndex
()
<
0
)
{
editor
.
select
(
0
);
}
return
editor
;
}
private
MySQLTableColumn
getColumn
()
{
return
((
MySQLTypeEnum
)
controller
.
getValue
()).
getColumn
();
}
};
}
case
PANEL:
{
return
new
BaseValueEditor
<
List
>(
controller
)
{
@Override
public
void
primeEditorValue
(
@Nullable
Object
value
)
throws
DBException
{
MySQLTypeEnum
enumValue
=
(
MySQLTypeEnum
)
value
;
if
(
enumValue
.
isNull
())
{
control
.
setSelection
(-
1
);
}
int
itemCount
=
control
.
getItemCount
();
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
if
(
control
.
getItem
(
i
).
equals
(
enumValue
.
getValue
()))
{
control
.
setSelection
(
i
);
break
;
}
}
}
@Override
public
Object
extractEditorValue
()
{
int
selIndex
=
control
.
getSelectionIndex
();
if
(
selIndex
<
0
)
{
return
new
MySQLTypeEnum
(
getColumn
(),
null
);
}
else
{
return
new
MySQLTypeEnum
(
getColumn
(),
control
.
getItem
(
selIndex
));
}
}
@Override
protected
List
createControl
(
Composite
editPlaceholder
)
{
final
MySQLTableColumn
column
=
((
MySQLTypeEnum
)
controller
.
getValue
()).
getColumn
();
final
List
editor
=
new
List
(
controller
.
getEditPlaceholder
(),
SWT
.
BORDER
|
SWT
.
READ_ONLY
|
SWT
.
V_SCROLL
);
Collection
<
String
>
enumValues
=
column
.
getEnumValues
();
if
(
enumValues
!=
null
)
{
for
(
String
enumValue
:
enumValues
)
{
editor
.
add
(
enumValue
);
}
}
if
(
editor
.
getSelectionIndex
()
<
0
)
{
editor
.
select
(
0
);
}
if
(
controller
.
getEditType
()
==
IValueController
.
EditType
.
INLINE
)
{
editor
.
setFocus
();
}
return
editor
;
}
private
MySQLTableColumn
getColumn
()
{
return
((
MySQLTypeEnum
)
controller
.
getValue
()).
getColumn
();
}
};
}
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
@Override
public
int
getFeatures
()
{
...
...
@@ -238,19 +119,10 @@ public class MySQLEnumValueHandler extends JDBCAbstractValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
MySQLTypeEnum
.
class
;
}
/*
public void contributeProperties(PropertySourceAbstract propertySource, IValueController controller)
{
propertySource.addProperty(
"max_length",
"Max Length",
controller.getAttributeMetaData().getMaxLength());
}
*/
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLEnumValueManager.java
0 → 100644
浏览文件 @
00754e84
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ext.mysql.data
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Combo
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.List
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.BaseValueEditor
;
import
org.jkiss.dbeaver.ui.data.managers.BaseValueManager
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
import
java.util.Collection
;
/**
* MySQL ENUM value manager
*/
public
class
MySQLEnumValueManager
extends
BaseValueManager
{
@Override
public
IValueEditor
createEditor
(
@NotNull
final
IValueController
controller
)
throws
DBException
{
switch
(
controller
.
getEditType
())
{
case
INLINE:
{
return
new
BaseValueEditor
<
Combo
>(
controller
)
{
@Override
public
void
primeEditorValue
(
@Nullable
Object
value
)
throws
DBException
{
MySQLTypeEnum
enumValue
=
(
MySQLTypeEnum
)
value
;
control
.
setText
(
DBUtils
.
isNullValue
(
enumValue
)
?
""
:
enumValue
.
getValue
());
}
@Override
public
Object
extractEditorValue
()
{
int
selIndex
=
control
.
getSelectionIndex
();
if
(
selIndex
<
0
)
{
return
new
MySQLTypeEnum
(
getColumn
(),
null
);
}
else
{
return
new
MySQLTypeEnum
(
getColumn
(),
control
.
getItem
(
selIndex
));
}
}
@Override
protected
Combo
createControl
(
Composite
editPlaceholder
)
{
final
Combo
editor
=
new
Combo
(
controller
.
getEditPlaceholder
(),
SWT
.
READ_ONLY
);
Collection
<
String
>
enumValues
=
getColumn
().
getEnumValues
();
if
(
enumValues
!=
null
)
{
for
(
String
enumValue
:
enumValues
)
{
editor
.
add
(
enumValue
);
}
}
if
(
editor
.
getSelectionIndex
()
<
0
)
{
editor
.
select
(
0
);
}
return
editor
;
}
private
MySQLTableColumn
getColumn
()
{
return
((
MySQLTypeEnum
)
controller
.
getValue
()).
getColumn
();
}
};
}
case
PANEL:
{
return
new
BaseValueEditor
<
List
>(
controller
)
{
@Override
public
void
primeEditorValue
(
@Nullable
Object
value
)
throws
DBException
{
MySQLTypeEnum
enumValue
=
(
MySQLTypeEnum
)
value
;
if
(
enumValue
.
isNull
())
{
control
.
setSelection
(-
1
);
}
int
itemCount
=
control
.
getItemCount
();
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
if
(
control
.
getItem
(
i
).
equals
(
enumValue
.
getValue
()))
{
control
.
setSelection
(
i
);
break
;
}
}
}
@Override
public
Object
extractEditorValue
()
{
int
selIndex
=
control
.
getSelectionIndex
();
if
(
selIndex
<
0
)
{
return
new
MySQLTypeEnum
(
getColumn
(),
null
);
}
else
{
return
new
MySQLTypeEnum
(
getColumn
(),
control
.
getItem
(
selIndex
));
}
}
@Override
protected
List
createControl
(
Composite
editPlaceholder
)
{
final
MySQLTableColumn
column
=
((
MySQLTypeEnum
)
controller
.
getValue
()).
getColumn
();
final
List
editor
=
new
List
(
controller
.
getEditPlaceholder
(),
SWT
.
BORDER
|
SWT
.
READ_ONLY
|
SWT
.
V_SCROLL
);
Collection
<
String
>
enumValues
=
column
.
getEnumValues
();
if
(
enumValues
!=
null
)
{
for
(
String
enumValue
:
enumValues
)
{
editor
.
add
(
enumValue
);
}
}
if
(
editor
.
getSelectionIndex
()
<
0
)
{
editor
.
select
(
0
);
}
if
(
controller
.
getEditType
()
==
IValueController
.
EditType
.
INLINE
)
{
editor
.
setFocus
();
}
return
editor
;
}
private
MySQLTableColumn
getColumn
()
{
return
((
MySQLTypeEnum
)
controller
.
getValue
()).
getColumn
();
}
};
}
case
EDITOR:
return
new
DefaultValueViewDialog
(
controller
);
default
:
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.mysql/src/org/jkiss/dbeaver/ext/mysql/data/MySQLSetValueHandler.java
浏览文件 @
00754e84
...
...
@@ -17,22 +17,6 @@
*/
package
org.jkiss.dbeaver.ext.mysql.data
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.mysql.model.MySQLTableColumn
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.data.editors.BaseValueEditor
;
import
org.jkiss.dbeaver.ui.dialogs.data.DefaultValueViewDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.StringTokenizer
;
/**
* MySQL SET value handler
*/
...
...
@@ -40,6 +24,7 @@ public class MySQLSetValueHandler extends MySQLEnumValueHandler {
public
static
final
MySQLSetValueHandler
INSTANCE
=
new
MySQLSetValueHandler
();
/*
@Override
public IValueEditor createEditor(@NotNull final IValueController controller)
throws DBException
...
...
@@ -109,5 +94,6 @@ public class MySQLSetValueHandler extends MySQLEnumValueHandler {
editor.select(selIndices);
}
}
*/
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.oracle/src/org/jkiss/dbeaver/ext/oracle/data/OracleObjectValueHandler.java
浏览文件 @
00754e84
...
...
@@ -18,10 +18,7 @@
package
org.jkiss.dbeaver.ext.oracle.data
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
...
...
@@ -71,7 +68,7 @@ public class OracleObjectValueHandler extends JDBCAbstractValueHandler {
}
@Override
public
Class
getValueObjectType
()
public
Class
getValueObjectType
(
DBSTypedObject
valueType
)
{
return
java
.
lang
.
Object
.
class
;
}
...
...
@@ -88,10 +85,4 @@ public class OracleObjectValueHandler extends JDBCAbstractValueHandler {
}
}
@Override
public
IValueEditor
createEditor
(
@NotNull
IValueController
controller
)
throws
DBException
{
return
null
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录