Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
ee276b42
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,发现更多精彩内容 >>
未验证
提交
ee276b42
编写于
3月 08, 2022
作者:
S
ShadelessFox
提交者:
GitHub
3月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#15714 Don't show `Browse` button if S3 browser is not available (#15718)
上级
7ce97121
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
52 addition
and
53 deletion
+52
-53
plugins/org.jkiss.dbeaver.ext.athena.ui/src/org/jkiss/dbeaver/ext/athena/ui/views/AthenaConnectionPage.java
...iss/dbeaver/ext/athena/ui/views/AthenaConnectionPage.java
+52
-53
未找到文件。
plugins/org.jkiss.dbeaver.ext.athena.ui/src/org/jkiss/dbeaver/ext/athena/ui/views/AthenaConnectionPage.java
浏览文件 @
ee276b42
...
...
@@ -27,7 +27,6 @@ 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.Button
;
import
org.eclipse.swt.widgets.Combo
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Text
;
...
...
@@ -99,69 +98,69 @@ public class AthenaConnectionPage extends ConnectionPageWithAuth implements IDia
awsRegionCombo
.
addModifyListener
(
textListener
);
UIUtils
.
createControlLabel
(
addrGroup
,
AthenaMessages
.
label_s3_location
);
//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
Composite
s3Group
=
UIUtils
.
createComposite
(
addrGroup
,
2
);
Composite
s3Group
=
UIUtils
.
createComposite
(
addrGroup
,
1
);
s3Group
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
s3LocationText
=
new
Text
(
s3Group
,
SWT
.
BORDER
);
s3LocationText
.
setToolTipText
(
AthenaMessages
.
label_s3_output_location
);
s3LocationText
.
addModifyListener
(
textListener
);
s3LocationText
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Button
s3BrowseButton
=
UIUtils
.
createPushButton
(
s3Group
,
UIConnectionMessages
.
controls_client_home_selector_browse
,
DBeaverIcons
.
getImage
(
DBIcon
.
TREE_FOLDER
),
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
if
(
FileSystemProviderRegistry
.
getInstance
().
getProvider
(
"aws-s3"
)
==
null
)
{
DBWorkbench
.
getPlatformUI
().
showMessageBox
(
"Cloud support required"
,
"S3 file system browser not found"
,
true
);
return
;
}
DBNProject
projectNode
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getRoot
().
getProjectNode
(
getSite
().
getProject
());
DBNFileSystems
fsRootNode
=
projectNode
.
getExtraNode
(
DBNFileSystems
.
class
);
if
(
fsRootNode
==
null
)
{
DBWorkbench
.
getPlatformUI
().
showMessageBox
(
"Cloud support required"
,
"Project file system node not found"
,
true
);
return
;
}
DBNNode
selectedNode
=
null
;
String
oldS3Path
=
s3LocationText
.
getText
();
if
(!
CommonUtils
.
isEmpty
(
oldS3Path
)
&&
oldS3Path
.
startsWith
(
"s3:/"
))
{
selectedNode
=
findFileSystemNode
(
fsRootNode
,
oldS3Path
);
}
ObjectBrowserDialogBase
dialog
=
new
ObjectBrowserDialogBase
(
s3LocationText
.
getShell
(),
"S3 browser"
,
fsRootNode
,
selectedNode
,
true
)
{
@Override
protected
boolean
matchesResultNode
(
DBNNode
node
)
{
return
node
instanceof
DBNPathBase
&&
Files
.
isDirectory
(((
DBNPathBase
)
node
).
getPath
());
}
@Override
protected
ViewerFilter
createViewerFilter
()
{
return
new
ViewerFilter
()
{
@Override
public
boolean
select
(
Viewer
viewer
,
Object
parentElement
,
Object
element
)
{
return
element
instanceof
TreeNodeSpecial
||
element
instanceof
DBNFileSystem
||
(
element
instanceof
DBNNode
&&
matchesResultNode
((
DBNNode
)
element
));
}
};
if
(
FileSystemProviderRegistry
.
getInstance
().
getProvider
(
"aws-s3"
)
!=
null
)
{
((
GridLayout
)
s3Group
.
getLayout
()).
numColumns
++;
UIUtils
.
createPushButton
(
s3Group
,
UIConnectionMessages
.
controls_client_home_selector_browse
,
DBeaverIcons
.
getImage
(
DBIcon
.
TREE_FOLDER
),
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
DBNProject
projectNode
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getRoot
().
getProjectNode
(
getSite
().
getProject
());
DBNFileSystems
fsRootNode
=
projectNode
.
getExtraNode
(
DBNFileSystems
.
class
);
if
(
fsRootNode
==
null
)
{
DBWorkbench
.
getPlatformUI
().
showMessageBox
(
"Cloud support required"
,
"Project file system node not found"
,
true
);
return
;
}
};
if
(
dialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
List
<
DBNNode
>
selectedObjects
=
dialog
.
getSelectedObjects
();
if
(
selectedObjects
.
size
()
==
1
)
{
DBNNode
s3Node
=
selectedObjects
.
get
(
0
);
if
(
s3Node
instanceof
DBNPathBase
)
{
String
newS3Path
=
((
DBNPathBase
)
s3Node
).
getPath
().
toString
();
if
(
newS3Path
.
startsWith
(
"s3:/"
))
{
s3LocationText
.
setText
(
newS3Path
);
DBNNode
selectedNode
=
null
;
String
oldS3Path
=
s3LocationText
.
getText
();
if
(!
CommonUtils
.
isEmpty
(
oldS3Path
)
&&
oldS3Path
.
startsWith
(
"s3:/"
))
{
selectedNode
=
findFileSystemNode
(
fsRootNode
,
oldS3Path
);
}
ObjectBrowserDialogBase
dialog
=
new
ObjectBrowserDialogBase
(
s3LocationText
.
getShell
(),
"S3 browser"
,
fsRootNode
,
selectedNode
,
true
)
{
@Override
protected
boolean
matchesResultNode
(
DBNNode
node
)
{
return
node
instanceof
DBNPathBase
&&
Files
.
isDirectory
(((
DBNPathBase
)
node
).
getPath
());
}
@Override
protected
ViewerFilter
createViewerFilter
()
{
return
new
ViewerFilter
()
{
@Override
public
boolean
select
(
Viewer
viewer
,
Object
parentElement
,
Object
element
)
{
return
element
instanceof
TreeNodeSpecial
||
element
instanceof
DBNFileSystem
||
(
element
instanceof
DBNNode
&&
matchesResultNode
((
DBNNode
)
element
));
}
};
}
};
if
(
dialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
List
<
DBNNode
>
selectedObjects
=
dialog
.
getSelectedObjects
();
if
(
selectedObjects
.
size
()
==
1
)
{
DBNNode
s3Node
=
selectedObjects
.
get
(
0
);
if
(
s3Node
instanceof
DBNPathBase
)
{
String
newS3Path
=
((
DBNPathBase
)
s3Node
).
getPath
().
toString
();
if
(
newS3Path
.
startsWith
(
"s3:/"
))
{
s3LocationText
.
setText
(
newS3Path
);
}
}
}
}
}
}
}
);
}
);
}
UIUtils
.
addVariablesToControl
(
s3LocationText
,
getAvailableVariables
(),
"S3 location pattern"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录