Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
036e0ebd
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,发现更多精彩内容 >>
提交
036e0ebd
编写于
4月 30, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Data viewer: navigate to multiple rows fks/refs
Former-commit-id:
4d5311af
上级
8d26f88e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
27 deletion
+33
-27
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/IResultSetController.java
...s/dbeaver/ui/controls/resultset/IResultSetController.java
+2
-4
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetHandlerMain.java
...s/dbeaver/ui/controls/resultset/ResultSetHandlerMain.java
+2
-3
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetReferenceMenu.java
...dbeaver/ui/controls/resultset/ResultSetReferenceMenu.java
+3
-3
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+25
-16
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/IResultSetController.java
浏览文件 @
036e0ebd
...
...
@@ -22,7 +22,6 @@ import org.eclipse.swt.graphics.Color;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.ui.IWorkbenchActionConstants
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
...
...
@@ -34,7 +33,6 @@ import org.jkiss.dbeaver.model.data.DBDDataReceiver;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.model.struct.DBSEntityAssociation
;
import
org.jkiss.dbeaver.ui.data.IDataController
;
...
...
@@ -140,10 +138,10 @@ public interface IResultSetController extends IDataController, DBPContextProvide
/**
* Navigates to association. One of @association OR @attr must be specified.
*/
void
navigateAssociation
(
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
DBSEntityAssociation
association
,
@Nullable
DBDAttributeBinding
attr
,
@NotNull
ResultSetRow
row
,
boolean
newWindow
)
void
navigateAssociation
(
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
DBSEntityAssociation
association
,
@Nullable
DBDAttributeBinding
attr
,
@NotNull
List
<
ResultSetRow
>
rows
,
boolean
newWindow
)
throws
DBException
;
void
navigateReference
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSEntityAssociation
association
,
@NotNull
ResultSetRow
row
,
boolean
newWindow
)
void
navigateReference
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSEntityAssociation
association
,
@NotNull
List
<
ResultSetRow
>
rows
,
boolean
newWindow
)
throws
DBException
;
int
getHistoryPosition
();
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetHandlerMain.java
浏览文件 @
036e0ebd
...
...
@@ -384,14 +384,13 @@ public class ResultSetHandlerMain extends AbstractHandler {
action
.
run
();
break
;
case
CMD_NAVIGATE_LINK:
{
final
ResultSetRow
row
=
rsv
.
getCurrentRow
();
final
DBDAttributeBinding
attr
=
rsv
.
getActivePresentation
().
getCurrentAttribute
();
if
(
row
!=
null
&&
attr
!=
null
)
{
if
(
attr
!=
null
)
{
new
AbstractJob
(
"Navigate association"
)
{
@Override
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
try
{
rsv
.
navigateAssociation
(
monitor
,
null
,
attr
,
r
ow
,
false
);
rsv
.
navigateAssociation
(
monitor
,
null
,
attr
,
r
sv
.
getSelection
().
getSelectedRows
()
,
false
);
}
catch
(
DBException
e
)
{
return
GeneralUtils
.
makeExceptionStatus
(
e
);
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetReferenceMenu.java
浏览文件 @
036e0ebd
...
...
@@ -59,7 +59,7 @@ public class ResultSetReferenceMenu
}
static
void
fillRefTablesActions
(
ResultSetViewer
viewer
,
ResultSetRow
row
,
DBSEntity
singleSource
,
IMenuManager
manager
,
boolean
openInNewWindow
)
{
static
void
fillRefTablesActions
(
ResultSetViewer
viewer
,
List
<
ResultSetRow
>
rows
,
DBSEntity
singleSource
,
IMenuManager
manager
,
boolean
openInNewWindow
)
{
final
List
<
DBSEntityAssociation
>
references
=
new
ArrayList
<>();
final
List
<
DBSEntityAssociation
>
associations
=
new
ArrayList
<>();
...
...
@@ -152,7 +152,7 @@ public class ResultSetReferenceMenu
@Override
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
try
{
viewer
.
navigateAssociation
(
new
VoidProgressMonitor
(),
association
,
null
,
row
,
openInNewWindow
);
viewer
.
navigateAssociation
(
new
VoidProgressMonitor
(),
association
,
null
,
row
s
,
openInNewWindow
);
}
catch
(
DBException
e
)
{
return
GeneralUtils
.
makeExceptionStatus
(
e
);
}
...
...
@@ -182,7 +182,7 @@ public class ResultSetReferenceMenu
@Override
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
try
{
viewer
.
navigateReference
(
new
VoidProgressMonitor
(),
refAssociation
,
row
,
openInNewWindow
);
viewer
.
navigateReference
(
new
VoidProgressMonitor
(),
refAssociation
,
row
s
,
openInNewWindow
);
}
catch
(
DBException
e
)
{
return
GeneralUtils
.
makeExceptionStatus
(
e
);
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
036e0ebd
...
...
@@ -2052,11 +2052,7 @@ public class ResultSetViewer extends Viewer
}
void
showReferencesMenu
(
boolean
openInNewWindow
)
{
ResultSetRow
currentRow
=
getCurrentRow
();
if
(
currentRow
==
null
||
currentRow
.
getRowNumber
()
<
0
)
{
return
;
}
MenuManager
menuManager
=
createRefTablesMenu
(
currentRow
,
openInNewWindow
);
MenuManager
menuManager
=
createRefTablesMenu
(
openInNewWindow
);
if
(
menuManager
!=
null
)
{
showContextMenuAtCursor
(
menuManager
);
viewerPanel
.
addDisposeListener
(
e
->
menuManager
.
dispose
());
...
...
@@ -2252,7 +2248,7 @@ public class ResultSetViewer extends Viewer
}
if
(
model
.
isSingleSource
())
{
// Add menu for referencing tables
MenuManager
refTablesMenu
=
createRefTablesMenu
(
row
,
false
);
MenuManager
refTablesMenu
=
createRefTablesMenu
(
false
);
if
(
refTablesMenu
!=
null
)
{
navigateMenu
.
add
(
refTablesMenu
);
hasNavTables
=
true
;
...
...
@@ -2364,7 +2360,7 @@ public class ResultSetViewer extends Viewer
}
@Nullable
private
MenuManager
createRefTablesMenu
(
ResultSetRow
row
,
boolean
openInNewWindow
)
{
private
MenuManager
createRefTablesMenu
(
boolean
openInNewWindow
)
{
DBSEntity
singleSource
=
model
.
getSingleSource
();
if
(
singleSource
==
null
)
{
return
null
;
...
...
@@ -2374,7 +2370,8 @@ public class ResultSetViewer extends Viewer
MenuManager
refTablesMenu
=
new
MenuManager
(
menuName
,
null
,
"ref-tables"
);
refTablesMenu
.
setActionDefinitionId
(
ResultSetHandlerMain
.
CMD_REFERENCES_MENU
);
refTablesMenu
.
add
(
ResultSetReferenceMenu
.
NOREFS_ACTION
);
refTablesMenu
.
addMenuListener
(
manager
->
ResultSetReferenceMenu
.
fillRefTablesActions
(
this
,
row
,
singleSource
,
manager
,
openInNewWindow
));
refTablesMenu
.
addMenuListener
(
manager
->
ResultSetReferenceMenu
.
fillRefTablesActions
(
this
,
getSelection
().
getSelectedRows
(),
singleSource
,
manager
,
openInNewWindow
));
return
refTablesMenu
;
}
...
...
@@ -2561,7 +2558,7 @@ public class ResultSetViewer extends Viewer
}
@Override
public
void
navigateAssociation
(
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
DBSEntityAssociation
association
,
@Nullable
DBDAttributeBinding
attr
,
@NotNull
ResultSetRow
row
,
boolean
newWindow
)
public
void
navigateAssociation
(
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
DBSEntityAssociation
association
,
@Nullable
DBDAttributeBinding
attr
,
@NotNull
List
<
ResultSetRow
>
rows
,
boolean
newWindow
)
throws
DBException
{
if
(!
confirmProceed
())
{
...
...
@@ -2629,9 +2626,7 @@ public class ResultSetViewer extends Viewer
constraint
.
setVisible
(
true
);
constraints
.
add
(
constraint
);
Object
keyValue
=
model
.
getCellValue
(
ownBinding
,
row
);
constraint
.
setOperator
(
DBCLogicalOperator
.
EQUALS
);
constraint
.
setValue
(
keyValue
);
createFilterConstraint
(
rows
,
ownBinding
,
constraint
);
}
// Save cur data filter in state
curState
.
filter
=
new
DBDDataFilter
(
model
.
getDataFilter
());
...
...
@@ -2639,7 +2634,7 @@ public class ResultSetViewer extends Viewer
}
@Override
public
void
navigateReference
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSEntityAssociation
association
,
@NotNull
ResultSetRow
row
,
boolean
newWindow
)
public
void
navigateReference
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSEntityAssociation
association
,
@NotNull
List
<
ResultSetRow
>
rows
,
boolean
newWindow
)
throws
DBException
{
if
(!
confirmProceed
())
{
...
...
@@ -2691,14 +2686,28 @@ public class ResultSetViewer extends Viewer
constraint
.
setVisible
(
true
);
constraints
.
add
(
constraint
);
Object
keyValue
=
model
.
getCellValue
(
attrBinding
,
row
);
constraint
.
setOperator
(
DBCLogicalOperator
.
EQUALS
);
constraint
.
setValue
(
keyValue
);
createFilterConstraint
(
rows
,
attrBinding
,
constraint
);
}
}
navigateEntity
(
monitor
,
newWindow
,
targetEntity
,
constraints
);
}
private
void
createFilterConstraint
(
@NotNull
List
<
ResultSetRow
>
rows
,
DBDAttributeBinding
attrBinding
,
DBDAttributeConstraint
constraint
)
{
if
(
rows
.
size
()
==
1
)
{
Object
keyValue
=
model
.
getCellValue
(
attrBinding
,
rows
.
get
(
0
));
constraint
.
setOperator
(
DBCLogicalOperator
.
EQUALS
);
constraint
.
setValue
(
keyValue
);
}
else
{
Object
[]
keyValues
=
new
Object
[
rows
.
size
()];
for
(
int
k
=
0
;
k
<
rows
.
size
();
k
++)
{
keyValues
[
k
]
=
model
.
getCellValue
(
attrBinding
,
rows
.
get
(
k
));
}
constraint
.
setOperator
(
DBCLogicalOperator
.
IN
);
constraint
.
setValue
(
keyValues
);
}
}
private
void
navigateEntity
(
@NotNull
DBRProgressMonitor
monitor
,
boolean
newWindow
,
DBSEntity
targetEntity
,
List
<
DBDAttributeConstraint
>
constraints
)
{
DBDDataFilter
newFilter
=
new
DBDDataFilter
(
constraints
);
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
036e0ebd
...
...
@@ -1009,7 +1009,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
try
{
boolean
ctrlPressed
=
(
state
&
SWT
.
CTRL
)
==
SWT
.
CTRL
;
controller
.
navigateAssociation
(
monitor
,
null
,
attr
,
row
,
ctrlPressed
);
controller
.
navigateAssociation
(
monitor
,
null
,
attr
,
Collections
.
singletonList
(
row
)
,
ctrlPressed
);
}
catch
(
DBException
e
)
{
return
GeneralUtils
.
makeExceptionStatus
(
e
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录