Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
7e7003de
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,发现更多精彩内容 >>
提交
7e7003de
编写于
5月 03, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debug tab redesign. Debug pannels support.
上级
03995f68
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
320 addition
and
119 deletion
+320
-119
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGConstants.java
....debug.core/src/org/jkiss/dbeaver/debug/DBGConstants.java
+2
-0
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/DebugConfigurationPanelDescriptor.java
...ver/debug/internal/DebugConfigurationPanelDescriptor.java
+78
-0
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/DebugConfigurationPanelRegistry.java
...eaver/debug/internal/DebugConfigurationPanelRegistry.java
+73
-0
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/ui/DebugUIMessages.java
.../org/jkiss/dbeaver/debug/internal/ui/DebugUIMessages.java
+2
-8
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/ui/DebugUIMessages.properties
...kiss/dbeaver/debug/internal/ui/DebugUIMessages.properties
+3
-9
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/ui/DBGConfigurationPanel.java
...src/org/jkiss/dbeaver/debug/ui/DBGConfigurationPanel.java
+5
-3
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/ui/DatabaseDebugConfigurationTab.java
...jkiss/dbeaver/debug/ui/DatabaseDebugConfigurationTab.java
+137
-95
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/plugin.xml
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/plugin.xml
+5
-0
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
+15
-4
未找到文件。
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGConstants.java
浏览文件 @
7e7003de
...
...
@@ -29,6 +29,8 @@ public class DBGConstants {
public
static
final
String
ATTR_PROCEDURE_NAME
=
BUNDLE_SYMBOLIC_NAME
+
".ATTR_PROCEDURE_NAME"
;
//$NON-NLS-1$
public
static
final
String
ATTR_PROCEDURE_OID
=
BUNDLE_SYMBOLIC_NAME
+
".ATTR_PROCEDURE_OID"
;
//$NON-NLS-1$
public
static
final
String
ATTR_DATASOURCE_ID
=
BUNDLE_SYMBOLIC_NAME
+
".ATTR_DATASOURCE_ID"
;
//$NON-NLS-1$
public
static
final
String
ATTR_DEBUG_TYPE
=
BUNDLE_SYMBOLIC_NAME
+
".ATTR_DEBUG_TYPE"
;
//$NON-NLS-1$
public
static
final
String
SOURCE_CONTAINER_TYPE_DATASOURCE
=
BUNDLE_SYMBOLIC_NAME
+
".datasourceSourceContainerType"
;
//$NON-NLS-1$
public
static
final
String
BREAKPOINT_ATTRIBUTE_PROCEDURE_OID
=
BUNDLE_SYMBOLIC_NAME
+
".procedureOid"
;
//$NON-NLS-1$
public
static
final
String
BREAKPOINT_ATTRIBUTE_PROCEDURE_NAME
=
BUNDLE_SYMBOLIC_NAME
+
".procedureName"
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/DebugConfigurationPanelDescriptor.java
0 → 100644
浏览文件 @
7e7003de
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.debug.internal
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.debug.ui.DBGConfigurationPanel
;
import
org.jkiss.dbeaver.registry.AbstractContextDescriptor
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.utils.CommonUtils
;
/**
* DebugConfigurationPanelDescriptor
*/
public
class
DebugConfigurationPanelDescriptor
extends
AbstractContextDescriptor
{
public
static
final
String
EXTENSION_ID
=
"org.jkiss.dbeaver.debug.ui.configurationPanels"
;
//$NON-NLS-1$
private
final
String
id
;
private
final
String
name
;
private
final
String
description
;
private
final
ObjectType
implType
;
public
DebugConfigurationPanelDescriptor
(
IConfigurationElement
config
)
{
super
(
config
);
this
.
id
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_ID
);
this
.
name
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_NAME
);
this
.
description
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_DESCRIPTION
);
this
.
implType
=
new
ObjectType
(
config
,
RegistryConstants
.
ATTR_CLASS
);
}
@NotNull
public
String
getId
()
{
return
id
;
}
@NotNull
public
String
getName
()
{
return
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
boolean
isValid
()
{
return
!
CommonUtils
.
isEmpty
(
implType
.
getImplName
());
}
public
DBGConfigurationPanel
createPanel
()
throws
DBException
{
return
implType
.
createInstance
(
DBGConfigurationPanel
.
class
);
}
@Override
public
String
toString
()
{
return
id
;
}
}
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/DebugConfigurationPanelRegistry.java
0 → 100644
浏览文件 @
7e7003de
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.debug.internal
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.IExtensionRegistry
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
DebugConfigurationPanelRegistry
{
private
static
DebugConfigurationPanelRegistry
instance
=
null
;
public
synchronized
static
DebugConfigurationPanelRegistry
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
DebugConfigurationPanelRegistry
(
Platform
.
getExtensionRegistry
());
}
return
instance
;
}
private
final
List
<
DebugConfigurationPanelDescriptor
>
descriptors
=
new
ArrayList
<>();
private
DebugConfigurationPanelRegistry
(
IExtensionRegistry
registry
)
{
// Load data descriptors from external plugins
{
IConfigurationElement
[]
extElements
=
registry
.
getConfigurationElementsFor
(
DebugConfigurationPanelDescriptor
.
EXTENSION_ID
);
for
(
IConfigurationElement
ext
:
extElements
)
{
DebugConfigurationPanelDescriptor
formatterDescriptor
=
new
DebugConfigurationPanelDescriptor
(
ext
);
descriptors
.
add
(
formatterDescriptor
);
}
}
}
public
List
<
DebugConfigurationPanelDescriptor
>
getPanels
()
{
return
descriptors
;
}
public
List
<
DebugConfigurationPanelDescriptor
>
getPanels
(
DBPDataSourceContainer
dataSource
)
{
return
descriptors
;
}
public
DebugConfigurationPanelDescriptor
getPanel
(
String
id
)
{
for
(
DebugConfigurationPanelDescriptor
descriptor
:
descriptors
)
{
if
(
descriptor
.
getId
().
equals
(
id
))
{
return
descriptor
;
}
}
return
null
;
}
}
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/ui/DebugUIMessages.java
浏览文件 @
7e7003de
...
...
@@ -31,14 +31,8 @@ public class DebugUIMessages extends NLS {
public
static
String
DatabaseTab_driver_label_text
;
public
static
String
DatabaseTab_datasource_label_text
;
public
static
String
DatabaseTab_procedure_group_text
;
public
static
String
DatabaseTab_database_label_text
;
public
static
String
DatabaseTab_schema_label_text
;
public
static
String
DatabaseTab_oid_label_text
;
public
static
String
DatabaseTab_name_label_text
;
public
static
String
DatabaseTab_attach_group_text
;
public
static
String
DatabaseTab_script_execute_text
;
public
static
String
DatabaseTab_debug_type_group_text
;
public
static
String
DatabaseTab_configuration_group_text
;
public
static
String
DatabaseTab_name
;
...
...
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/internal/ui/DebugUIMessages.properties
浏览文件 @
7e7003de
...
...
@@ -21,16 +21,10 @@ DatabaseTab_connection_group_text=Connection settings
DatabaseTab_driver_label_text
=
Driver
DatabaseTab_datasource_label_text
=
DataSource
DatabaseTab_procedure_group_text
=
Procedure settings
DatabaseTab_database_label_text
=
Database
DatabaseTab_schema_label_text
=
Schema
DatabaseTab_oid_label_text
=
OID
DatabaseTab_name_label_text
=
Name
DatabaseTab_debug_type_group_text
=
Type
DatabaseTab_configuration_group_text
=
Configuration
DatabaseTab_attach_group_text
=
Attach settings
DatabaseTab_script_execute_text
=
Execute script
DatabaseTab_name
=
&Main
DatabaseTab_name
=
&Settings
DatabaseLaunchShortcut_e_launch
=
Launch error
...
...
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/ui/DBGConfigurationPanel.java
浏览文件 @
7e7003de
...
...
@@ -16,17 +16,19 @@
*/
package
org.jkiss.dbeaver.debug.ui
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.swt.widgets.Composite
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
java.util.Map
;
public
interface
DBGConfigurationPanel
{
void
createPanel
(
@NotNull
Composite
parent
);
void
loadConfiguration
(
@NotNull
DBPDataSourceContainer
dataSource
,
@NotNull
ILaunchConfiguration
configuration
);
void
loadConfiguration
(
@NotNull
DBPDataSourceContainer
dataSource
,
@NotNull
Map
<
String
,
Object
>
configuration
);
void
saveConfiguration
(
@NotNull
DBPDataSourceContainer
dataSource
,
@NotNull
ILaunchConfiguration
configuration
);
void
saveConfiguration
(
@NotNull
DBPDataSourceContainer
dataSource
,
@NotNull
Map
<
String
,
Object
>
configuration
);
boolean
isValid
();
}
plugins/org.jkiss.dbeaver.debug.ui/src/org/jkiss/dbeaver/debug/ui/DatabaseDebugConfigurationTab.java
浏览文件 @
7e7003de
...
...
@@ -23,16 +23,19 @@ import org.eclipse.core.runtime.CoreException;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
;
import
org.eclipse.debug.ui.AbstractLaunchConfigurationTab
;
import
org.eclipse.jface.layout.GridDataFactory
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.*
;
import
org.eclipse.swt.events.ModifyListener
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.PlatformUI
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.debug.DBGConstants
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.internal.DebugConfigurationPanelDescriptor
;
import
org.jkiss.dbeaver.debug.internal.DebugConfigurationPanelRegistry
;
import
org.jkiss.dbeaver.debug.internal.ui.DebugUIMessages
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
...
...
@@ -41,24 +44,23 @@ import org.jkiss.dbeaver.registry.DataSourceDescriptor;
import
org.jkiss.dbeaver.registry.DataSourceProviderRegistry
;
import
org.jkiss.dbeaver.registry.DataSourceRegistry
;
import
org.jkiss.dbeaver.registry.driver.DriverDescriptor
;
import
org.jkiss.dbeaver.runtime.ui.DBUserInterface
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.CSmartSelector
;
import
org.jkiss.dbeaver.ui.controls.DatabaseLabelProviders
;
import
org.jkiss.dbeaver.ui.controls.SelectDataSourceCombo
;
import
org.jkiss.dbeaver.ui.perspective.DataSourceManagementToolbar
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
DatabaseDebugConfigurationTab
extends
AbstractLaunchConfigurationTab
{
private
Text
driverText
;
private
Text
oidText
;
private
Text
nameText
;
private
DebugConfigurationPanelDescriptor
selectedDebugType
;
private
DBGConfigurationPanel
selectedDebugPanel
;
private
ILaunchConfiguration
currentConfiguration
;
private
Button
attachLocal
;
private
Button
attachGlobal
;
private
Text
processText
;
private
Text
scriptText
;
private
Text
driverText
;
/**
* Modify listener that simply updates the owning launch configuration
...
...
@@ -66,6 +68,8 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
*/
protected
ModifyListener
modifyListener
=
evt
->
scheduleUpdateJob
();
private
SelectDataSourceCombo
connectionCombo
;
private
Group
typesGroup
;
private
Composite
panelPlaceholder
;
@Override
public
void
createControl
(
Composite
parent
)
{
...
...
@@ -80,8 +84,7 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
protected
void
createComponents
(
Composite
comp
)
{
createConnectionSettingsGroup
(
comp
);
createDatabaseSettingsGroup
(
comp
);
createAttachSettingsGroup
(
comp
);
createPanelListGroup
(
comp
);
}
protected
void
createConnectionSettingsGroup
(
Composite
composite
)
{
...
...
@@ -98,6 +101,8 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
protected
void
onDataSourceChange
(
DBPDataSourceContainer
dataSource
)
{
String
driverName
=
dataSource
==
null
?
""
:
dataSource
.
getDriver
().
getFullName
();
driverText
.
setText
(
driverName
);
loadConnectionDebugTypes
();
scheduleUpdateJob
();
}
};
connectionCombo
.
addItem
(
null
);
...
...
@@ -108,52 +113,91 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
driverText
=
UIUtils
.
createLabelText
(
group
,
DebugUIMessages
.
DatabaseTab_driver_label_text
,
""
,
SWT
.
READ_ONLY
);
}
protected
void
createDatabaseSettingsGroup
(
Composite
composite
)
{
String
groupLabel
=
DebugUIMessages
.
DatabaseTab_procedure_group_text
;
Group
group
=
UIUtils
.
createControlGroup
(
composite
,
groupLabel
,
2
,
GridData
.
FILL_HORIZONTAL
,
SWT
.
DEFAULT
);
{
String
label
=
DebugUIMessages
.
DatabaseTab_oid_label_text
;
oidText
=
UIUtils
.
createLabelText
(
group
,
label
,
""
,
SWT
.
READ_ONLY
);
protected
void
createPanelListGroup
(
Composite
composite
)
{
typesGroup
=
UIUtils
.
createControlGroup
(
composite
,
DebugUIMessages
.
DatabaseTab_debug_type_group_text
,
3
,
GridData
.
FILL_HORIZONTAL
,
SWT
.
DEFAULT
);
panelPlaceholder
=
UIUtils
.
createControlGroup
(
composite
,
DebugUIMessages
.
DatabaseTab_configuration_group_text
,
1
,
GridData
.
FILL_BOTH
,
SWT
.
DEFAULT
);
loadConnectionDebugTypes
();
}
private
void
loadConnectionDebugTypes
()
{
for
(
Control
c
:
typesGroup
.
getChildren
())
{
c
.
dispose
();
}
{
String
label
=
DebugUIMessages
.
DatabaseTab_name_label_text
;
nameText
=
UIUtils
.
createLabelText
(
group
,
label
,
""
,
SWT
.
READ_ONLY
);
DBPDataSourceContainer
dataSource
=
connectionCombo
.
getSelectedItem
();
if
(
dataSource
==
null
)
{
UIUtils
.
createInfoLabel
(
typesGroup
,
"Select a connection to see available debug types"
);
}
else
{
List
<
DebugConfigurationPanelDescriptor
>
panels
=
DebugConfigurationPanelRegistry
.
getInstance
().
getPanels
(
dataSource
);
if
(
CommonUtils
.
isEmpty
(
panels
))
{
UIUtils
.
createInfoLabel
(
typesGroup
,
"Driver '"
+
dataSource
.
getDriver
().
getFullName
()
+
"' doesn't support debugging"
);
}
else
{
for
(
DebugConfigurationPanelDescriptor
panel
:
panels
)
{
Button
typeSelector
=
new
Button
(
typesGroup
,
SWT
.
RADIO
);
typeSelector
.
setText
(
panel
.
getName
());
if
(!
CommonUtils
.
isEmpty
(
panel
.
getDescription
()))
{
typeSelector
.
setToolTipText
(
panel
.
getDescription
());
}
typeSelector
.
setData
(
panel
);
if
(
panel
.
isValid
())
{
typeSelector
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
if
(
typeSelector
.
getSelection
())
{
setDebugType
(
connectionCombo
.
getSelectedItem
(),
(
DebugConfigurationPanelDescriptor
)
typeSelector
.
getData
());
updateLaunchConfigurationDialog
();
}
}
});
}
else
{
typeSelector
.
setEnabled
(
false
);
}
}
}
}
setDebugType
(
dataSource
,
null
);
typesGroup
.
getParent
().
layout
(
true
,
true
);
}
protected
void
createAttachSettingsGroup
(
Composite
composite
)
{
String
groupLabel
=
DebugUIMessages
.
DatabaseTab_attach_group_text
;
Group
group
=
UIUtils
.
createControlGroup
(
composite
,
groupLabel
,
2
,
GridData
.
FILL_HORIZONTAL
|
GridData
.
FILL_VERTICAL
|
GridData
.
GRAB_VERTICAL
,
SWT
.
DEFAULT
);
group
.
setLayout
(
new
GridLayout
(
3
,
false
));
SelectionListener
attachKindListener
=
new
SelectionAdapter
()
{
public
void
widgetSelected
(
SelectionEvent
event
)
{
Object
data
=
event
.
widget
.
getData
();
String
attachKind
=
String
.
valueOf
(
data
);
handleAttachKind
(
attachKind
);
private
void
setDebugType
(
DBPDataSourceContainer
dataSource
,
DebugConfigurationPanelDescriptor
debugPanel
)
{
if
(
selectedDebugType
==
debugPanel
)
{
return
;
}
for
(
Control
c
:
panelPlaceholder
.
getChildren
())
{
c
.
dispose
();
}
if
(
debugPanel
!=
null
)
{
try
{
selectedDebugType
=
debugPanel
;
selectedDebugPanel
=
debugPanel
.
createPanel
();
selectedDebugPanel
.
createPanel
(
panelPlaceholder
);
if
(
dataSource
!=
null
&&
currentConfiguration
!=
null
)
{
try
{
selectedDebugPanel
.
loadConfiguration
(
dataSource
,
currentConfiguration
.
getAttributes
());
}
catch
(
CoreException
e
)
{
setWarningMessage
(
"Error loading panel configuration: "
+
e
.
getMessage
());
}
}
}
catch
(
DBException
e
)
{
selectedDebugType
=
null
;
selectedDebugPanel
=
null
;
DBUserInterface
.
getInstance
().
showError
(
"Panel create error"
,
"Can't create debugger config panel "
+
debugPanel
.
getId
(),
e
);
}
};
attachLocal
=
new
Button
(
group
,
SWT
.
RADIO
);
attachLocal
.
setData
(
DBGController
.
ATTACH_KIND_LOCAL
);
attachLocal
.
setText
(
"Local"
);
attachLocal
.
addSelectionListener
(
attachKindListener
);
attachLocal
.
setLayoutData
(
GridDataFactory
.
swtDefaults
().
span
(
3
,
1
).
create
());
attachGlobal
=
new
Button
(
group
,
SWT
.
RADIO
);
attachGlobal
.
setData
(
DBGController
.
ATTACH_KIND_GLOBAL
);
attachGlobal
.
setText
(
"Global"
);
attachGlobal
.
addSelectionListener
(
attachKindListener
);
attachGlobal
.
setLayoutData
(
GridDataFactory
.
swtDefaults
().
span
(
1
,
1
).
create
());
processText
=
UIUtils
.
createLabelText
(
group
,
"PID"
,
""
,
SWT
.
READ_ONLY
,
GridDataFactory
.
swtDefaults
().
span
(
1
,
1
).
create
());
processText
.
addModifyListener
(
modifyListener
);
scriptText
=
new
Text
(
group
,
SWT
.
MULTI
);
scriptText
.
setLayoutData
(
GridDataFactory
.
fillDefaults
().
span
(
3
,
1
).
grab
(
true
,
true
).
create
());
scriptText
.
addModifyListener
(
modifyListener
);
}
else
{
selectedDebugType
=
null
;
selectedDebugPanel
=
null
;
}
if
(
selectedDebugType
==
null
)
{
UIUtils
.
createInfoLabel
(
panelPlaceholder
,
"Select a debug type to see debug configuration"
);
}
else
{
for
(
Control
c
:
typesGroup
.
getChildren
())
{
if
(
c
instanceof
Button
&&
c
.
getData
()
==
debugPanel
)
{
((
Button
)
c
).
setSelection
(
true
);
break
;
}
}
}
updateLaunchConfigurationDialog
();
}
@Override
...
...
@@ -162,6 +206,7 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
@Override
public
void
initializeFrom
(
ILaunchConfiguration
configuration
)
{
this
.
currentConfiguration
=
configuration
;
try
{
String
dsId
=
configuration
.
getAttribute
(
DBGConstants
.
ATTR_DATASOURCE_ID
,
(
String
)
null
);
DataSourceDescriptor
dataSource
=
DataSourceRegistry
.
findDataSource
(
dsId
);
...
...
@@ -169,42 +214,20 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
if
(
dataSource
!=
null
)
{
driverText
.
setText
(
dataSource
.
getDriver
().
getFullName
());
}
oidText
.
setText
(
configuration
.
getAttribute
(
DBGConstants
.
ATTR_PROCEDURE_OID
,
""
));
nameText
.
setText
(
configuration
.
getAttribute
(
DBGConstants
.
ATTR_PROCEDURE_NAME
,
""
));
processText
.
setText
(
configuration
.
getAttribute
(
DBGConstants
.
ATTR_ATTACH_PROCESS
,
""
));
String
extracted
=
configuration
.
getAttribute
(
DBGConstants
.
ATTR_ATTACH_KIND
,
(
String
)
null
);
if
(
DBGController
.
ATTACH_KIND_GLOBAL
.
equals
(
extracted
))
{
attachGlobal
.
setSelection
(
true
);
attachLocal
.
setSelection
(
false
);
}
else
{
attachGlobal
.
setSelection
(
false
);
attachLocal
.
setSelection
(
true
);
loadConnectionDebugTypes
();
String
typeId
=
configuration
.
getAttribute
(
DBGConstants
.
ATTR_DEBUG_TYPE
,
(
String
)
null
);
DebugConfigurationPanelDescriptor
savedPanel
=
null
;
if
(
typeId
!=
null
)
{
savedPanel
=
DebugConfigurationPanelRegistry
.
getInstance
().
getPanel
(
typeId
);
if
(
savedPanel
==
null
)
{
setWarningMessage
(
"Debug type '"
+
typeId
+
"' cannot be resolved"
);
}
}
handleAttachKind
(
extracted
);
scriptText
.
setText
(
configuration
.
getAttribute
(
DBGConstants
.
ATTR_SCRIPT_TEXT
,
""
));
setDebugType
(
dataSource
,
savedPanel
);
}
catch
(
CoreException
e
)
{
e
.
printStackTrace
();
}
}
void
handleAttachKind
(
String
attachKind
)
{
if
(
DBGController
.
ATTACH_KIND_GLOBAL
.
equals
(
attachKind
))
{
processText
.
setEditable
(
true
);
scriptText
.
setEnabled
(
false
);
}
else
{
processText
.
setText
(
""
);
processText
.
setEditable
(
false
);
scriptText
.
setEnabled
(
true
);
setWarningMessage
(
"Error loading debug configuration: "
+
e
.
getMessage
());
}
updateLaunchConfigurationDialog
();
}
...
...
@@ -234,12 +257,22 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
public
void
performApply
(
ILaunchConfigurationWorkingCopy
configuration
)
{
DBPDataSourceContainer
dataSource
=
connectionCombo
.
getSelectedItem
();
configuration
.
setAttribute
(
DBGConstants
.
ATTR_DATASOURCE_ID
,
dataSource
==
null
?
null
:
dataSource
.
getId
());
configuration
.
setAttribute
(
DBGConstants
.
ATTR_PROCEDURE_OID
,
oidText
.
getText
());
configuration
.
setAttribute
(
DBGConstants
.
ATTR_PROCEDURE_NAME
,
nameText
.
getText
());
configuration
.
setAttribute
(
DBGConstants
.
ATTR_ATTACH_PROCESS
,
processText
.
getText
());
Widget
kind
=
attachGlobal
.
getSelection
()
?
attachGlobal
:
attachLocal
;
configuration
.
setAttribute
(
DBGConstants
.
ATTR_ATTACH_KIND
,
String
.
valueOf
(
kind
.
getData
()));
configuration
.
setAttribute
(
DBGConstants
.
ATTR_SCRIPT_TEXT
,
scriptText
.
getText
());
configuration
.
setAttribute
(
DBGConstants
.
ATTR_DEBUG_TYPE
,
selectedDebugType
==
null
?
null
:
selectedDebugType
.
getId
());
if
(
selectedDebugPanel
!=
null
)
{
Map
<
String
,
Object
>
attrs
=
new
HashMap
<>();
selectedDebugPanel
.
saveConfiguration
(
dataSource
,
attrs
);
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
attrs
.
entrySet
())
{
if
(
entry
.
getValue
()
==
null
)
{
configuration
.
removeAttribute
(
entry
.
getKey
());
}
else
if
(
entry
.
getValue
()
instanceof
Integer
)
{
configuration
.
setAttribute
(
entry
.
getKey
(),
(
Integer
)
entry
.
getValue
());
}
else
if
(
entry
.
getValue
()
instanceof
Boolean
)
{
configuration
.
setAttribute
(
entry
.
getKey
(),
(
Boolean
)
entry
.
getValue
());
}
else
{
configuration
.
setAttribute
(
entry
.
getKey
(),
entry
.
getValue
().
toString
());
}
}
}
}
@Override
...
...
@@ -247,4 +280,13 @@ public class DatabaseDebugConfigurationTab extends AbstractLaunchConfigurationTa
return
DebugUIMessages
.
DatabaseTab_name
;
}
@Override
public
boolean
isValid
(
ILaunchConfiguration
launchConfig
)
{
return
connectionCombo
.
getSelectedItem
()
!=
null
&&
selectedDebugType
!=
null
&&
selectedDebugPanel
.
isValid
();
}
@Override
public
boolean
canSave
()
{
return
connectionCombo
.
getSelectedItem
()
!=
null
&&
selectedDebugType
!=
null
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/plugin.xml
浏览文件 @
7e7003de
...
...
@@ -26,6 +26,11 @@
class=
"org.jkiss.dbeaver.ext.postgresql.debug.ui.internal.PostgreDebugPanelFunction"
>
<datasource
id=
"postgresql"
/>
</panel>
<panel
id=
"org.jkiss.dbeaver.ext.postgresql.debug.triggerPanel"
name=
"Trigger"
description=
"PL/pgSQL table trigger"
>
<datasource
id=
"postgresql"
/>
</panel>
</extension>
<extension
point=
"org.eclipse.debug.ui.launchShortcuts"
>
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.ui/src/org/jkiss/dbeaver/ext/postgresql/debug/ui/internal/PostgreDebugPanelFunction.java
浏览文件 @
7e7003de
...
...
@@ -18,25 +18,36 @@
package
org.jkiss.dbeaver.ext.postgresql.debug.ui.internal
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.jkiss.dbeaver.debug.ui.DBGConfigurationPanel
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
java.util.Map
;
public
class
PostgreDebugPanelFunction
implements
DBGConfigurationPanel
{
@Override
public
void
createPanel
(
Composite
parent
)
{
Button
kindLocal
=
new
Button
(
parent
,
SWT
.
RADIO
);
kindLocal
.
setText
(
"Local"
);
Button
kindGlobal
=
new
Button
(
parent
,
SWT
.
RADIO
);
kindGlobal
.
setText
(
"Global"
);
}
@Override
public
void
loadConfiguration
(
DBPDataSourceContainer
dataSource
,
ILaunchConfiguration
configuration
)
{
public
void
loadConfiguration
(
DBPDataSourceContainer
dataSource
,
Map
<
String
,
Object
>
configuration
)
{
}
@Override
public
void
saveConfiguration
(
DBPDataSourceContainer
dataSource
,
ILaunchConfiguration
configuration
)
{
public
void
saveConfiguration
(
DBPDataSourceContainer
dataSource
,
Map
<
String
,
Object
>
configuration
)
{
}
@Override
public
boolean
isValid
()
{
return
false
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录