Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
896e7dfd
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,发现更多精彩内容 >>
提交
896e7dfd
编写于
9月 13, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Maven config
Former-commit-id:
c23850c1
上级
11c2e43c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
108 addition
and
19 deletion
+108
-19
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
...beaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
...e/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
+39
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
...src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
+15
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadPage.java
...g/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadPage.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
...org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
+8
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageDrivers.java
...src/org/jkiss/dbeaver/ui/preferences/PrefPageDrivers.java
+44
-7
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
浏览文件 @
896e7dfd
...
...
@@ -85,6 +85,7 @@ public final class DBeaverPreferences
public
static
final
String
UI_PROXY_USER
=
"ui.proxy.user"
;
//$NON-NLS-1$
public
static
final
String
UI_PROXY_PASSWORD
=
"ui.proxy.password"
;
//$NON-NLS-1$
public
static
final
String
UI_DRIVERS_SOURCES
=
"ui.drivers.sources"
;
//$NON-NLS-1$
public
static
final
String
UI_MAVEN_REPOSITORIES
=
"ui.maven.repositories"
;
//$NON-NLS-1$
// Resources
public
static
final
String
RESOURCE_HANDLER_ROOT_PREFIX
=
"resource.root."
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
浏览文件 @
896e7dfd
...
...
@@ -22,15 +22,16 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
public
class
MavenRegistry
{
static
final
Log
log
=
Log
.
getLog
(
MavenRegistry
.
class
);
private
static
MavenRegistry
instance
=
null
;
public
synchronized
static
MavenRegistry
getInstance
()
...
...
@@ -38,6 +39,7 @@ public class MavenRegistry
if
(
instance
==
null
)
{
instance
=
new
MavenRegistry
();
instance
.
loadExtensions
(
Platform
.
getExtensionRegistry
());
instance
.
loadCustomRepositories
();
}
return
instance
;
}
...
...
@@ -48,7 +50,7 @@ public class MavenRegistry
{
}
p
ublic
void
loadExtensions
(
IExtensionRegistry
registry
)
p
rivate
void
loadExtensions
(
IExtensionRegistry
registry
)
{
// Load data type providers from external plugins
{
...
...
@@ -60,6 +62,31 @@ public class MavenRegistry
}
}
public
void
loadCustomRepositories
()
{
// Remove all custom repositories
for
(
Iterator
<
MavenRepository
>
iterator
=
repositories
.
iterator
();
iterator
.
hasNext
();
)
{
MavenRepository
repository
=
iterator
.
next
();
if
(!
repository
.
isPredefined
())
{
iterator
.
remove
();
}
}
// PArse repositories from preferences
String
repoString
=
DBeaverCore
.
getGlobalPreferenceStore
().
getString
(
DBeaverPreferences
.
UI_MAVEN_REPOSITORIES
);
if
(
CommonUtils
.
isEmpty
(
repoString
))
{
return
;
}
for
(
String
repoInfo
:
repoString
.
split
(
"\\|"
))
{
int
divPos
=
repoInfo
.
indexOf
(
':'
);
if
(
divPos
<
0
)
{
continue
;
}
String
repoID
=
repoInfo
.
substring
(
0
,
divPos
);
String
repoURL
=
repoInfo
.
substring
(
divPos
+
1
);
MavenRepository
repo
=
new
MavenRepository
(
repoID
,
repoID
,
repoURL
);
repositories
.
add
(
repo
);
}
}
@NotNull
public
List
<
MavenRepository
>
getRepositories
()
{
return
repositories
;
...
...
@@ -85,4 +112,12 @@ public class MavenRegistry
return
null
;
}
public
MavenRepository
findRepository
(
String
id
)
{
for
(
MavenRepository
repository
:
repositories
)
{
if
(
repository
.
getId
().
equals
(
id
))
{
return
repository
;
}
}
return
null
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
浏览文件 @
896e7dfd
...
...
@@ -63,15 +63,23 @@ public class MavenRepository
private
String
id
;
private
String
name
;
private
String
url
;
private
boolean
predefined
=
false
;
private
List
<
MavenArtifact
>
cachedArtifacts
=
new
ArrayList
<
MavenArtifact
>();
public
MavenRepository
(
IConfigurationElement
config
)
{
this
.
id
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_ID
);
this
.
name
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_NAME
);
this
.
url
=
config
.
getAttribute
(
RegistryConstants
.
ATTR_URL
);
this
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_ID
),
config
.
getAttribute
(
RegistryConstants
.
ATTR_NAME
),
config
.
getAttribute
(
RegistryConstants
.
ATTR_URL
));
this
.
predefined
=
true
;
}
public
MavenRepository
(
String
id
,
String
name
,
String
url
)
{
this
.
id
=
id
;
this
.
name
=
name
;
this
.
url
=
url
;
loadCache
();
}
...
...
@@ -91,6 +99,10 @@ public class MavenRepository
return
url
;
}
public
boolean
isPredefined
()
{
return
predefined
;
}
@Nullable
public
MavenArtifact
getArtifact
(
@NotNull
String
groupId
,
@NotNull
String
artifactId
,
boolean
create
)
{
for
(
MavenArtifact
artifact
:
cachedArtifacts
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadPage.java
浏览文件 @
896e7dfd
...
...
@@ -77,7 +77,7 @@ abstract class DriverDownloadPage extends WizardPage {
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
UIUtils
.
showPreferencesFor
(
DBeaverUI
.
getActiveWorkbenchShell
()
,
null
,
null
,
PrefPageDrivers
.
PAGE_ID
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
浏览文件 @
896e7dfd
...
...
@@ -708,11 +708,15 @@ public class DriverEditDialog extends HelpEnabledDialog
}
provider
.
getRegistry
().
saveDrivers
();
try
{
driver
.
loadDriver
(
DBeaverUI
.
getDefaultRunnableContext
(),
true
,
true
);
}
catch
(
Throwable
ex
)
{
UIUtils
.
showErrorDialog
(
getShell
(),
CoreMessages
.
dialog_edit_driver_dialog_driver_error_title
,
CoreMessages
.
dialog_edit_driver_dialog_driver_error_message
,
ex
);
/* // DO NOT validate driver on close. Otherwise it can cause cyclis errors -> new driver editor dialog, etcv
{
try {
driver.loadDriver(DBeaverUI.getDefaultRunnableContext(), true);
} catch (Throwable ex) {
UIUtils.showErrorDialog(getShell(), CoreMessages.dialog_edit_driver_dialog_driver_error_title, CoreMessages.dialog_edit_driver_dialog_driver_error_message, ex);
}
}
*/
super
.
okPressed
();
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageDrivers.java
浏览文件 @
896e7dfd
...
...
@@ -29,9 +29,9 @@ import org.eclipse.ui.IWorkbench;
import
org.eclipse.ui.IWorkbenchPreferencePage
;
import
org.eclipse.ui.IWorkbenchPropertyPage
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPPreferenceStore
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.encode.EncryptionException
;
...
...
@@ -127,6 +127,22 @@ public class PrefPageDrivers extends PreferencePage implements IWorkbenchPrefere
}
});
removeButton
.
setEnabled
(
false
);
mavenRepoTable
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
boolean
enabled
=
false
;
TableItem
[]
selection
=
mavenRepoTable
.
getSelection
();
if
(
selection
.
length
==
1
)
{
enabled
=
true
;
if
(
selection
[
0
].
getData
()
instanceof
MavenRepository
&&
((
MavenRepository
)
selection
[
0
].
getData
()).
isPredefined
())
{
enabled
=
false
;
}
}
removeButton
.
setEnabled
(
enabled
);
}
});
}
{
...
...
@@ -228,7 +244,9 @@ public class PrefPageDrivers extends PreferencePage implements IWorkbenchPrefere
}
for
(
MavenRepository
repo
:
MavenRegistry
.
getInstance
().
getRepositories
())
{
new
TableItem
(
mavenRepoTable
,
SWT
.
NONE
).
setText
(
new
String
[]{
repo
.
getId
(),
repo
.
getUrl
()});
TableItem
item
=
new
TableItem
(
mavenRepoTable
,
SWT
.
NONE
);
item
.
setText
(
new
String
[]{
repo
.
getId
(),
repo
.
getUrl
()});
item
.
setData
(
repo
);
}
UIUtils
.
packColumns
(
mavenRepoTable
,
true
);
super
.
performDefaults
();
...
...
@@ -253,12 +271,31 @@ public class PrefPageDrivers extends PreferencePage implements IWorkbenchPrefere
store
.
setValue
(
DBeaverPreferences
.
UI_PROXY_PASSWORD
,
password
);
store
.
setValue
(
DBeaverPreferences
.
UI_DRIVERS_HOME
,
customDriversHome
.
getText
());
StringBuilder
sources
=
new
StringBuilder
();
for
(
String
item
:
sourceList
.
getItems
())
{
if
(
sources
.
length
()
>
0
)
sources
.
append
(
'|'
);
sources
.
append
(
item
);
{
StringBuilder
sources
=
new
StringBuilder
();
for
(
String
item
:
sourceList
.
getItems
())
{
if
(
sources
.
length
()
>
0
)
sources
.
append
(
'|'
);
sources
.
append
(
item
);
}
store
.
setValue
(
DBeaverPreferences
.
UI_DRIVERS_SOURCES
,
sources
.
toString
());
}
store
.
setValue
(
DBeaverPreferences
.
UI_DRIVERS_SOURCES
,
sources
.
toString
());
{
StringBuilder
mavenRepos
=
new
StringBuilder
();
for
(
TableItem
item
:
mavenRepoTable
.
getItems
())
{
String
repoId
=
item
.
getText
(
0
);
String
repoURL
=
item
.
getText
(
1
);
MavenRepository
repository
=
MavenRegistry
.
getInstance
().
findRepository
(
repoId
);
if
(
repository
!=
null
&&
repository
.
isPredefined
())
{
continue
;
}
if
(
mavenRepos
.
length
()
>
0
)
mavenRepos
.
append
(
'|'
);
mavenRepos
.
append
(
repoId
).
append
(
':'
).
append
(
repoURL
);
}
store
.
setValue
(
DBeaverPreferences
.
UI_MAVEN_REPOSITORIES
,
mavenRepos
.
toString
());
MavenRegistry
.
getInstance
().
loadCustomRepositories
();
}
PrefUtils
.
savePreferenceStore
(
store
);
return
super
.
performOk
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录