Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
67bb8462
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
67bb8462
编写于
5月 04, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debug panel UI - function parameters redesign
上级
a1ea5818
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
122 addition
and
73 deletion
+122
-73
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PostgreDebugPanelFunction.java
...stgresql/debug/ui/internal/PostgreDebugPanelFunction.java
+122
-73
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PostgreDebugPanelFunction.java
浏览文件 @
67bb8462
...
...
@@ -18,7 +18,6 @@
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.viewers.LabelProvider
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
...
...
@@ -26,10 +25,7 @@ import org.eclipse.swt.events.SelectionEvent;
import
org.eclipse.swt.events.SelectionListener
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.swt.widgets.Text
;
import
org.eclipse.swt.widgets.*
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.debug.ui.DBGConfigurationPanel
;
...
...
@@ -44,11 +40,11 @@ import org.jkiss.dbeaver.model.navigator.DBNNode;
import
org.jkiss.dbeaver.model.struct.DBSInstance
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedureParameter
;
import
org.jkiss.dbeaver.runtime.sql.ProcedureParameterBindDialog
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.CSmartCombo
;
import
org.jkiss.dbeaver.ui.controls.CSmartSelector
;
import
org.jkiss.dbeaver.ui.controls.CustomTableEditor
;
import
org.jkiss.dbeaver.ui.dialogs.BrowseObjectDialog
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -65,10 +61,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
private
Button
kindGlobal
;
private
CSmartCombo
<
PostgreProcedure
>
functionCombo
;
private
Text
processIdText
;
private
Button
configParametersButton
;
private
PostgreProcedure
selectedFunction
;
private
Map
<
DBSProcedureParameter
,
Object
>
parameterValues
=
new
HashMap
<>();
private
Table
parametersTable
;
@Override
public
void
createPanel
(
Composite
parent
,
DBGConfigurationPanelContainer
container
)
{
...
...
@@ -81,7 +77,7 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
processIdText
.
setEnabled
(
kindGlobal
.
getSelection
());
configParametersButton
.
setEnabled
(
kindLocal
.
getSelection
());
parametersTable
.
setEnabled
(
kindLocal
.
getSelection
());
container
.
updateDialogState
();
}
};
...
...
@@ -93,7 +89,11 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
kindGlobal
.
setText
(
"Global"
);
kindGlobal
.
addSelectionListener
(
listener
);
}
{
createFunctionGroup
(
parent
);
createParametersGroup
(
parent
);
}
private
void
createFunctionGroup
(
Composite
parent
)
{
Group
functionGroup
=
UIUtils
.
createControlGroup
(
parent
,
"Function"
,
2
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
SWT
.
DEFAULT
);
UIUtils
.
createControlLabel
(
functionGroup
,
"Function"
);
functionCombo
=
new
CSmartSelector
<
PostgreProcedure
>(
functionGroup
,
SWT
.
BORDER
|
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
,
new
LabelProvider
()
{
...
...
@@ -129,9 +129,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
selectedFunction
=
(
PostgreProcedure
)
((
DBNDatabaseNode
)
node
).
getObject
();
functionCombo
.
addItem
(
selectedFunction
);
functionCombo
.
select
(
selectedFunction
);
updateParametersTable
();
container
.
updateDialogState
();
}
configParametersButton
.
setEnabled
(
selectedFunction
!=
null
);
parametersTable
.
setEnabled
(
selectedFunction
!=
null
);
}
}
...
...
@@ -142,28 +143,58 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
gd
.
widthHint
=
UIUtils
.
getFontHeight
(
functionCombo
)
*
40
+
10
;
functionCombo
.
setLayoutData
(
gd
);
configParametersButton
=
UIUtils
.
createPushButton
(
functionGroup
,
"Configure Parameters..."
,
null
,
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
if
(
selectedFunction
==
null
)
{
return
;
}
ProcedureParameterBindDialog
dialog
=
new
ProcedureParameterBindDialog
(
parent
.
getShell
(),
selectedFunction
,
parameterValues
);
if
(
dialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
parameterValues
.
clear
();
parameterValues
.
putAll
(
dialog
.
getValues
());
}
}
});
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
gd
.
horizontalSpan
=
2
;
configParametersButton
.
setLayoutData
(
gd
);
processIdText
=
UIUtils
.
createLabelText
(
functionGroup
,
"Process ID"
,
""
,
SWT
.
BORDER
,
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
));
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
gd
.
widthHint
=
UIUtils
.
getFontHeight
(
processIdText
)
*
10
+
10
;
processIdText
.
setLayoutData
(
gd
);
}
private
void
createParametersGroup
(
Composite
parent
)
{
Group
composite
=
UIUtils
.
createControlGroup
(
parent
,
"Function parameters"
,
2
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
SWT
.
DEFAULT
);
parametersTable
=
new
Table
(
composite
,
SWT
.
SINGLE
|
SWT
.
FULL_SELECTION
|
SWT
.
BORDER
|
SWT
.
H_SCROLL
|
SWT
.
V_SCROLL
);
final
GridData
gd
=
new
GridData
(
GridData
.
FILL_BOTH
);
gd
.
widthHint
=
400
;
gd
.
heightHint
=
200
;
parametersTable
.
setLayoutData
(
gd
);
parametersTable
.
setHeaderVisible
(
true
);
parametersTable
.
setLinesVisible
(
true
);
final
TableColumn
nameColumn
=
UIUtils
.
createTableColumn
(
parametersTable
,
SWT
.
LEFT
,
"Name"
);
nameColumn
.
setWidth
(
100
);
final
TableColumn
valueColumn
=
UIUtils
.
createTableColumn
(
parametersTable
,
SWT
.
LEFT
,
"Value"
);
valueColumn
.
setWidth
(
200
);
final
TableColumn
typeColumn
=
UIUtils
.
createTableColumn
(
parametersTable
,
SWT
.
LEFT
,
"Type"
);
typeColumn
.
setWidth
(
60
);
final
TableColumn
kindColumn
=
UIUtils
.
createTableColumn
(
parametersTable
,
SWT
.
LEFT
,
"Kind"
);
kindColumn
.
setWidth
(
40
);
new
CustomTableEditor
(
parametersTable
)
{
{
firstTraverseIndex
=
1
;
lastTraverseIndex
=
1
;
editOnEnter
=
false
;
}
@Override
protected
Control
createEditor
(
Table
table
,
int
index
,
TableItem
item
)
{
if
(
index
!=
1
)
{
return
null
;
}
DBSProcedureParameter
param
=
(
DBSProcedureParameter
)
item
.
getData
();
Text
editor
=
new
Text
(
table
,
SWT
.
BORDER
);
editor
.
setText
(
CommonUtils
.
toString
(
parameterValues
.
get
(
param
),
""
));
editor
.
selectAll
();
return
editor
;
}
@Override
protected
void
saveEditorValue
(
Control
control
,
int
index
,
TableItem
item
)
{
DBSProcedureParameter
param
=
(
DBSProcedureParameter
)
item
.
getData
();
String
newValue
=
((
Text
)
control
).
getText
();
item
.
setText
(
1
,
newValue
);
parameterValues
.
put
(
param
,
newValue
);
}
};
}
@Override
...
...
@@ -174,7 +205,7 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
}
else
{
kindLocal
.
setSelection
(
true
);
}
configParametersButton
.
setEnabled
(
kindLocal
.
getSelection
());
parametersTable
.
setEnabled
(
kindLocal
.
getSelection
());
processIdText
.
setEnabled
(
kindGlobal
.
getSelection
());
Object
processId
=
configuration
.
get
(
PostgreDebugConstants
.
ATTR_ATTACH_PROCESS
);
...
...
@@ -225,8 +256,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
}
}
}
updateParametersTable
();
}
configParametersButton
.
setEnabled
(
selectedFunction
!=
null
);
parametersTable
.
setEnabled
(
selectedFunction
!=
null
);
if
(
selectedFunction
!=
null
)
{
functionCombo
.
addItem
(
selectedFunction
);
functionCombo
.
select
(
selectedFunction
);
...
...
@@ -237,6 +270,22 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
}
}
private
void
updateParametersTable
()
{
parametersTable
.
removeAll
();
for
(
DBSProcedureParameter
param
:
selectedFunction
.
getParameters
(
null
))
{
TableItem
item
=
new
TableItem
(
parametersTable
,
SWT
.
NONE
);
item
.
setData
(
param
);
item
.
setImage
(
DBeaverIcons
.
getImage
(
DBIcon
.
TREE_ATTRIBUTE
));
item
.
setText
(
0
,
param
.
getName
());
Object
value
=
parameterValues
.
get
(
param
);
item
.
setText
(
1
,
CommonUtils
.
toString
(
value
,
""
));
item
.
setText
(
2
,
param
.
getParameterType
().
getFullTypeName
());
item
.
setText
(
3
,
param
.
getParameterKind
().
getTitle
());
}
parametersTable
.
select
(
0
);
}
@Override
public
void
saveConfiguration
(
DBPDataSourceContainer
dataSource
,
Map
<
String
,
Object
>
configuration
)
{
configuration
.
put
(
PostgreDebugConstants
.
ATTR_ATTACH_KIND
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录