Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
67bb8462
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,发现更多精彩内容 >>
提交
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 @@
...
@@ -18,7 +18,6 @@
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.viewers.LabelProvider
;
import
org.eclipse.jface.viewers.LabelProvider
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionAdapter
;
...
@@ -26,10 +25,7 @@ import org.eclipse.swt.events.SelectionEvent;
...
@@ -26,10 +25,7 @@ import org.eclipse.swt.events.SelectionEvent;
import
org.eclipse.swt.events.SelectionListener
;
import
org.eclipse.swt.events.SelectionListener
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.debug.ui.DBGConfigurationPanel
;
import
org.jkiss.dbeaver.debug.ui.DBGConfigurationPanel
;
...
@@ -44,11 +40,11 @@ import org.jkiss.dbeaver.model.navigator.DBNNode;
...
@@ -44,11 +40,11 @@ import org.jkiss.dbeaver.model.navigator.DBNNode;
import
org.jkiss.dbeaver.model.struct.DBSInstance
;
import
org.jkiss.dbeaver.model.struct.DBSInstance
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedureParameter
;
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.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.CSmartCombo
;
import
org.jkiss.dbeaver.ui.controls.CSmartCombo
;
import
org.jkiss.dbeaver.ui.controls.CSmartSelector
;
import
org.jkiss.dbeaver.ui.controls.CSmartSelector
;
import
org.jkiss.dbeaver.ui.controls.CustomTableEditor
;
import
org.jkiss.dbeaver.ui.dialogs.BrowseObjectDialog
;
import
org.jkiss.dbeaver.ui.dialogs.BrowseObjectDialog
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
...
@@ -65,10 +61,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
...
@@ -65,10 +61,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
private
Button
kindGlobal
;
private
Button
kindGlobal
;
private
CSmartCombo
<
PostgreProcedure
>
functionCombo
;
private
CSmartCombo
<
PostgreProcedure
>
functionCombo
;
private
Text
processIdText
;
private
Text
processIdText
;
private
Button
configParametersButton
;
private
PostgreProcedure
selectedFunction
;
private
PostgreProcedure
selectedFunction
;
private
Map
<
DBSProcedureParameter
,
Object
>
parameterValues
=
new
HashMap
<>();
private
Map
<
DBSProcedureParameter
,
Object
>
parameterValues
=
new
HashMap
<>();
private
Table
parametersTable
;
@Override
@Override
public
void
createPanel
(
Composite
parent
,
DBGConfigurationPanelContainer
container
)
{
public
void
createPanel
(
Composite
parent
,
DBGConfigurationPanelContainer
container
)
{
...
@@ -81,7 +77,7 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
...
@@ -81,7 +77,7 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
@Override
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
public
void
widgetSelected
(
SelectionEvent
e
)
{
processIdText
.
setEnabled
(
kindGlobal
.
getSelection
());
processIdText
.
setEnabled
(
kindGlobal
.
getSelection
());
configParametersButton
.
setEnabled
(
kindLocal
.
getSelection
());
parametersTable
.
setEnabled
(
kindLocal
.
getSelection
());
container
.
updateDialogState
();
container
.
updateDialogState
();
}
}
};
};
...
@@ -93,77 +89,112 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
...
@@ -93,77 +89,112 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
kindGlobal
.
setText
(
"Global"
);
kindGlobal
.
setText
(
"Global"
);
kindGlobal
.
addSelectionListener
(
listener
);
kindGlobal
.
addSelectionListener
(
listener
);
}
}
{
createFunctionGroup
(
parent
);
Group
functionGroup
=
UIUtils
.
createControlGroup
(
parent
,
"Function"
,
2
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
SWT
.
DEFAULT
);
createParametersGroup
(
parent
);
UIUtils
.
createControlLabel
(
functionGroup
,
"Function"
);
}
functionCombo
=
new
CSmartSelector
<
PostgreProcedure
>(
functionGroup
,
SWT
.
BORDER
|
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
,
new
LabelProvider
()
{
@Override
public
Image
getImage
(
Object
element
)
{
return
DBeaverIcons
.
getImage
(
DBIcon
.
TREE_PROCEDURE
);
}
@Override
private
void
createFunctionGroup
(
Composite
parent
)
{
public
String
getText
(
Object
element
)
{
Group
functionGroup
=
UIUtils
.
createControlGroup
(
parent
,
"Function"
,
2
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
SWT
.
DEFAULT
);
if
(
element
==
null
)
{
UIUtils
.
createControlLabel
(
functionGroup
,
"Function"
);
return
"N/A"
;
functionCombo
=
new
CSmartSelector
<
PostgreProcedure
>(
functionGroup
,
SWT
.
BORDER
|
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
,
new
LabelProvider
()
{
}
@Override
return
((
PostgreProcedure
)
element
).
getFullQualifiedSignature
();
public
Image
getImage
(
Object
element
)
{
return
DBeaverIcons
.
getImage
(
DBIcon
.
TREE_PROCEDURE
);
}
@Override
public
String
getText
(
Object
element
)
{
if
(
element
==
null
)
{
return
"N/A"
;
}
}
})
{
return
((
PostgreProcedure
)
element
).
getFullQualifiedSignature
();
@Override
}
protected
void
dropDown
(
boolean
drop
)
{
})
{
if
(
drop
)
{
@Override
DBNModel
navigatorModel
=
DBeaverCore
.
getInstance
().
getNavigatorModel
();
protected
void
dropDown
(
boolean
drop
)
{
DBNDatabaseNode
dsNode
=
navigatorModel
.
getNodeByObject
(
container
.
getDataSource
());
if
(
drop
)
{
if
(
dsNode
!=
null
)
{
DBNModel
navigatorModel
=
DBeaverCore
.
getInstance
().
getNavigatorModel
();
DBNNode
curNode
=
selectedFunction
==
null
?
null
:
navigatorModel
.
getNodeByObject
(
selectedFunction
);
DBNDatabaseNode
dsNode
=
navigatorModel
.
getNodeByObject
(
container
.
getDataSource
());
DBNNode
node
=
BrowseObjectDialog
.
selectObject
(
if
(
dsNode
!=
null
)
{
parent
.
getShell
(),
DBNNode
curNode
=
selectedFunction
==
null
?
null
:
navigatorModel
.
getNodeByObject
(
selectedFunction
);
"Select function to debug"
,
DBNNode
node
=
BrowseObjectDialog
.
selectObject
(
dsNode
,
parent
.
getShell
(),
curNode
,
"Select function to debug"
,
new
Class
[]{
DBSInstance
.
class
,
DBSObjectContainer
.
class
,
PostgreProcedure
.
class
},
dsNode
,
new
Class
[]{
PostgreProcedure
.
class
});
curNode
,
if
(
node
instanceof
DBNDatabaseNode
&&
((
DBNDatabaseNode
)
node
).
getObject
()
instanceof
PostgreProcedure
)
{
new
Class
[]{
DBSInstance
.
class
,
DBSObjectContainer
.
class
,
PostgreProcedure
.
class
},
functionCombo
.
removeAll
();
new
Class
[]{
PostgreProcedure
.
class
});
selectedFunction
=
(
PostgreProcedure
)
((
DBNDatabaseNode
)
node
).
getObject
();
if
(
node
instanceof
DBNDatabaseNode
&&
((
DBNDatabaseNode
)
node
).
getObject
()
instanceof
PostgreProcedure
)
{
functionCombo
.
addItem
(
selectedFunction
);
functionCombo
.
removeAll
();
functionCombo
.
select
(
selectedFunction
);
selectedFunction
=
(
PostgreProcedure
)
((
DBNDatabaseNode
)
node
).
getObject
();
container
.
updateDialogState
();
functionCombo
.
addItem
(
selectedFunction
);
}
functionCombo
.
select
(
selectedFunction
);
configParametersButton
.
setEnabled
(
selectedFunction
!=
null
);
updateParametersTable
();
container
.
updateDialogState
();
}
}
parametersTable
.
setEnabled
(
selectedFunction
!=
null
);
}
}
}
}
};
functionCombo
.
addItem
(
null
);
GridData
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
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
)
{
functionCombo
.
addItem
(
null
);
if
(
selectedFunction
==
null
)
{
GridData
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
return
;
gd
.
widthHint
=
UIUtils
.
getFontHeight
(
functionCombo
)
*
40
+
10
;
}
functionCombo
.
setLayoutData
(
gd
);
ProcedureParameterBindDialog
dialog
=
new
ProcedureParameterBindDialog
(
parent
.
getShell
(),
selectedFunction
,
parameterValues
);
if
(
dialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
processIdText
=
UIUtils
.
createLabelText
(
functionGroup
,
"Process ID"
,
""
,
SWT
.
BORDER
,
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
));
parameterValues
.
clear
();
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
parameterValues
.
putAll
(
dialog
.
getValues
());
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
();
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
Text
editor
=
new
Text
(
table
,
SWT
.
BORDER
);
gd
.
horizontalSpan
=
2
;
editor
.
setText
(
CommonUtils
.
toString
(
parameterValues
.
get
(
param
),
""
));
configParametersButton
.
setLayoutData
(
gd
);
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
);
processIdText
=
UIUtils
.
createLabelText
(
functionGroup
,
"Process ID"
,
""
,
SWT
.
BORDER
,
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
));
parameterValues
.
put
(
param
,
newValue
);
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
}
gd
.
widthHint
=
UIUtils
.
getFontHeight
(
processIdText
)
*
10
+
10
;
};
processIdText
.
setLayoutData
(
gd
);
}
}
}
@Override
@Override
...
@@ -174,7 +205,7 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
...
@@ -174,7 +205,7 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
}
else
{
}
else
{
kindLocal
.
setSelection
(
true
);
kindLocal
.
setSelection
(
true
);
}
}
configParametersButton
.
setEnabled
(
kindLocal
.
getSelection
());
parametersTable
.
setEnabled
(
kindLocal
.
getSelection
());
processIdText
.
setEnabled
(
kindGlobal
.
getSelection
());
processIdText
.
setEnabled
(
kindGlobal
.
getSelection
());
Object
processId
=
configuration
.
get
(
PostgreDebugConstants
.
ATTR_ATTACH_PROCESS
);
Object
processId
=
configuration
.
get
(
PostgreDebugConstants
.
ATTR_ATTACH_PROCESS
);
...
@@ -225,8 +256,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
...
@@ -225,8 +256,10 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
}
}
}
}
}
}
updateParametersTable
();
}
}
configParametersButton
.
setEnabled
(
selectedFunction
!=
null
);
parametersTable
.
setEnabled
(
selectedFunction
!=
null
);
if
(
selectedFunction
!=
null
)
{
if
(
selectedFunction
!=
null
)
{
functionCombo
.
addItem
(
selectedFunction
);
functionCombo
.
addItem
(
selectedFunction
);
functionCombo
.
select
(
selectedFunction
);
functionCombo
.
select
(
selectedFunction
);
...
@@ -237,6 +270,22 @@ public class PostgreDebugPanelFunction implements DBGConfigurationPanel {
...
@@ -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
@Override
public
void
saveConfiguration
(
DBPDataSourceContainer
dataSource
,
Map
<
String
,
Object
>
configuration
)
{
public
void
saveConfiguration
(
DBPDataSourceContainer
dataSource
,
Map
<
String
,
Object
>
configuration
)
{
configuration
.
put
(
PostgreDebugConstants
.
ATTR_ATTACH_KIND
,
configuration
.
put
(
PostgreDebugConstants
.
ATTR_ATTACH_KIND
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录