Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
6422df6a
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,发现更多精彩内容 >>
提交
6422df6a
编写于
9月 12, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Driver files download wizard
上级
4d3cbdc6
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
276 addition
and
52 deletion
+276
-52
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverClassLoader.java
...ore/src/org/jkiss/dbeaver/registry/DriverClassLoader.java
+3
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverDescriptor.java
...core/src/org/jkiss/dbeaver/registry/DriverDescriptor.java
+28
-18
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileDescriptor.java
.../src/org/jkiss/dbeaver/registry/DriverFileDescriptor.java
+4
-8
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileSource.java
...core/src/org/jkiss/dbeaver/registry/DriverFileSource.java
+2
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectExportWizard.java
.../org/jkiss/dbeaver/tools/project/ProjectExportWizard.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectImportWizard.java
.../org/jkiss/dbeaver/tools/project/ProjectImportWizard.java
+4
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
...iss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
+67
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
...jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
+57
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
...jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
+75
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
...org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
+9
-11
plugins/org.jkiss.dbeaver.ext.import-config/src/org/jkiss/dbeaver/ext/import_config/wizards/ConfigImportWizard.java
...dbeaver/ext/import_config/wizards/ConfigImportWizard.java
+2
-2
plugins/org.jkiss.dbeaver.ext.wmi/src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
.../src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver.java
....dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver.java
+6
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriverFile.java
...aver.model/src/org/jkiss/dbeaver/model/DBPDriverFile.java
+16
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverClassLoader.java
浏览文件 @
6422df6a
...
...
@@ -18,7 +18,7 @@
package
org.jkiss.dbeaver.registry
;
import
org.jkiss.dbeaver.model.DBPDriverFile
Type
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.File
;
...
...
@@ -43,8 +43,8 @@ public class DriverClassLoader extends URLClassLoader
protected
String
findLibrary
(
String
libname
)
{
String
nativeName
=
System
.
mapLibraryName
(
libname
);
for
(
DriverFileDescriptor
driverFile
:
driver
.
getFiles
())
{
if
(
driverFile
.
getType
()
==
DBPDriverFileType
.
lib
&&
driverFile
.
matchesCurrentPlatform
())
{
for
(
DriverFileDescriptor
driverFile
:
driver
.
get
Driver
Files
())
{
if
(
driverFile
.
getType
()
==
DBPDriverFile
.
File
Type
.
lib
&&
driverFile
.
matchesCurrentPlatform
())
{
final
File
localFile
=
driverFile
.
getLocalFile
();
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
final
String
fileName
=
localFile
.
getName
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverDescriptor.java
浏览文件 @
6422df6a
...
...
@@ -25,6 +25,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import
org.eclipse.swt.program.Program
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Shell
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.Log
;
...
...
@@ -43,6 +44,7 @@ import org.jkiss.dbeaver.model.runtime.OSDescriptor;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.AcceptLicenseDialog
;
import
org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog
;
import
org.jkiss.dbeaver.ui.dialogs.driver.DriverDownloadDialog
;
import
org.jkiss.dbeaver.ui.dialogs.driver.DriverEditDialog
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
...
...
@@ -639,13 +641,14 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
clientHomeIds
.
add
(
homeId
);
}
@NotNull
@Override
public
Collection
<
DriverFileDescriptor
>
getFiles
()
public
Collection
<
DriverFileDescriptor
>
get
Driver
Files
()
{
return
files
;
}
public
DriverFileDescriptor
get
Library
(
String
path
)
public
DriverFileDescriptor
get
DriverFile
(
String
path
)
{
for
(
DriverFileDescriptor
lib
:
files
)
{
if
(
lib
.
getPath
().
equals
(
path
))
{
...
...
@@ -655,7 +658,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return
null
;
}
public
DriverFileDescriptor
add
Library
(
String
path
,
DBPDriver
FileType
fileType
)
public
DriverFileDescriptor
add
DriverFile
(
String
path
,
DBPDriverFile
.
FileType
fileType
)
{
for
(
DriverFileDescriptor
lib
:
files
)
{
if
(
lib
.
getPath
().
equals
(
path
))
{
...
...
@@ -663,11 +666,11 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
}
DriverFileDescriptor
lib
=
new
DriverFileDescriptor
(
this
,
fileType
,
path
);
add
Library
(
lib
);
add
DriverFile
(
lib
);
return
lib
;
}
public
boolean
add
Library
(
DriverFileDescriptor
descriptor
)
public
boolean
add
DriverFile
(
DriverFileDescriptor
descriptor
)
{
if
(!
files
.
contains
(
descriptor
))
{
this
.
files
.
add
(
descriptor
);
...
...
@@ -677,7 +680,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return
false
;
}
public
boolean
remove
Library
(
DriverFileDescriptor
lib
)
public
boolean
remove
DriverFile
(
DriverFileDescriptor
lib
)
{
if
(!
lib
.
isCustom
())
{
lib
.
setDisabled
(
true
);
...
...
@@ -702,6 +705,11 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return
result
;
}
@NotNull
public
List
<
DriverFileSource
>
getDriverFileSources
()
{
return
fileSources
;
}
@Override
public
Collection
<
DriverPathDescriptor
>
getPathList
()
{
...
...
@@ -799,7 +807,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
public
String
getLicense
()
{
for
(
DriverFileDescriptor
file
:
files
)
{
if
(
file
.
getType
()
==
DBPDriverFileType
.
license
)
{
if
(
file
.
getType
()
==
DBPDriverFile
.
File
Type
.
license
)
{
final
File
licenseFile
=
file
.
getLocalFile
();
if
(
licenseFile
!=
null
&&
licenseFile
.
exists
())
{
try
{
...
...
@@ -874,7 +882,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
List
<
URL
>
libraryURLs
=
new
ArrayList
<
URL
>();
// Load libraries
for
(
DriverFileDescriptor
file
:
files
)
{
if
(
file
.
isDisabled
()
||
file
.
getType
()
!=
DBPDriverFileType
.
jar
)
{
if
(
file
.
isDisabled
()
||
file
.
getType
()
!=
DBPDriverFile
.
File
Type
.
jar
)
{
continue
;
}
File
localFile
=
file
.
getLocalFile
();
...
...
@@ -984,8 +992,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
private
boolean
acceptDriverLicenses
(
DBRRunnableContext
runnableContext
)
{
// User must accept all licenses before actual drivers download
for
(
final
DriverFileDescriptor
file
:
getFiles
())
{
if
(
file
.
getType
()
==
DBPDriverFileType
.
license
)
{
for
(
final
DriverFileDescriptor
file
:
get
Driver
Files
())
{
if
(
file
.
getType
()
==
DBPDriverFile
.
File
Type
.
license
)
{
final
File
libraryFile
=
file
.
getLocalFile
();
if
(
libraryFile
==
null
||
!
libraryFile
.
exists
())
{
try
{
...
...
@@ -1050,7 +1058,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
// User just canceled download
return
IDialogConstants
.
CANCEL_ID
;
}
catch
(
InvocationTargetException
e
)
{
if
(
file
.
getType
()
==
DBPDriverFileType
.
license
)
{
if
(
file
.
getType
()
==
DBPDriverFile
.
File
Type
.
license
)
{
return
IDialogConstants
.
OK_ID
;
}
DownloadRetry
retryConfirm
=
new
DownloadRetry
(
file
,
e
.
getTargetException
());
...
...
@@ -1124,7 +1132,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
// Libraries
for
(
DriverFileDescriptor
lib
:
this
.
getFiles
())
{
for
(
DriverFileDescriptor
lib
:
this
.
get
Driver
Files
())
{
if
((
export
&&
!
lib
.
isDisabled
())
||
lib
.
isCustom
()
||
lib
.
isDisabled
())
{
xml
.
startElement
(
RegistryConstants
.
TAG_LIBRARY
);
xml
.
addAttribute
(
RegistryConstants
.
ATTR_TYPE
,
lib
.
getType
().
name
());
...
...
@@ -1296,25 +1304,25 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
log
.
warn
(
"File outside of driver"
);
return
;
}
DBPDriverFileType
type
;
DBPDriverFile
.
File
Type
type
;
String
typeStr
=
atts
.
getValue
(
RegistryConstants
.
ATTR_TYPE
);
if
(
CommonUtils
.
isEmpty
(
typeStr
))
{
type
=
DBPDriverFileType
.
jar
;
type
=
DBPDriverFile
.
File
Type
.
jar
;
}
else
{
try
{
type
=
DBPDriverFileType
.
valueOf
(
typeStr
);
type
=
DBPDriverFile
.
File
Type
.
valueOf
(
typeStr
);
}
catch
(
IllegalArgumentException
e
)
{
log
.
warn
(
e
);
type
=
DBPDriverFileType
.
jar
;
type
=
DBPDriverFile
.
File
Type
.
jar
;
}
}
String
path
=
atts
.
getValue
(
RegistryConstants
.
ATTR_PATH
);
DriverFileDescriptor
lib
=
curDriver
.
get
Library
(
path
);
DriverFileDescriptor
lib
=
curDriver
.
get
DriverFile
(
path
);
String
disabledAttr
=
atts
.
getValue
(
RegistryConstants
.
ATTR_DISABLED
);
if
(
lib
!=
null
&&
CommonUtils
.
getBoolean
(
disabledAttr
))
{
lib
.
setDisabled
(
true
);
}
else
if
(
lib
==
null
)
{
curDriver
.
add
Library
(
path
,
type
);
curDriver
.
add
DriverFile
(
path
,
type
);
}
}
else
if
(
localName
.
equals
(
RegistryConstants
.
TAG_CLIENT_HOME
))
{
curDriver
.
addClientHomeId
(
atts
.
getValue
(
RegistryConstants
.
ATTR_ID
));
...
...
@@ -1519,6 +1527,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
@Override
public
void
run
()
{
DriverDownloadDialog
downloadDialog
=
new
DriverDownloadDialog
(
DBeaverUI
.
getActiveWorkbenchWindow
(),
DriverDescriptor
.
this
);
downloadDialog
.
open
();
proceed
=
ConfirmationDialog
.
showConfirmDialog
(
null
,
DBeaverPreferences
.
CONFIRM_DRIVER_DOWNLOAD
,
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileDescriptor.java
浏览文件 @
6422df6a
...
...
@@ -21,12 +21,9 @@ import org.eclipse.core.runtime.FileLocator;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.model.DBPDriverFileType
;
import
org.jkiss.dbeaver.model.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.OSDescriptor
;
import
org.jkiss.dbeaver.registry.maven.MavenArtifact
;
...
...
@@ -35,7 +32,6 @@ import org.jkiss.dbeaver.registry.maven.MavenLocalVersion;
import
org.jkiss.dbeaver.registry.maven.MavenRegistry
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.*
;
import
java.net.*
;
...
...
@@ -53,7 +49,7 @@ public class DriverFileDescriptor implements DBPDriverFile
public
static
final
String
FILE_SOURCE_PLATFORM
=
"platform:/"
;
private
final
DriverDescriptor
driver
;
private
final
DBPDriver
FileType
type
;
private
final
FileType
type
;
private
final
OSDescriptor
system
;
private
String
path
;
private
String
fileExtension
;
...
...
@@ -61,7 +57,7 @@ public class DriverFileDescriptor implements DBPDriverFile
private
boolean
custom
;
private
boolean
disabled
;
public
DriverFileDescriptor
(
DriverDescriptor
driver
,
DBPDriver
FileType
type
,
String
path
)
public
DriverFileDescriptor
(
DriverDescriptor
driver
,
FileType
type
,
String
path
)
{
this
.
driver
=
driver
;
this
.
type
=
type
;
...
...
@@ -73,7 +69,7 @@ public class DriverFileDescriptor implements DBPDriverFile
DriverFileDescriptor
(
DriverDescriptor
driver
,
IConfigurationElement
config
)
{
this
.
driver
=
driver
;
this
.
type
=
DBPDriver
FileType
.
valueOf
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_TYPE
));
this
.
type
=
FileType
.
valueOf
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_TYPE
));
String
osName
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_OS
);
this
.
system
=
osName
==
null
?
null
:
new
OSDescriptor
(
...
...
@@ -91,7 +87,7 @@ public class DriverFileDescriptor implements DBPDriverFile
}
@Override
public
DBPDriver
FileType
getType
()
public
FileType
getType
()
{
return
type
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileSource.java
浏览文件 @
6422df6a
...
...
@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.registry;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -26,7 +27,7 @@ import java.util.List;
/**
* DriverFileSource
*/
public
class
DriverFileSource
public
class
DriverFileSource
implements
DBPDriverFile
.
FileSource
{
static
final
Log
log
=
Log
.
getLog
(
DriverFileSource
.
class
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectExportWizard.java
浏览文件 @
6422df6a
...
...
@@ -182,7 +182,7 @@ public class ProjectExportWizard extends Wizard implements IExportWizard {
Set
<
File
>
libFiles
=
new
HashSet
<
File
>();
Map
<
String
,
File
>
libPathMap
=
new
HashMap
<
String
,
File
>();
for
(
DriverDescriptor
driver
:
exportData
.
usedDrivers
)
{
for
(
DriverFileDescriptor
fileDescriptor
:
driver
.
getFiles
())
{
for
(
DriverFileDescriptor
fileDescriptor
:
driver
.
get
Driver
Files
())
{
final
File
libraryFile
=
fileDescriptor
.
getLocalFile
();
if
(
libraryFile
!=
null
&&
!
fileDescriptor
.
isDisabled
()
&&
libraryFile
.
exists
())
{
libFiles
.
add
(
libraryFile
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectImportWizard.java
浏览文件 @
6422df6a
...
...
@@ -29,7 +29,7 @@ import org.eclipse.ui.IWorkbench;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDriverFile
Type
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.registry.*
;
...
...
@@ -270,7 +270,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
}
// Add libraries (only for managable drivers with empty library list)
if
(
CommonUtils
.
isEmpty
(
driver
.
getFiles
()))
{
if
(
CommonUtils
.
isEmpty
(
driver
.
get
Driver
Files
()))
{
List
<
String
>
libraryList
=
new
ArrayList
<
String
>();
for
(
Element
libElement
:
XMLUtils
.
getChildElementList
(
driverElement
,
RegistryConstants
.
TAG_FILE
))
{
libraryList
.
add
(
libElement
.
getAttribute
(
RegistryConstants
.
ATTR_PATH
));
...
...
@@ -280,7 +280,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
File
libFile
=
new
File
(
libPath
);
if
(
libFile
.
exists
())
{
// Just use path as-is (may be it is local re-import or local environments equal to export environment)
driver
.
add
Library
(
libPath
,
DBPDriver
FileType
.
jar
);
driver
.
add
DriverFile
(
libPath
,
DBPDriverFile
.
FileType
.
jar
);
}
else
{
// Get driver library from archive
String
archiveLibEntry
=
libMap
.
get
(
libPath
);
...
...
@@ -312,7 +312,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
while
(
relativePath
.
charAt
(
0
)
==
'/'
||
relativePath
.
charAt
(
0
)
==
'\\'
)
{
relativePath
=
relativePath
.
substring
(
1
);
}
driver
.
add
Library
(
relativePath
,
DBPDriver
FileType
.
jar
);
driver
.
add
DriverFile
(
relativePath
,
DBPDriverFile
.
FileType
.
jar
);
}
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
0 → 100644
浏览文件 @
6422df6a
/*
* 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.dialogs.driver
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.wizard.WizardPage
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.registry.DriverFileDescriptor
;
import
org.jkiss.dbeaver.tools.transfer.wizard.DataTransferWizard
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.ActiveWizardPage
;
class
DriverDownloadAutoPage
extends
WizardPage
{
static
final
Log
log
=
Log
.
getLog
(
DriverDownloadAutoPage
.
class
);
DriverDownloadAutoPage
()
{
super
(
"Automatic download"
,
"Download driver files"
,
null
);
setPageComplete
(
false
);
}
@Override
public
void
createControl
(
Composite
parent
)
{
DriverDownloadWizard
wizard
=
(
DriverDownloadWizard
)
getWizard
();
StringBuilder
message
=
new
StringBuilder
();
message
.
append
(
"Download "
).
append
(
wizard
.
getDriver
().
getFullName
()).
append
(
" driver files:\n"
);
for
(
DriverFileDescriptor
file
:
wizard
.
getDriver
().
getDriverFiles
())
{
message
.
append
(
"\t-"
).
append
(
file
.
getPath
()).
append
(
"\n"
);
}
initializeDialogUnits
(
parent
);
Composite
composite
=
UIUtils
.
createPlaceholder
(
parent
,
1
);
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
Text
infoText
=
new
Text
(
composite
,
SWT
.
MULTI
|
SWT
.
READ_ONLY
|
SWT
.
WRAP
);
infoText
.
setText
(
message
.
toString
());
infoText
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
setControl
(
composite
);
setMessage
(
"Download "
+
wizard
.
getDriver
().
getFullName
()
+
" driver files"
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.
model/src/org/jkiss/dbeaver/model/DBPDriverFileType
.java
→
plugins/org.jkiss.dbeaver.
core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog
.java
浏览文件 @
6422df6a
...
...
@@ -15,15 +15,43 @@
* 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
;
package
org.jkiss.dbeaver.ui.dialogs.driver
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.wizard.WizardDialog
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.utils.CommonUtils
;
/**
* Driver
file type
* Driver
DownloadDialog
*/
public
enum
DBPDriverFileType
public
class
DriverDownloadDialog
extends
WizardDialog
{
jar
,
lib
,
executable
,
license
public
static
final
int
EDIT_DRIVER_BUTTON_ID
=
2000
;
private
final
DriverDescriptor
driver
;
public
DriverDownloadDialog
(
IWorkbenchWindow
window
,
DriverDescriptor
driver
)
{
super
(
window
.
getShell
(),
new
DriverDownloadWizard
(
driver
));
this
.
driver
=
driver
;
}
@Override
protected
void
createButtonsForButtonBar
(
Composite
parent
)
{
createButton
(
parent
,
EDIT_DRIVER_BUTTON_ID
,
"Edit Driver"
,
false
);
super
.
createButtonsForButtonBar
(
parent
);
Button
finishButton
=
getButton
(
IDialogConstants
.
FINISH_ID
);
if
(
CommonUtils
.
isEmpty
(
driver
.
getDriverFileSources
()))
{
finishButton
.
setText
(
"Download"
);
}
else
{
finishButton
.
setText
(
"Open Download Page"
);
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
0 → 100644
浏览文件 @
6422df6a
/*
* 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.dialogs.driver
;
import
org.eclipse.jface.dialogs.IDialogSettings
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.jface.wizard.Wizard
;
import
org.eclipse.ui.IExportWizard
;
import
org.eclipse.ui.IWorkbench
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.ui.UIUtils
;
public
class
DriverDownloadWizard
extends
Wizard
implements
IExportWizard
{
private
static
final
String
DRIVER_DOWNLOAD_DIALOG_SETTINGS
=
"DriverDownload"
;
//$NON-NLS-1$
private
DriverDescriptor
driver
;
public
DriverDownloadWizard
(
@NotNull
DriverDescriptor
driver
)
{
this
.
driver
=
driver
;
setWindowTitle
(
"Setup driver files"
);
loadSettings
();
}
public
DriverDescriptor
getDriver
()
{
return
driver
;
}
private
void
loadSettings
()
{
IDialogSettings
section
=
UIUtils
.
getDialogSettings
(
DRIVER_DOWNLOAD_DIALOG_SETTINGS
);
setDialogSettings
(
section
);
}
@Override
public
void
addPages
()
{
super
.
addPages
();
addPage
(
new
DriverDownloadAutoPage
());
}
@Override
public
void
init
(
IWorkbench
workbench
,
IStructuredSelection
currentSelection
)
{
setWindowTitle
(
"Driver settings"
);
setNeedsProgressMonitor
(
true
);
setHelpAvailable
(
true
);
}
@Override
public
boolean
canFinish
()
{
return
true
;
}
@Override
public
boolean
performFinish
()
{
return
true
;
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
浏览文件 @
6422df6a
...
...
@@ -37,12 +37,10 @@ import org.eclipse.swt.events.SelectionEvent;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.ISharedImages
;
import
org.eclipse.ui.PlatformUI
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDriverFile
Type
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.registry.DataSourceProviderDescriptor
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverFileDescriptor
;
...
...
@@ -396,7 +394,7 @@ public class DriverEditDialog extends HelpEnabledDialog
libList
.
add
(
new
DriverFileDescriptor
(
driver
,
fileName
.
endsWith
(
".jar"
)
||
fileName
.
endsWith
(
".zip"
)
?
DBPDriverFile
Type
.
jar
:
DBPDriver
FileType
.
lib
,
fileName
.
endsWith
(
".jar"
)
||
fileName
.
endsWith
(
".zip"
)
?
DBPDriverFile
.
FileType
.
jar
:
DBPDriverFile
.
FileType
.
lib
,
new
File
(
folderFile
,
fileName
).
getAbsolutePath
()));
}
changeLibContent
();
...
...
@@ -417,7 +415,7 @@ public class DriverEditDialog extends HelpEnabledDialog
curFolder
=
fd
.
getFilterPath
();
libList
.
add
(
new
DriverFileDescriptor
(
driver
,
DBPDriverFileType
.
jar
,
DBPDriverFile
.
File
Type
.
jar
,
selected
));
changeLibContent
();
}
...
...
@@ -646,8 +644,8 @@ public class DriverEditDialog extends HelpEnabledDialog
if
(
libTable
!=
null
)
{
libList
=
new
ArrayList
<
DriverFileDescriptor
>();
for
(
DriverFileDescriptor
lib
:
driver
.
getFiles
())
{
if
(
lib
.
isDisabled
()
||
(
lib
.
getType
()
!=
DBPDriverFile
Type
.
jar
&&
lib
.
getType
()
!=
DBPDriver
FileType
.
lib
)
||
!
lib
.
matchesCurrentPlatform
())
{
for
(
DriverFileDescriptor
lib
:
driver
.
get
Driver
Files
())
{
if
(
lib
.
isDisabled
()
||
(
lib
.
getType
()
!=
DBPDriverFile
.
FileType
.
jar
&&
lib
.
getType
()
!=
DBPDriverFile
.
FileType
.
lib
)
||
!
lib
.
matchesCurrentPlatform
())
{
continue
;
}
libList
.
add
(
lib
);
...
...
@@ -690,11 +688,11 @@ public class DriverEditDialog extends HelpEnabledDialog
// Set libraries
for
(
DriverFileDescriptor
lib
:
CommonUtils
.
safeCollection
(
libList
))
{
driver
.
add
Library
(
lib
);
driver
.
add
DriverFile
(
lib
);
}
for
(
DriverFileDescriptor
lib
:
CommonUtils
.
copyList
(
driver
.
getFiles
()))
{
for
(
DriverFileDescriptor
lib
:
CommonUtils
.
copyList
(
driver
.
get
Driver
Files
()))
{
if
(!
libList
.
contains
(
lib
))
{
driver
.
remove
Library
(
lib
);
driver
.
remove
DriverFile
(
lib
);
}
}
...
...
@@ -762,7 +760,7 @@ public class DriverEditDialog extends HelpEnabledDialog
java
.
util
.
List
<
URL
>
libURLs
=
new
ArrayList
<
URL
>();
for
(
DriverFileDescriptor
lib
:
libList
)
{
File
libFile
=
lib
.
getLocalFile
();
if
(
libFile
!=
null
&&
libFile
.
exists
()
&&
!
libFile
.
isDirectory
()
&&
lib
.
getType
()
==
DBPDriverFileType
.
jar
)
{
if
(
libFile
!=
null
&&
libFile
.
exists
()
&&
!
libFile
.
isDirectory
()
&&
lib
.
getType
()
==
DBPDriverFile
.
File
Type
.
jar
)
{
libFiles
.
add
(
libFile
);
try
{
libURLs
.
add
(
libFile
.
toURI
().
toURL
());
...
...
plugins/org.jkiss.dbeaver.ext.import-config/src/org/jkiss/dbeaver/ext/import_config/wizards/ConfigImportWizard.java
浏览文件 @
6422df6a
...
...
@@ -25,7 +25,7 @@ import org.eclipse.ui.IWorkbench;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.model.DBPDriverFile
Type
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.registry.*
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.SelectObjectDialog
;
...
...
@@ -122,7 +122,7 @@ public abstract class ConfigImportWizard extends Wizard implements IImportWizard
driver
.
setDescription
(
driverInfo
.
getDescription
());
driver
.
setDriverDefaultPort
(
driverInfo
.
getDefaultPort
());
for
(
String
path
:
driverInfo
.
getLibraries
())
{
driver
.
add
Library
(
path
,
DBPDriver
FileType
.
jar
);
driver
.
add
DriverFile
(
path
,
DBPDriverFile
.
FileType
.
jar
);
}
driver
.
setModified
(
true
);
genericProvider
.
addDriver
(
driver
);
...
...
plugins/org.jkiss.dbeaver.ext.wmi/src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
浏览文件 @
6422df6a
...
...
@@ -79,8 +79,8 @@ public class WMIDataSourceProvider implements DBPDataSourceProvider {
private
void
loadNativeLib
(
DBPDriver
driver
)
throws
DBException
{
for
(
DBPDriverFile
libFile
:
driver
.
getFiles
())
{
if
(
libFile
.
matchesCurrentPlatform
()
&&
libFile
.
getType
()
==
DBPDriverFileType
.
lib
)
{
for
(
DBPDriverFile
libFile
:
driver
.
get
Driver
Files
())
{
if
(
libFile
.
matchesCurrentPlatform
()
&&
libFile
.
getType
()
==
DBPDriverFile
.
File
Type
.
lib
)
{
File
localFile
=
libFile
.
getLocalFile
();
if
(
localFile
!=
null
)
{
try
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver.java
浏览文件 @
6422df6a
...
...
@@ -18,6 +18,7 @@
package
org.jkiss.dbeaver.model
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.navigator.meta.DBXTreeNode
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
...
...
@@ -86,7 +87,11 @@ public interface DBPDriver extends DBPObject
ClassLoader
getClassLoader
();
Collection
<?
extends
DBPDriverFile
>
getFiles
();
@NotNull
Collection
<?
extends
DBPDriverFile
>
getDriverFiles
();
@NotNull
Collection
<?
extends
DBPDriverFile
.
FileSource
>
getDriverFileSources
();
Object
getDriverInstance
(
DBRRunnableContext
runnableContext
)
throws
DBException
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriverFile.java
浏览文件 @
6422df6a
...
...
@@ -28,7 +28,22 @@ import java.io.File;
*/
public
interface
DBPDriverFile
{
DBPDriverFileType
getType
();
/**
* Driver file type
*/
enum
FileType
{
jar
,
lib
,
executable
,
license
}
interface
FileSource
{
}
FileType
getType
();
OSDescriptor
getSystem
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录