Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
066e2254
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,发现更多精彩内容 >>
提交
066e2254
编写于
10月 08, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Maven model & ui
上级
41731321
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
91 addition
and
41 deletion
+91
-41
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryAbstract.java
.../jkiss/dbeaver/registry/driver/DriverLibraryAbstract.java
+5
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryMavenArtifact.java
...s/dbeaver/registry/driver/DriverLibraryMavenArtifact.java
+30
-23
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryMavenDependency.java
...dbeaver/registry/driver/DriverLibraryMavenDependency.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifact.java
...e/src/org/jkiss/dbeaver/registry/maven/MavenArtifact.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
...rg/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
+23
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
...c/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
+2
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
...iss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
+25
-9
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriverLibrary.java
...r.model/src/org/jkiss/dbeaver/model/DBPDriverLibrary.java
+3
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryAbstract.java
浏览文件 @
066e2254
...
...
@@ -99,6 +99,11 @@ public abstract class DriverLibraryAbstract implements DBPDriverLibrary
return
driver
;
}
@Override
public
String
getVersion
()
{
return
null
;
}
@NotNull
@Override
public
FileType
getType
()
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryMavenArtifact.java
浏览文件 @
066e2254
...
...
@@ -130,30 +130,28 @@ public class DriverLibraryMavenArtifact extends DriverLibraryAbstract
MavenLocalVersion
localVersion
=
resolveLocalVersion
(
monitor
,
false
);
if
(
localVersion
!=
null
)
{
MavenArtifactVersion
metaData
=
localVersion
.
getMetaData
(
monitor
);
if
(
metaData
!=
null
)
{
List
<
MavenArtifactDependency
>
artifactDeps
=
metaData
.
getDependencies
();
if
(!
CommonUtils
.
isEmpty
(
artifactDeps
))
{
for
(
MavenArtifactDependency
artifactDep
:
artifactDeps
)
{
if
(
artifactDep
.
isOptional
())
{
continue
;
}
switch
(
artifactDep
.
getScope
())
{
case
COMPILE:
case
RUNTIME:
{
MavenLocalVersion
depLocalVersion
=
artifactDep
.
resolveDependency
(
monitor
);
if
(
depLocalVersion
!=
null
)
{
dependencies
.
add
(
new
DriverLibraryMavenDependency
(
this
.
getDriver
(),
depLocalVersion
));
}
break
;
List
<
MavenArtifactDependency
>
artifactDeps
=
metaData
.
getDependencies
(
monitor
);
if
(!
CommonUtils
.
isEmpty
(
artifactDeps
))
{
for
(
MavenArtifactDependency
artifactDep
:
artifactDeps
)
{
if
(
artifactDep
.
isOptional
())
{
continue
;
}
switch
(
artifactDep
.
getScope
())
{
case
COMPILE:
case
RUNTIME:
{
MavenLocalVersion
depLocalVersion
=
artifactDep
.
resolveDependency
(
monitor
);
if
(
depLocalVersion
!=
null
)
{
dependencies
.
add
(
new
DriverLibraryMavenDependency
(
this
.
getDriver
(),
depLocalVersion
));
}
default
:
// We don't need it
break
;
break
;
}
default
:
// We don't need it
break
;
}
}
}
...
...
@@ -163,11 +161,20 @@ public class DriverLibraryMavenArtifact extends DriverLibraryAbstract
@NotNull
public
String
getDisplayName
()
{
MavenArtifact
artifact
=
getMavenArtifact
();
if
(
artifact
!=
null
)
{
return
artifact
.
getGroupId
()
+
":"
+
artifact
.
getArtifactId
();
}
return
path
;
}
@Override
public
String
getVersion
()
{
MavenArtifact
artifact
=
getMavenArtifact
();
if
(
artifact
!=
null
)
{
MavenLocalVersion
version
=
artifact
.
getActiveLocalVersion
();
if
(
version
!=
null
)
{
return
artifact
.
getGroupId
()
+
":"
+
artifact
.
getArtifactId
()
+
":"
+
version
.
getVersion
();
return
version
.
getVersion
();
}
}
return
path
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryMavenDependency.java
浏览文件 @
066e2254
...
...
@@ -34,7 +34,7 @@ public class DriverLibraryMavenDependency extends DriverLibraryMavenArtifact
private
MavenLocalVersion
localVersion
;
public
DriverLibraryMavenDependency
(
DriverDescriptor
driverDescriptor
,
MavenLocalVersion
localVersion
)
{
super
(
driverDescriptor
,
FileType
.
jar
,
PATH_PREFIX
+
localVersion
.
toString
());
super
(
driverDescriptor
,
FileType
.
jar
,
PATH_PREFIX
+
localVersion
.
getArtifact
().
toString
());
this
.
localVersion
=
localVersion
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifact.java
浏览文件 @
066e2254
...
...
@@ -72,8 +72,8 @@ public class MavenArtifact
lastUpdate
=
null
;
String
metadataPath
=
getArtifactURL
()
+
MAVEN_METADATA_XML
;
monitor
.
subTask
(
"Load
artifact metadata ["
+
metadataPath
+
"]
"
);
System
.
out
.
println
(
"Load metadata "
+
this
);
monitor
.
subTask
(
"Load
metadata "
+
this
+
"
"
);
try
(
InputStream
mdStream
=
RuntimeUtils
.
openConnectionStream
(
metadataPath
))
{
SAXReader
reader
=
new
SAXReader
(
mdStream
);
reader
.
parse
(
new
SAXListener
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
浏览文件 @
066e2254
...
...
@@ -39,6 +39,8 @@ public class MavenArtifactVersion {
static
final
Log
log
=
Log
.
getLog
(
MavenArtifactVersion
.
class
);
public
static
final
String
PROP_PROJECT_VERSION
=
"project.version"
;
public
static
final
String
PROP_PROJECT_GROUP_ID
=
"project.groupId"
;
public
static
final
String
PROP_PROJECT_ARTIFACT_ID
=
"project.artifactId"
;
private
MavenLocalVersion
localVersion
;
private
String
name
;
...
...
@@ -59,6 +61,10 @@ public class MavenArtifactVersion {
if
(
value
==
null
)
{
if
(
name
.
equals
(
PROP_PROJECT_VERSION
))
{
value
=
version
;
}
else
if
(
name
.
equals
(
PROP_PROJECT_GROUP_ID
))
{
value
=
localVersion
.
getArtifact
().
getGroupId
();
}
else
if
(
name
.
equals
(
PROP_PROJECT_ARTIFACT_ID
))
{
value
=
localVersion
.
getArtifact
().
getArtifactId
();
}
else
if
(
parent
!=
null
)
{
return
parent
.
getMetaData
(
VoidProgressMonitor
.
INSTANCE
).
variableResolver
.
get
(
name
);
}
...
...
@@ -109,8 +115,19 @@ public class MavenArtifactVersion {
return
licenses
;
}
public
List
<
MavenArtifactDependency
>
getDependencies
()
{
return
dependencies
;
public
List
<
MavenArtifactDependency
>
getDependencies
(
DBRProgressMonitor
monitor
)
{
if
(
parent
!=
null
)
{
List
<
MavenArtifactDependency
>
parentDependencies
=
parent
.
getMetaData
(
monitor
).
getDependencies
(
monitor
);
if
(!
CommonUtils
.
isEmpty
(
parentDependencies
))
{
if
(
CommonUtils
.
isEmpty
(
dependencies
))
{
return
parentDependencies
;
}
parentDependencies
=
new
ArrayList
<>(
parentDependencies
);
parentDependencies
.
addAll
(
dependencies
);
return
parentDependencies
;
}
}
return
this
.
dependencies
;
}
@Override
...
...
@@ -129,8 +146,8 @@ public class MavenArtifactVersion {
private
void
loadPOM
(
DBRProgressMonitor
monitor
)
throws
IOException
{
String
pomURL
=
localVersion
.
getArtifact
().
getFileURL
(
localVersion
.
getVersion
(),
MavenArtifact
.
FILE_POM
);
monitor
.
subTask
(
"Load POM
["
+
pomURL
+
"]"
);
System
.
out
.
println
(
"Load POM "
+
localVersion
.
getArtifact
().
toString
()
+
":"
+
localVersion
.
getVersion
());
monitor
.
subTask
(
"Load POM
"
+
localVersion
);
Document
pomDocument
;
try
(
InputStream
mdStream
=
RuntimeUtils
.
openConnectionStream
(
pomURL
))
{
pomDocument
=
XMLUtils
.
parseDocument
(
mdStream
);
...
...
@@ -228,8 +245,8 @@ System.out.println("Load POM " + localVersion.getArtifact().toString() + ":" + l
scope
=
MavenArtifactDependency
.
Scope
.
valueOf
(
scopeName
.
toUpperCase
(
Locale
.
ENGLISH
));
}
result
.
add
(
new
MavenArtifactDependency
(
groupId
,
artifactId
,
evaluateString
(
groupId
)
,
evaluateString
(
artifactId
)
,
evaluateString
(
version
),
scope
,
CommonUtils
.
getBoolean
(
XMLUtils
.
getChildElementBody
(
dep
,
"optional"
),
false
)
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
浏览文件 @
066e2254
...
...
@@ -17,6 +17,7 @@
*/
package
org.jkiss.dbeaver.registry.maven
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
...
...
@@ -80,6 +81,7 @@ public class MavenLocalVersion
return
artifact
.
getFileURL
(
version
,
fileType
);
}
@NotNull
public
MavenArtifactVersion
getMetaData
(
DBRProgressMonitor
monitor
)
{
if
(
metaData
==
null
)
{
try
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
浏览文件 @
066e2254
...
...
@@ -32,6 +32,7 @@ import org.jkiss.dbeaver.runtime.RunnableContextDelegate;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
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
;
...
...
@@ -110,21 +111,24 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
UIUtils
.
showErrorDialog
(
null
,
"Resolve libraries"
,
"Error resolving driver libraries"
,
e
.
getTargetException
());
}
final
Set
<
String
>
addedDeps
=
new
HashSet
<>();
int
totalItems
=
0
;
for
(
DBPDriverLibrary
file
:
getWizard
().
getFiles
())
{
TreeItem
item
=
new
TreeItem
(
filesTree
,
SWT
.
NONE
);
item
.
setImage
(
DBeaverIcons
.
getImage
(
file
.
getIcon
()));
item
.
setText
(
0
,
file
.
getDisplayName
());
item
.
setText
(
1
,
""
);
item
.
setText
(
1
,
CommonUtils
.
notEmpty
(
file
.
getVersion
())
);
totalItems
++;
if
(
addDependencies
(
item
,
file
,
depMap
))
{
if
(
addDependencies
(
item
,
file
,
depMap
,
addedDeps
))
{
item
.
setExpanded
(
true
);
totalItems
+=
item
.
getItemCount
();
}
}
UIUtils
.
packColumns
(
filesTree
);
// GridData gd = (GridData)filesTree.getLayoutData();
// gd.heightHint = filesTree.getItemCount() * 20 + 20;
if
(
totalItems
>
20
)
{
totalItems
=
20
;
}
Shell
shell
=
getContainer
().
getShell
();
shell
.
setSize
(
shell
.
getSize
().
x
,
shell
.
getSize
().
y
+
filesTree
.
getItemHeight
()
*
totalItems
);
shell
.
layout
();
...
...
@@ -136,7 +140,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
if
(
deps
!=
null
)
{
return
;
}
System
.
out
.
println
(
"Resolve dependencies of ["
+
libraryPath
+
"]"
);
deps
=
new
ArrayList
<>();
depMap
.
put
(
libraryPath
,
deps
);
...
...
@@ -149,19 +153,31 @@ System.out.println("Resolve dependencies of [" + libraryPath + "]");
}
}
private
boolean
addDependencies
(
TreeItem
parent
,
DBPDriverLibrary
library
,
Map
<
String
,
List
<
DBPDriverLibrary
>>
depMap
)
{
private
boolean
addDependencies
(
TreeItem
parent
,
DBPDriverLibrary
library
,
Map
<
String
,
List
<
DBPDriverLibrary
>>
depMap
,
Set
<
String
>
addedDeps
)
{
Collection
<?
extends
DBPDriverLibrary
>
dependencies
=
depMap
.
get
(
library
.
getPath
());
if
(
dependencies
!=
null
&&
!
dependencies
.
isEmpty
())
{
Map
<
DBPDriverLibrary
,
TreeItem
>
itemMap
=
new
HashMap
<>();
for
(
DBPDriverLibrary
dep
:
dependencies
)
{
TreeItem
item
=
new
TreeItem
(
parent
,
SWT
.
NONE
);
item
.
setImage
(
DBeaverIcons
.
getImage
(
dep
.
getIcon
()));
item
.
setText
(
0
,
dep
.
getDisplayName
());
item
.
setText
(
1
,
""
);
item
.
setText
(
1
,
CommonUtils
.
notEmpty
(
dep
.
getVersion
())
);
if
(
addDependencies
(
item
,
dep
,
depMap
))
{
//item.setExpanded(true);
if
(
addedDeps
.
contains
(
dep
.
getPath
()))
{
item
.
setForeground
(
getShell
().
getDisplay
().
getSystemColor
(
SWT
.
COLOR_WIDGET_DARK_SHADOW
));
}
itemMap
.
put
(
dep
,
item
);
}
for
(
DBPDriverLibrary
dep
:
dependencies
)
{
TreeItem
item
=
itemMap
.
get
(
dep
);
if
(!
addedDeps
.
contains
(
dep
.
getPath
()))
{
addedDeps
.
add
(
dep
.
getPath
());
if
(
addDependencies
(
item
,
dep
,
depMap
,
addedDeps
))
{
//item.setExpanded(true);
}
}
}
return
true
;
}
return
false
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriverLibrary.java
浏览文件 @
066e2254
...
...
@@ -46,6 +46,9 @@ public interface DBPDriverLibrary
@NotNull
String
getDisplayName
();
@Nullable
String
getVersion
();
@NotNull
DBIcon
getIcon
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录