Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
11d20176
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,发现更多精彩内容 >>
提交
11d20176
编写于
9月 14, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add maven artifact as lib
上级
0eb859ed
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
98 addition
and
42 deletion
+98
-42
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileDescriptor.java
.../src/org/jkiss/dbeaver/registry/DriverFileDescriptor.java
+5
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactReference.java
.../jkiss/dbeaver/registry/maven/MavenArtifactReference.java
+25
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
...org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
+7
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/EditMavenArtifactDialog.java
...ss/dbeaver/ui/dialogs/driver/EditMavenArtifactDialog.java
+61
-38
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileDescriptor.java
浏览文件 @
11d20176
...
...
@@ -151,6 +151,11 @@ public class DriverFileDescriptor implements DBPDriverFile
return
path
.
startsWith
(
FILE_SOURCE_MAVEN
);
}
public
boolean
isMavenArtifactResolved
()
{
MavenArtifact
artifact
=
getMavenArtifact
();
return
artifact
!=
null
&&
artifact
.
getActiveLocalVersion
()
!=
null
;
}
private
String
getRepositoryPath
()
{
return
path
.
substring
(
FILE_SOURCE_REPO
.
length
());
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactReference.java
浏览文件 @
11d20176
...
...
@@ -27,9 +27,9 @@ public class MavenArtifactReference
private
static
final
String
DEFAULT_MAVEN_VERSION
=
VERSION_PATTERN_RELEASE
;
private
final
String
groupId
;
private
final
String
artifactId
;
private
final
String
version
;
private
String
groupId
;
private
String
artifactId
;
private
String
version
;
public
MavenArtifactReference
(
String
groupId
,
String
artifactId
,
String
version
)
{
this
.
groupId
=
groupId
;
...
...
@@ -65,11 +65,33 @@ public class MavenArtifactReference
return
groupId
;
}
public
void
setGroupId
(
String
groupId
)
{
this
.
groupId
=
groupId
;
}
public
String
getArtifactId
()
{
return
artifactId
;
}
public
void
setArtifactId
(
String
artifactId
)
{
this
.
artifactId
=
artifactId
;
}
public
String
getVersion
()
{
return
version
;
}
public
void
setVersion
(
String
version
)
{
this
.
version
=
version
;
}
public
String
getPath
()
{
return
groupId
+
":"
+
artifactId
+
":"
+
version
;
}
@Override
public
String
toString
()
{
return
getPath
();
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
浏览文件 @
11d20176
...
...
@@ -292,6 +292,8 @@ public class DriverEditDialog extends HelpEnabledDialog
File
localFile
=
lib
.
getLocalFile
();
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
cell
.
setForeground
(
null
);
}
else
if
(
lib
.
isMavenArtifact
()
&&
!
lib
.
isMavenArtifactResolved
())
{
cell
.
setForeground
(
Display
.
getDefault
().
getSystemColor
(
SWT
.
COLOR_BLUE
));
}
else
{
cell
.
setForeground
(
Display
.
getDefault
().
getSystemColor
(
SWT
.
COLOR_RED
));
}
...
...
@@ -426,7 +428,11 @@ public class DriverEditDialog extends HelpEnabledDialog
{
EditMavenArtifactDialog
fd
=
new
EditMavenArtifactDialog
(
getShell
(),
null
);
if
(
fd
.
open
()
==
IDialogConstants
.
OK_ID
)
{
libList
.
add
(
new
DriverFileDescriptor
(
driver
,
DBPDriverFile
.
FileType
.
jar
,
DriverFileDescriptor
.
FILE_SOURCE_MAVEN
+
fd
.
getArtifact
().
getPath
()));
changeLibContent
();
}
}
});
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/EditMavenArtifactDialog.java
浏览文件 @
11d20176
...
...
@@ -20,28 +20,34 @@ package org.jkiss.dbeaver.ui.dialogs.driver;
import
org.eclipse.jface.dialogs.Dialog
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.viewers.ListViewer
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.ModifyEvent
;
import
org.eclipse.swt.events.ModifyListener
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Shell
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.registry.maven.MavenArtifact
;
import
java.util.StringTokenizer
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.jkiss.dbeaver.registry.maven.MavenArtifactReference
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.CommonUtils
;
/**
* EditMavenArtifactDialog
*/
class
EditMavenArtifactDialog
extends
Dialog
{
private
MavenArtifact
artifact
;
private
MavenArtifactReference
artifact
;
private
Text
groupText
;
private
Text
artifactText
;
private
Combo
versionText
;
public
EditMavenArtifactDialog
(
Shell
shell
,
MavenArtifact
artifact
)
public
EditMavenArtifactDialog
(
Shell
shell
,
MavenArtifact
Reference
artifact
)
{
super
(
shell
);
this
.
artifact
=
artifact
;
this
.
artifact
=
artifact
==
null
?
new
MavenArtifactReference
(
""
,
""
,
MavenArtifactReference
.
VERSION_PATTERN_RELEASE
)
:
artifact
;
}
public
MavenArtifactReference
getArtifact
()
{
return
artifact
;
}
@Override
...
...
@@ -53,40 +59,57 @@ class EditMavenArtifactDialog extends Dialog
@Override
protected
Control
createDialogArea
(
Composite
parent
)
{
getShell
().
setText
(
CoreMessages
.
dialog_view_classpath_title
);
getShell
().
setText
(
"Edit Maven Artifact"
);
Composite
group
=
(
Composite
)
super
.
createDialogArea
(
parent
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_BOTH
);
gd
.
heightHint
=
300
;
gd
.
widthHint
=
400
;
group
.
setLayoutData
(
gd
);
Composite
composite
=
(
Composite
)
super
.
createDialogArea
(
parent
);
((
GridLayout
)
composite
.
getLayout
()).
numColumns
=
2
;
{
ListViewer
libsTable
=
new
ListViewer
(
group
,
SWT
.
BORDER
|
SWT
.
MULTI
|
SWT
.
V_SCROLL
|
SWT
.
H_SCROLL
);
libsTable
.
getControl
().
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
GridData
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
widthHint
=
200
;
String
classPath
=
System
.
getProperty
(
"java.class.path"
);
//$NON-NLS-1$
StringTokenizer
st
=
new
StringTokenizer
(
classPath
,
";"
);
//$NON-NLS-1$
while
(
st
.
hasMoreTokens
())
{
libsTable
.
getList
().
add
(
st
.
nextToken
());
}
/*
for (DriverLibraryDescriptor lib : driver.getLibraries()) {
libsTable.getList().add(lib.getLocalFile().getPath());
groupText
=
UIUtils
.
createLabelText
(
composite
,
"Group Id"
,
artifact
.
getGroupId
());
groupText
.
setLayoutData
(
gd
);
artifactText
=
UIUtils
.
createLabelText
(
composite
,
"Artifact Id"
,
artifact
.
getArtifactId
());
artifactText
.
setLayoutData
(
gd
);
versionText
=
UIUtils
.
createLabelCombo
(
composite
,
"Version"
,
SWT
.
DROP_DOWN
|
SWT
.
BORDER
);
versionText
.
setLayoutData
(
gd
);
versionText
.
setText
(
artifact
.
getVersion
());
versionText
.
add
(
MavenArtifactReference
.
VERSION_PATTERN_RELEASE
);
versionText
.
add
(
MavenArtifactReference
.
VERSION_PATTERN_LATEST
);
ModifyListener
ml
=
new
ModifyListener
()
{
@Override
public
void
modifyText
(
ModifyEvent
e
)
{
updateButtons
();
}
*/
}
return
group
;
};
groupText
.
addModifyListener
(
ml
);
artifactText
.
addModifyListener
(
ml
);
versionText
.
addModifyListener
(
ml
);
return
composite
;
}
@Override
protected
void
createButtonsForButtonBar
(
Composite
parent
)
{
createButton
(
parent
,
IDialogConstants
.
OK_ID
,
IDialogConstants
.
OK_LABEL
,
true
);
protected
void
createButtonsForButtonBar
(
Composite
parent
)
{
super
.
createButtonsForButtonBar
(
parent
);
updateButtons
();
}
private
void
updateButtons
()
{
getButton
(
IDialogConstants
.
OK_ID
).
setEnabled
(
!
CommonUtils
.
isEmpty
(
groupText
.
getText
())
&&
!
CommonUtils
.
isEmpty
(
artifactText
.
getText
())
&&
!
CommonUtils
.
isEmpty
(
versionText
.
getText
())
);
}
@Override
protected
void
okPressed
()
{
artifact
.
setGroupId
(
groupText
.
getText
());
artifact
.
setArtifactId
(
artifactText
.
getText
());
artifact
.
setVersion
(
versionText
.
getText
());
super
.
okPressed
();
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录