Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
0e345be6
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,发现更多精彩内容 >>
提交
0e345be6
编写于
12月 04, 2017
作者:
S
Sergei.Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2597 Copy driver + driver manager dialog enhancements
Former-commit-id:
e529476f
上级
dcd29fd6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
112 addition
and
46 deletion
+112
-46
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
...dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
....core/src/org/jkiss/dbeaver/core/CoreResources.properties
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceProviderDescriptor.java
.../jkiss/dbeaver/registry/DataSourceProviderDescriptor.java
+13
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
...c/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
+40
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverFileSource.java
...c/org/jkiss/dbeaver/registry/driver/DriverFileSource.java
+7
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
...org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
+21
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverManagerDialog.java
.../jkiss/dbeaver/ui/dialogs/driver/DriverManagerDialog.java
+29
-40
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
浏览文件 @
0e345be6
...
...
@@ -348,6 +348,7 @@ public class CoreMessages extends NLS {
public
static
String
dialog_driver_manager_button_delete
;
public
static
String
dialog_driver_manager_button_edit
;
public
static
String
dialog_driver_manager_button_new
;
public
static
String
dialog_driver_manager_button_copy
;
public
static
String
dialog_driver_manager_label_unavailable
;
public
static
String
dialog_driver_manager_label_user_defined
;
public
static
String
dialog_driver_manager_message_cant_delete_text
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
浏览文件 @
0e345be6
...
...
@@ -407,6 +407,7 @@ dialog_data_label_value = Value:
dialog_driver_manager_button_delete
=
&Delete
dialog_driver_manager_button_edit
=
&Edit ...
dialog_driver_manager_button_new
=
&New
dialog_driver_manager_button_copy
=
&Copy
dialog_driver_manager_label_unavailable
=
- Unavailable
dialog_driver_manager_label_user_defined
=
- User defined
dialog_driver_manager_message_cant_delete_text
=
Your can''t delete driver "{0}" because it''s used by following datasource(s):
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceProviderDescriptor.java
浏览文件 @
0e345be6
...
...
@@ -266,6 +266,11 @@ public class DataSourceProviderDescriptor extends AbstractDescriptor
return
new
DriverDescriptor
(
this
,
id
);
}
public
DriverDescriptor
createDriver
(
DriverDescriptor
copyFrom
)
{
return
new
DriverDescriptor
(
this
,
SecurityUtils
.
generateGUID
(
false
),
copyFrom
);
}
public
void
addDriver
(
DriverDescriptor
driver
)
{
this
.
drivers
.
add
(
driver
);
...
...
@@ -483,4 +488,12 @@ public class DataSourceProviderDescriptor extends AbstractDescriptor
}
public
DriverDescriptor
getDriverByName
(
String
category
,
String
name
)
{
for
(
DriverDescriptor
driver
:
drivers
)
{
if
(
CommonUtils
.
equalObjects
(
category
,
driver
.
getCategory
())
&&
CommonUtils
.
equalObjects
(
name
,
driver
.
getName
()))
{
return
driver
;
}
}
return
null
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
浏览文件 @
0e345be6
...
...
@@ -168,22 +168,56 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
// New driver constructor
public
DriverDescriptor
(
DataSourceProviderDescriptor
providerDescriptor
,
String
id
)
public
DriverDescriptor
(
DataSourceProviderDescriptor
providerDescriptor
,
String
id
)
{
this
(
providerDescriptor
,
id
,
null
);
}
public
DriverDescriptor
(
DataSourceProviderDescriptor
providerDescriptor
,
String
id
,
DriverDescriptor
copyFrom
)
{
super
(
providerDescriptor
.
getPluginId
());
this
.
providerDescriptor
=
providerDescriptor
;
this
.
id
=
id
;
this
.
custom
=
true
;
this
.
iconPlain
=
providerDescriptor
.
getIcon
();
if
(
this
.
iconPlain
==
null
)
{
this
.
iconPlain
=
DBIcon
.
TREE_DATABASE
;
}
makeIconExtensions
();
this
.
origName
=
null
;
this
.
origDescription
=
null
;
this
.
origClassName
=
null
;
this
.
origDefaultPort
=
null
;
this
.
origSampleURL
=
null
;
this
.
iconPlain
=
providerDescriptor
.
getIcon
();
if
(
this
.
iconPlain
==
null
)
{
this
.
iconPlain
=
DBIcon
.
TREE_DATABASE
;
}
makeIconExtensions
();
if
(
copyFrom
!=
null
)
{
// Copy props from source
this
.
category
=
copyFrom
.
category
;
this
.
name
=
copyFrom
.
name
;
this
.
description
=
copyFrom
.
description
;
this
.
driverClassName
=
copyFrom
.
driverClassName
;
this
.
driverDefaultPort
=
copyFrom
.
driverDefaultPort
;
this
.
sampleURL
=
copyFrom
.
sampleURL
;
this
.
webURL
=
copyFrom
.
webURL
;
this
.
embedded
=
copyFrom
.
embedded
;
this
.
clientRequired
=
copyFrom
.
clientRequired
;
this
.
supportsDriverProperties
=
copyFrom
.
supportsDriverProperties
;
this
.
anonymousAccess
=
copyFrom
.
anonymousAccess
;
this
.
customDriverLoader
=
copyFrom
.
customDriverLoader
;
this
.
clientHomeIds
.
addAll
(
copyFrom
.
clientHomeIds
);
for
(
DriverFileSource
fs
:
copyFrom
.
fileSources
)
{
this
.
fileSources
.
add
(
new
DriverFileSource
(
fs
));
}
this
.
libraries
.
addAll
(
copyFrom
.
libraries
);
this
.
connectionPropertyDescriptors
.
addAll
(
copyFrom
.
connectionPropertyDescriptors
);
this
.
defaultParameters
.
putAll
(
copyFrom
.
defaultParameters
);
this
.
customParameters
.
putAll
(
copyFrom
.
customParameters
);
this
.
defaultConnectionProperties
.
putAll
(
copyFrom
.
defaultConnectionProperties
);
this
.
customConnectionProperties
.
putAll
(
copyFrom
.
customConnectionProperties
);
}
}
// Predefined driver constructor
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverFileSource.java
浏览文件 @
0e345be6
...
...
@@ -69,6 +69,13 @@ public class DriverFileSource
}
}
public
DriverFileSource
(
DriverFileSource
copyFrom
)
{
this
.
url
=
copyFrom
.
url
;
this
.
name
=
copyFrom
.
name
;
this
.
instructions
=
copyFrom
.
instructions
;
this
.
files
.
addAll
(
copyFrom
.
files
);
}
public
String
getUrl
()
{
return
url
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
浏览文件 @
0e345be6
...
...
@@ -123,6 +123,20 @@ public class DriverEditDialog extends HelpEnabledDialog {
this
.
origLibList
=
new
ArrayList
<>();
}
public
DriverEditDialog
(
Shell
shell
,
DataSourceProviderDescriptor
provider
,
DriverDescriptor
driver
)
{
super
(
shell
,
IHelpContextIds
.
CTX_DRIVER_EDITOR
);
this
.
provider
=
provider
;
this
.
driver
=
provider
.
createDriver
(
driver
);
this
.
defaultCategory
=
driver
.
getCategory
();
this
.
newDriver
=
true
;
this
.
origLibList
=
new
ArrayList
<>();
}
public
DriverDescriptor
getDriver
()
{
return
driver
;
}
public
int
open
(
boolean
addFiles
)
{
this
.
showAddFiles
=
addFiles
;
return
open
();
...
...
@@ -766,6 +780,7 @@ public class DriverEditDialog extends HelpEnabledDialog {
@Override
protected
void
okPressed
()
{
// Set props
driver
.
setName
(
driverNameText
.
getText
());
driver
.
setCategory
(
driverCategoryCombo
.
getText
());
...
...
@@ -785,6 +800,12 @@ public class DriverEditDialog extends HelpEnabledDialog {
driver
.
setClientHomeIds
(
clientHomesPanel
.
getHomeIds
());
}
DriverDescriptor
oldDriver
=
provider
.
getDriverByName
(
driver
.
getCategory
(),
driver
.
getName
());
if
(
oldDriver
!=
null
&&
oldDriver
!=
driver
)
{
UIUtils
.
showMessageBox
(
getShell
(),
"Driver create"
,
"Driver '"
+
driver
.
getName
()
+
"' already exists. Change driver name"
,
SWT
.
ICON_ERROR
);
return
;
}
// Finish
if
(
provider
.
getDriver
(
driver
.
getId
())
==
null
)
{
provider
.
addDriver
(
driver
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverManagerDialog.java
浏览文件 @
0e345be6
...
...
@@ -21,6 +21,7 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import
org.eclipse.jface.viewers.*
;
import
org.eclipse.osgi.util.NLS
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.events.SelectionListener
;
import
org.eclipse.swt.graphics.Image
;
...
...
@@ -55,6 +56,7 @@ public class DriverManagerDialog extends HelpEnabledDialog implements ISelection
private
DriverDescriptor
selectedDriver
;
private
Button
newButton
;
private
Button
copyButton
;
private
Button
editButton
;
private
Button
deleteButton
;
private
DriverTreeControl
treeControl
;
...
...
@@ -115,65 +117,39 @@ public class DriverManagerDialog extends HelpEnabledDialog implements ISelection
Composite
buttonBar
=
new
Composite
(
group
,
SWT
.
TOP
);
buttonBar
.
setLayout
(
new
GridLayout
(
1
,
false
));
GridData
gd
=
new
GridData
(
GridData
.
FILL_VERTICAL
);
gd
.
minimumWidth
=
100
;
buttonBar
.
setLayoutData
(
gd
);
newButton
=
new
Button
(
buttonBar
,
SWT
.
FLAT
|
SWT
.
PUSH
);
newButton
.
setText
(
CoreMessages
.
dialog_driver_manager_button_new
);
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
widthHint
=
100
;
newButton
.
setLayoutData
(
gd
);
newButton
.
addSelectionListener
(
new
SelectionListener
()
{
newButton
=
UIUtils
.
createPushButton
(
buttonBar
,
CoreMessages
.
dialog_driver_manager_button_new
,
null
,
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
public
void
widgetSelected
(
SelectionEvent
e
)
{
createDriver
();
}
});
newButton
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
copyButton
=
UIUtils
.
createPushButton
(
buttonBar
,
CoreMessages
.
dialog_driver_manager_button_copy
,
null
,
new
SelectionAdapter
()
{
@Override
public
void
widget
DefaultSelected
(
SelectionEvent
e
)
{
public
void
widget
Selected
(
SelectionEvent
e
)
{
copyDriver
();
}
});
copyButton
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
editButton
=
new
Button
(
buttonBar
,
SWT
.
FLAT
|
SWT
.
PUSH
);
editButton
.
setText
(
CoreMessages
.
dialog_driver_manager_button_edit
);
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
widthHint
=
100
;
editButton
.
setLayoutData
(
gd
);
editButton
.
addSelectionListener
(
new
SelectionListener
()
{
editButton
=
UIUtils
.
createPushButton
(
buttonBar
,
CoreMessages
.
dialog_driver_manager_button_edit
,
null
,
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
public
void
widgetSelected
(
SelectionEvent
e
)
{
editDriver
();
}
@Override
public
void
widgetDefaultSelected
(
SelectionEvent
e
)
{
}
});
editButton
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
deleteButton
=
new
Button
(
buttonBar
,
SWT
.
FLAT
|
SWT
.
PUSH
);
deleteButton
.
setText
(
CoreMessages
.
dialog_driver_manager_button_delete
);
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
widthHint
=
100
;
deleteButton
.
setLayoutData
(
gd
);
deleteButton
.
addSelectionListener
(
new
SelectionListener
()
{
deleteButton
=
UIUtils
.
createPushButton
(
buttonBar
,
CoreMessages
.
dialog_driver_manager_button_delete
,
null
,
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
public
void
widgetSelected
(
SelectionEvent
e
)
{
deleteDriver
();
}
@Override
public
void
widgetDefaultSelected
(
SelectionEvent
e
)
{
}
});
deleteButton
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
{
final
Composite
legend
=
UIUtils
.
createPlaceholder
(
buttonBar
,
2
,
5
);
...
...
@@ -271,6 +247,7 @@ public class DriverManagerDialog extends HelpEnabledDialog implements ISelection
private
void
updateButtons
()
{
newButton
.
setEnabled
(
onlyManagableProvider
!=
null
||
(
selectedProvider
!=
null
&&
selectedProvider
.
isDriversManagable
()));
copyButton
.
setEnabled
(
selectedDriver
!=
null
&&
selectedDriver
.
isManagable
());
editButton
.
setEnabled
(
selectedDriver
!=
null
);
deleteButton
.
setEnabled
(
selectedDriver
!=
null
&&
selectedDriver
.
getProviderDescriptor
().
isDriversManagable
());
...
...
@@ -307,6 +284,18 @@ public class DriverManagerDialog extends HelpEnabledDialog implements ISelection
DriverEditDialog
dialog
=
new
DriverEditDialog
(
getShell
(),
provider
,
selectedCategory
);
if
(
dialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
treeControl
.
getViewer
().
refresh
();
treeControl
.
getViewer
().
setSelection
(
new
StructuredSelection
(
dialog
.
getDriver
()));
}
}
}
private
void
copyDriver
()
{
if
(
selectedDriver
!=
null
)
{
DriverEditDialog
dialog
=
new
DriverEditDialog
(
getShell
(),
selectedDriver
.
getProviderDescriptor
(),
selectedDriver
);
if
(
dialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
treeControl
.
getViewer
().
refresh
();
treeControl
.
getViewer
().
setSelection
(
new
StructuredSelection
(
dialog
.
getDriver
()));
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录