Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
b6ea3d7e
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,发现更多精彩内容 >>
提交
b6ea3d7e
编写于
9月 13, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Driver files download wizard
Former-commit-id:
963b351d
上级
68cbad6d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
318 addition
and
149 deletion
+318
-149
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
...iss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
+137
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
...jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
+6
-142
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadManualPage.java
...s/dbeaver/ui/dialogs/driver/DriverDownloadManualPage.java
+121
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadPage.java
...g/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadPage.java
+35
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
...jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
+19
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
浏览文件 @
b6ea3d7e
...
...
@@ -17,7 +17,9 @@
*/
package
org.jkiss.dbeaver.ui.dialogs.driver
;
import
org.eclipse.jface.wizard.WizardPage
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.jface.dialogs.ErrorDialog
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
...
...
@@ -25,19 +27,27 @@ import org.eclipse.swt.layout.GridData;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Link
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverFileDescriptor
;
import
org.jkiss.dbeaver.runtime.RunnableContextDelegate
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.preferences.PrefPageDrivers
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
class
DriverDownloadAutoPage
extends
WizardPage
{
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.List
;
static
final
Log
log
=
Log
.
getLog
(
DriverDownloadAutoPage
.
class
);
class
DriverDownloadAutoPage
extends
DriverDownloadPage
{
DriverDownloadAutoPage
()
{
super
(
"Automatic download"
,
"Download driver files"
,
null
);
...
...
@@ -46,7 +56,7 @@ class DriverDownloadAutoPage extends WizardPage {
@Override
public
void
createControl
(
Composite
parent
)
{
DriverDownloadWizard
wizard
=
(
DriverDownloadWizard
)
getWizard
();
DriverDownloadWizard
wizard
=
getWizard
();
final
DriverDescriptor
driver
=
wizard
.
getDriver
();
setMessage
(
"Download "
+
driver
.
getFullName
()
+
" driver files"
);
...
...
@@ -110,5 +120,126 @@ class DriverDownloadAutoPage extends WizardPage {
setControl
(
composite
);
}
@Override
void
performFinish
()
{
downloadLibraryFiles
(
new
RunnableContextDelegate
(
getContainer
()),
getWizard
().
getFiles
());
}
private
void
downloadLibraryFiles
(
DBRRunnableContext
runnableContext
,
final
List
<
DriverFileDescriptor
>
files
)
{
if
(!
getWizard
().
getDriver
().
acceptDriverLicenses
(
runnableContext
))
{
return
;
}
for
(
int
i
=
0
,
filesSize
=
files
.
size
();
i
<
filesSize
;
)
{
DriverFileDescriptor
lib
=
files
.
get
(
i
);
int
result
=
downloadLibraryFile
(
runnableContext
,
lib
);
switch
(
result
)
{
case
IDialogConstants
.
CANCEL_ID
:
case
IDialogConstants
.
ABORT_ID
:
return
;
case
IDialogConstants
.
RETRY_ID
:
continue
;
case
IDialogConstants
.
OK_ID
:
case
IDialogConstants
.
IGNORE_ID
:
i
++;
break
;
}
}
}
private
int
downloadLibraryFile
(
DBRRunnableContext
runnableContext
,
final
DriverFileDescriptor
file
)
{
try
{
runnableContext
.
run
(
true
,
true
,
new
DBRRunnableWithProgress
()
{
@Override
public
void
run
(
DBRProgressMonitor
monitor
)
throws
InvocationTargetException
,
InterruptedException
{
try
{
file
.
downloadLibraryFile
(
monitor
);
}
catch
(
IOException
e
)
{
throw
new
InvocationTargetException
(
e
);
}
}
});
return
IDialogConstants
.
OK_ID
;
}
catch
(
InterruptedException
e
)
{
// User just canceled download
return
IDialogConstants
.
CANCEL_ID
;
}
catch
(
InvocationTargetException
e
)
{
if
(
file
.
getType
()
==
DBPDriverFile
.
FileType
.
license
)
{
return
IDialogConstants
.
OK_ID
;
}
DownloadRetry
retryConfirm
=
new
DownloadRetry
(
file
,
e
.
getTargetException
());
UIUtils
.
runInUI
(
null
,
retryConfirm
);
return
retryConfirm
.
result
;
}
}
private
class
DownloadRetry
implements
Runnable
{
private
final
DriverFileDescriptor
file
;
private
final
Throwable
error
;
private
int
result
;
public
DownloadRetry
(
DriverFileDescriptor
file
,
Throwable
error
)
{
this
.
file
=
file
;
this
.
error
=
error
;
}
@Override
public
void
run
()
{
DownloadErrorDialog
dialog
=
new
DownloadErrorDialog
(
null
,
file
.
getPath
(),
"Driver file download failed.\nDo you want to retry?"
,
error
);
result
=
dialog
.
open
();
}
}
public
static
class
DownloadErrorDialog
extends
ErrorDialog
{
public
DownloadErrorDialog
(
Shell
parentShell
,
String
dialogTitle
,
String
message
,
Throwable
error
)
{
super
(
parentShell
,
dialogTitle
,
message
,
GeneralUtils
.
makeExceptionStatus
(
error
),
IStatus
.
INFO
|
IStatus
.
WARNING
|
IStatus
.
ERROR
);
}
@Override
protected
void
createButtonsForButtonBar
(
Composite
parent
)
{
createButton
(
parent
,
IDialogConstants
.
ABORT_ID
,
IDialogConstants
.
ABORT_LABEL
,
true
);
createButton
(
parent
,
IDialogConstants
.
RETRY_ID
,
IDialogConstants
.
RETRY_LABEL
,
false
);
createButton
(
parent
,
IDialogConstants
.
IGNORE_ID
,
IDialogConstants
.
IGNORE_LABEL
,
false
);
createDetailsButton
(
parent
);
}
@Override
protected
void
buttonPressed
(
int
buttonId
)
{
if
(
buttonId
==
IDialogConstants
.
DETAILS_ID
)
{
super
.
buttonPressed
(
buttonId
);
}
else
{
setReturnCode
(
buttonId
);
close
();
}
}
}
}
\ No newline at end of file
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
浏览文件 @
b6ea3d7e
...
...
@@ -17,31 +17,17 @@
*/
package
org.jkiss.dbeaver.ui.dialogs.driver
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.jface.dialogs.ErrorDialog
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.wizard.WizardDialog
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverFileDescriptor
;
import
org.jkiss.dbeaver.runtime.RunnableContextDelegate
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.List
;
/**
...
...
@@ -59,11 +45,12 @@ public class DriverDownloadDialog extends WizardDialog
}
DriverDescriptor
getDriver
()
{
return
((
DriverDownloadWizard
)
getWizard
()
).
getDriver
();
return
getWizard
(
).
getDriver
();
}
List
<
DriverFileDescriptor
>
getDriverFiles
()
{
return
((
DriverDownloadWizard
)
getWizard
()).
getFiles
();
@Override
public
DriverDownloadWizard
getWizard
()
{
return
(
DriverDownloadWizard
)
super
.
getWizard
();
}
@Override
...
...
@@ -77,13 +64,7 @@ public class DriverDownloadDialog extends WizardDialog
@Override
protected
Button
createButton
(
Composite
parent
,
int
id
,
String
label
,
boolean
defaultButton
)
{
if
(
id
==
IDialogConstants
.
FINISH_ID
)
{
String
finishText
;
if
(
CommonUtils
.
isEmpty
(
getDriver
().
getDriverFileSources
()))
{
finishText
=
"Download"
;
}
else
{
finishText
=
"Open Download Page"
;
}
Button
button
=
super
.
createButton
(
parent
,
id
,
finishText
,
defaultButton
);
Button
button
=
super
.
createButton
(
parent
,
id
,
getWizard
().
getFinishText
(),
defaultButton
);
button
.
setImage
(
DBeaverIcons
.
getImage
(
UIIcon
.
BROWSER
));
setButtonLayoutData
(
button
);
return
button
;
...
...
@@ -103,7 +84,7 @@ public class DriverDownloadDialog extends WizardDialog
@Override
protected
void
finishPressed
()
{
downloadLibraryFiles
(
new
RunnableContextDelegate
(
this
),
getDriverFiles
()
);
getButton
(
EDIT_DRIVER_BUTTON_ID
).
setEnabled
(
false
);
doDownload
=
true
;
super
.
finishPressed
();
}
...
...
@@ -114,121 +95,4 @@ public class DriverDownloadDialog extends WizardDialog
return
dialog
.
doDownload
;
}
private
void
downloadLibraryFiles
(
DBRRunnableContext
runnableContext
,
final
List
<
DriverFileDescriptor
>
files
)
{
if
(!
getDriver
().
acceptDriverLicenses
(
runnableContext
))
{
return
;
}
for
(
int
i
=
0
,
filesSize
=
files
.
size
();
i
<
filesSize
;
)
{
DriverFileDescriptor
lib
=
files
.
get
(
i
);
int
result
=
downloadLibraryFile
(
runnableContext
,
lib
);
switch
(
result
)
{
case
IDialogConstants
.
CANCEL_ID
:
case
IDialogConstants
.
ABORT_ID
:
return
;
case
IDialogConstants
.
RETRY_ID
:
continue
;
case
IDialogConstants
.
OK_ID
:
case
IDialogConstants
.
IGNORE_ID
:
i
++;
break
;
}
}
}
private
int
downloadLibraryFile
(
DBRRunnableContext
runnableContext
,
final
DriverFileDescriptor
file
)
{
try
{
runnableContext
.
run
(
true
,
true
,
new
DBRRunnableWithProgress
()
{
@Override
public
void
run
(
DBRProgressMonitor
monitor
)
throws
InvocationTargetException
,
InterruptedException
{
try
{
file
.
downloadLibraryFile
(
monitor
);
}
catch
(
IOException
e
)
{
throw
new
InvocationTargetException
(
e
);
}
}
});
return
IDialogConstants
.
OK_ID
;
}
catch
(
InterruptedException
e
)
{
// User just canceled download
return
IDialogConstants
.
CANCEL_ID
;
}
catch
(
InvocationTargetException
e
)
{
if
(
file
.
getType
()
==
DBPDriverFile
.
FileType
.
license
)
{
return
IDialogConstants
.
OK_ID
;
}
DownloadRetry
retryConfirm
=
new
DownloadRetry
(
file
,
e
.
getTargetException
());
UIUtils
.
runInUI
(
null
,
retryConfirm
);
return
retryConfirm
.
result
;
}
}
private
class
DownloadRetry
implements
Runnable
{
private
final
DriverFileDescriptor
file
;
private
final
Throwable
error
;
private
int
result
;
public
DownloadRetry
(
DriverFileDescriptor
file
,
Throwable
error
)
{
this
.
file
=
file
;
this
.
error
=
error
;
}
@Override
public
void
run
()
{
DownloadErrorDialog
dialog
=
new
DownloadErrorDialog
(
null
,
file
.
getPath
(),
"Driver file download failed.\nDo you want to retry?"
,
error
);
result
=
dialog
.
open
();
}
}
public
static
class
DownloadErrorDialog
extends
ErrorDialog
{
public
DownloadErrorDialog
(
Shell
parentShell
,
String
dialogTitle
,
String
message
,
Throwable
error
)
{
super
(
parentShell
,
dialogTitle
,
message
,
GeneralUtils
.
makeExceptionStatus
(
error
),
IStatus
.
INFO
|
IStatus
.
WARNING
|
IStatus
.
ERROR
);
}
@Override
protected
void
createButtonsForButtonBar
(
Composite
parent
)
{
createButton
(
parent
,
IDialogConstants
.
ABORT_ID
,
IDialogConstants
.
ABORT_LABEL
,
true
);
createButton
(
parent
,
IDialogConstants
.
RETRY_ID
,
IDialogConstants
.
RETRY_LABEL
,
false
);
createButton
(
parent
,
IDialogConstants
.
IGNORE_ID
,
IDialogConstants
.
IGNORE_LABEL
,
false
);
createDetailsButton
(
parent
);
}
@Override
protected
void
buttonPressed
(
int
buttonId
)
{
if
(
buttonId
==
IDialogConstants
.
DETAILS_ID
)
{
super
.
buttonPressed
(
buttonId
);
}
else
{
setReturnCode
(
buttonId
);
close
();
}
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadManualPage.java
0 → 100644
浏览文件 @
b6ea3d7e
/*
* 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.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Link
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverFileSource
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.preferences.PrefPageDrivers
;
import
org.jkiss.utils.CommonUtils
;
class
DriverDownloadManualPage
extends
DriverDownloadPage
{
private
DriverFileSource
fileSource
;
DriverDownloadManualPage
()
{
super
(
"Configure driver files"
,
"Download driver files"
,
null
);
setPageComplete
(
false
);
}
@Override
public
void
createControl
(
Composite
parent
)
{
final
DriverDescriptor
driver
=
getWizard
().
getDriver
();
setMessage
(
"Download & configure "
+
driver
.
getFullName
()
+
" driver files"
);
StringBuilder
message
=
new
StringBuilder
();
message
.
append
(
""
).
append
(
driver
.
getFullName
());
message
.
append
(
"\n\nOr you can obtain driver files by yourself and add them in driver editor."
);
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_HORIZONTAL
));
//UIUtils.createHorizontalLine(composite);
UIUtils
.
createPlaceholder
(
composite
,
1
).
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
{
Composite
linksGroup
=
UIUtils
.
createPlaceholder
(
composite
,
2
);
((
GridLayout
)
linksGroup
.
getLayout
()).
makeColumnsEqualWidth
=
true
;
linksGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
// Vendor site
if
(!
CommonUtils
.
isEmpty
(
driver
.
getWebURL
()))
{
Link
link
=
UIUtils
.
createLink
(
linksGroup
,
"<a>Vendor's website</a>"
,
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
RuntimeUtils
.
openWebBrowser
(
driver
.
getWebURL
());
}
});
link
.
setToolTipText
(
driver
.
getWebURL
());
link
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
|
GridData
.
VERTICAL_ALIGN_BEGINNING
|
GridData
.
HORIZONTAL_ALIGN_BEGINNING
));
}
else
{
UIUtils
.
createPlaceholder
(
linksGroup
,
1
).
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
}
Link
link
=
UIUtils
.
createLink
(
linksGroup
,
"<a>Download configuration</a>"
,
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
UIUtils
.
showPreferencesFor
(
DBeaverUI
.
getActiveWorkbenchShell
(),
null
,
PrefPageDrivers
.
PAGE_ID
);
}
});
link
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
|
GridData
.
VERTICAL_ALIGN_BEGINNING
|
GridData
.
HORIZONTAL_ALIGN_END
));
}
setControl
(
composite
);
fileSource
=
getWizard
().
getDriver
().
getDriverFileSources
().
get
(
0
);
}
@Override
void
performFinish
()
{
UIUtils
.
runInDetachedUI
(
getShell
(),
new
Runnable
()
{
@Override
public
void
run
()
{
RuntimeUtils
.
openWebBrowser
(
fileSource
.
getUrl
());
}
});
DriverEditDialog
dialog
=
new
DriverEditDialog
(
DBeaverUI
.
getActiveWorkbenchShell
(),
getWizard
().
getDriver
());
dialog
.
open
();
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadPage.java
0 → 100644
浏览文件 @
b6ea3d7e
/*
* 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.resource.ImageDescriptor
;
import
org.eclipse.jface.wizard.WizardPage
;
abstract
class
DriverDownloadPage
extends
WizardPage
{
DriverDownloadPage
(
String
pageName
,
String
title
,
ImageDescriptor
titleImage
)
{
super
(
pageName
,
title
,
titleImage
);
}
public
DriverDownloadWizard
getWizard
()
{
return
(
DriverDownloadWizard
)
super
.
getWizard
();
}
abstract
void
performFinish
();
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
浏览文件 @
b6ea3d7e
...
...
@@ -26,6 +26,7 @@ import org.jkiss.code.NotNull;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverFileDescriptor
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.List
;
...
...
@@ -35,6 +36,7 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
private
DriverDescriptor
driver
;
private
List
<
DriverFileDescriptor
>
files
;
private
DriverDownloadPage
downloadPage
;
public
DriverDownloadWizard
(
@NotNull
DriverDescriptor
driver
,
List
<
DriverFileDescriptor
>
files
)
{
this
.
driver
=
driver
;
...
...
@@ -61,7 +63,12 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
@Override
public
void
addPages
()
{
super
.
addPages
();
addPage
(
new
DriverDownloadAutoPage
());
if
(
hasPredefinedFiles
())
{
downloadPage
=
new
DriverDownloadAutoPage
();
}
else
{
downloadPage
=
new
DriverDownloadManualPage
();
}
addPage
(
downloadPage
);
}
@Override
...
...
@@ -79,9 +86,20 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
@Override
public
boolean
performFinish
()
{
downloadPage
.
performFinish
();
return
true
;
}
public
String
getFinishText
()
{
if
(
hasPredefinedFiles
())
{
return
"Download"
;
}
else
{
return
"Open Download Page"
;
}
}
private
boolean
hasPredefinedFiles
()
{
return
CommonUtils
.
isEmpty
(
getDriver
().
getDriverFileSources
());
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录