Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
715afe28
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,发现更多精彩内容 >>
提交
715afe28
编写于
4月 23, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Results viewer context menu redesign
Former-commit-id:
cde364ce
上级
0c590830
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
61 addition
and
48 deletion
+61
-48
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/IResultSetController.java
...s/dbeaver/ui/controls/resultset/IResultSetController.java
+3
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+33
-24
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+25
-24
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/IResultSetController.java
浏览文件 @
715afe28
...
...
@@ -43,6 +43,9 @@ import java.util.List;
*/
public
interface
IResultSetController
extends
DBPContextProvider
{
String
MENU_ID_EDIT
=
"edit"
;
String
MENU_ID_VIEW
=
"view"
;
String
MENU_ID_FILTERS
=
"filters"
;
String
MENU_GROUP_EDIT
=
"edit"
;
@NotNull
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
715afe28
...
...
@@ -1704,41 +1704,50 @@ public class ResultSetViewer extends Viewer
if
(
valueController
!=
null
)
{
manager
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
IWorkbenchCommandConstants
.
EDIT_PASTE
));
manager
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
CoreCommands
.
CMD_PASTE_SPECIAL
));
manager
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
IWorkbenchCommandConstants
.
EDIT_DELETE
));
// Edit items
{
manager
.
add
(
new
Separator
());
manager
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_EDIT
));
manager
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_EDIT_INLINE
));
MenuManager
editMenu
=
new
MenuManager
(
CoreMessages
.
actions_menu_edit
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
ROW_EDIT
),
MENU_ID_EDIT
);
//$NON-NLS-1$
// Edit items
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_EDIT
));
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_EDIT_INLINE
));
if
(!
valueController
.
isReadOnly
()
&&
!
DBUtils
.
isNullValue
(
value
)
/* && !attr.isRequired()*/
)
{
manager
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_CELL_SET_NULL
));
}
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_CELL_SET_NULL
));
}
manager
.
add
(
new
GroupMarker
(
MENU_GROUP_EDIT
));
if
(
row
.
getState
()
==
ResultSetRow
.
STATE_REMOVED
||
(
row
.
changes
!=
null
&&
row
.
changes
.
containsKey
(
attr
)))
{
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_CELL_RESET
));
}
if
(
valueController
!=
null
)
{
// Menus from value handler
try
{
manager
.
add
(
new
Separator
());
valueController
.
getValueManager
().
contributeActions
(
manager
,
valueController
,
null
);
valueController
.
getValueManager
().
contributeActions
(
editMenu
,
valueController
,
null
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
}
if
(
row
.
getState
()
==
ResultSetRow
.
STATE_REMOVED
||
(
row
.
changes
!=
null
&&
row
.
changes
.
containsKey
(
attr
)))
{
manager
.
insertAfter
(
IResultSetController
.
MENU_GROUP_EDIT
,
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_CELL_RESET
));
editMenu
.
add
(
new
Separator
());
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_ADD
));
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_COPY
));
editMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_ROW_DELETE
));
editMenu
.
add
(
new
GroupMarker
(
MENU_GROUP_EDIT
));
manager
.
add
(
editMenu
);
}
}
}
}
if
(
dataSource
!=
null
&&
attr
!=
null
&&
model
.
getVisibleAttributeCount
()
>
0
&&
!
model
.
isUpdateInProgress
())
{
// Filters and View
manager
.
add
(
new
Separator
());
{
MenuManager
filtersMenu
=
new
MenuManager
(
CoreMessages
.
controls_resultset_viewer_action_order_filter
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
FILTER
),
"filters"
);
//$NON-NLS-1$
MENU_ID_FILTERS
);
//$NON-NLS-1$
filtersMenu
.
setActionDefinitionId
(
ResultSetCommandHandler
.
CMD_FILTER_MENU
);
filtersMenu
.
setRemoveAllWhenShown
(
true
);
filtersMenu
.
addMenuListener
(
manager1
->
fillFiltersMenu
(
attr
,
manager1
));
...
...
@@ -1748,7 +1757,7 @@ public class ResultSetViewer extends Viewer
MenuManager
viewMenu
=
new
MenuManager
(
"View/Format"
,
null
,
"view"
);
//$NON-NLS-1$
MENU_ID_VIEW
);
//$NON-NLS-1$
List
<?
extends
DBDAttributeTransformerDescriptor
>
transformers
=
dataSource
.
getContainer
().
getPlatform
().
getValueHandlerRegistry
().
findTransformers
(
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
715afe28
...
...
@@ -39,6 +39,7 @@ import org.eclipse.core.runtime.IStatus;
import
org.eclipse.core.runtime.Status
;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.IMenuManager
;
import
org.eclipse.jface.action.Separator
;
import
org.eclipse.jface.resource.ColorRegistry
;
import
org.eclipse.jface.text.IFindReplaceTarget
;
import
org.eclipse.jface.viewers.ISelection
;
...
...
@@ -179,11 +180,8 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
fireSelectionChanged
(
new
SpreadsheetSelectionImpl
());
}
});
this
.
spreadsheet
.
addMouseWheelListener
(
new
MouseWheelListener
()
{
@Override
public
void
mouseScrolled
(
MouseEvent
e
)
{
this
.
spreadsheet
.
addMouseWheelListener
(
e
->
{
}
});
spreadsheet
.
addControlListener
(
new
ControlAdapter
()
{
@Override
...
...
@@ -734,6 +732,8 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
if
(
attr
!=
null
&&
row
!=
null
)
{
final
List
<
Object
>
selectedColumns
=
spreadsheet
.
getColumnSelection
();
if
(!
controller
.
isRecordMode
()
&&
!
selectedColumns
.
isEmpty
())
{
IMenuManager
viewMenu
=
(
IMenuManager
)
manager
.
find
(
ResultSetViewer
.
MENU_ID_VIEW
);
if
(
viewMenu
!=
null
)
{
String
hideTitle
;
if
(
selectedColumns
.
size
()
==
1
)
{
DBDAttributeBinding
columnToHide
=
(
DBDAttributeBinding
)
selectedColumns
.
get
(
0
);
...
...
@@ -741,10 +741,10 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
}
else
{
hideTitle
=
"Hide selected columns ("
+
selectedColumns
.
size
()
+
")"
;
}
manager
.
insertAfter
(
IResultSetController
.
MENU_GROUP_EDIT
,
new
Action
(
hideTitle
)
{
viewMenu
.
add
(
new
Separator
());
viewMenu
.
add
(
new
Action
(
hideTitle
)
{
@Override
public
void
run
()
{
public
void
run
()
{
ResultSetModel
model
=
controller
.
getModel
();
if
(
selectedColumns
.
size
()
>=
model
.
getVisibleAttributeCount
())
{
UIUtils
.
showMessageBox
(
getControl
().
getShell
(),
"Hide columns"
,
"Can't hide all result columns, at least one column must be visible"
,
SWT
.
ERROR
);
...
...
@@ -759,6 +759,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
}
}
}
}
/////////////////////////////////////////////////
// Edit
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录