Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
752f8660
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,发现更多精彩内容 >>
提交
752f8660
编写于
5月 08, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3201 Use navigator filters in results viewer
上级
947769ad
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
73 addition
and
35 deletion
+73
-35
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
...beaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
...dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
+2
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
....core/src/org/jkiss/dbeaver/core/CoreResources.properties
+2
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
...org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java
...g/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java
+26
-11
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+19
-17
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageResultSetMain.java
...g/jkiss/dbeaver/ui/preferences/PrefPageResultSetMain.java
+7
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/struct/JDBCTableColumn.java
...jkiss/dbeaver/model/impl/jdbc/struct/JDBCTableColumn.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNDatabaseNode.java
...rc/org/jkiss/dbeaver/model/navigator/DBNDatabaseNode.java
+14
-5
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/DBeaverPreferences.java
浏览文件 @
752f8660
...
...
@@ -139,6 +139,7 @@ public final class DBeaverPreferences
public
static
final
String
RESULT_SET_ROW_BATCH_SIZE
=
"resultset.show.row.batch.size"
;
//$NON-NLS-1$
public
static
final
String
RESULT_SET_PRESENTATION
=
"resultset.presentation.active"
;
//$NON-NLS-1$
public
static
final
String
RESULT_SET_STRING_USE_CONTENT_EDITOR
=
"resultset.string.use.content.editor"
;
//$NON-NLS-1$
public
static
final
String
RESULT_SET_USE_NAVIGATOR_FILTERS
=
"resultset.filter.use.navigator"
;
//$NON-NLS-1$
public
static
final
String
RESULT_TEXT_MAX_COLUMN_SIZE
=
"resultset.text.max.column.size"
;
//$NON-NLS-1$
public
static
final
String
RESULT_TEXT_VALUE_FORMAT
=
"resultset.text.value.format"
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
浏览文件 @
752f8660
...
...
@@ -759,6 +759,8 @@ public class CoreMessages extends NLS {
public
static
String
pref_page_content_editor_checkbox_keys_always_use_all_columns
;
public
static
String
pref_page_content_editor_checkbox_new_rows_after
;
public
static
String
pref_page_content_editor_checkbox_refresh_after_update
;
public
static
String
pref_page_content_editor_checkbox_use_navigator_filters
;
public
static
String
pref_page_content_editor_checkbox_use_navigator_filters_tip
;
public
static
String
pref_page_content_editor_group_content
;
public
static
String
pref_page_content_editor_label_max_text_length
;
public
static
String
pref_page_content_editor_group_hex
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
浏览文件 @
752f8660
...
...
@@ -753,6 +753,8 @@ pref_page_content_editor_checkbox_edit_long_as_lobs = Edit LONG columns as LOBs
pref_page_content_editor_checkbox_keys_always_use_all_columns
=
Always use all table columns as key
pref_page_content_editor_checkbox_new_rows_after
=
Insert new rows after current
pref_page_content_editor_checkbox_refresh_after_update
=
Refresh after update
pref_page_content_editor_checkbox_use_navigator_filters
=
Use navigator filters
pref_page_content_editor_checkbox_use_navigator_filters_tip
=
Filter (hide) columns according to database navigator filters
pref_page_content_editor_group_content
=
LOB
pref_page_content_editor_group_hex
=
Binary editor
pref_page_content_editor_group_keys
=
Unique keys
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
浏览文件 @
752f8660
...
...
@@ -192,6 +192,7 @@ public class DBeaverPreferencesInitializer extends AbstractPreferenceInitializer
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_SET_RIGHT_JUSTIFY_NUMBERS
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_SET_ROW_BATCH_SIZE
,
1
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_SET_STRING_USE_CONTENT_EDITOR
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_SET_USE_NAVIGATOR_FILTERS
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_MAX_COLUMN_SIZE
,
255
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
DBeaverPreferences
.
RESULT_TEXT_VALUE_FORMAT
,
DBDDisplayFormat
.
EDIT
.
name
());
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java
浏览文件 @
752f8660
...
...
@@ -21,17 +21,17 @@ import org.eclipse.core.runtime.Status;
import
org.eclipse.swt.graphics.Color
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataKind
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.data.*
;
import
org.jkiss.dbeaver.model.exec.*
;
import
org.jkiss.dbeaver.model.exec.trace.DBCTrace
;
import
org.jkiss.dbeaver.model.runtime.AbstractJob
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSAttributeBase
;
import
org.jkiss.dbeaver.model.struct.DBSDataManipulator
;
import
org.jkiss.dbeaver.model.struct.DBSEntity
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.model.virtual.DBVColorOverride
;
import
org.jkiss.dbeaver.model.virtual.DBVEntity
;
import
org.jkiss.dbeaver.model.virtual.DBVUtils
;
...
...
@@ -903,16 +903,31 @@ public class ResultSetModel {
private
void
fillVisibleAttributes
()
{
this
.
visibleAttributes
.
clear
();
if
(
executionSource
!=
null
&&
executionSource
.
getDataContainer
()
instanceof
DBSEntity
)
{
// Filter pseudo attributes if we query single entity
for
(
DBDAttributeBinding
binding
:
this
.
attributes
)
{
if
(
isVisibleByDefault
(
binding
))
{
// Make visible "real" attributes
this
.
visibleAttributes
.
add
(
binding
);
boolean
entityDataView
=
executionSource
!=
null
&&
executionSource
.
getDataContainer
()
instanceof
DBSEntity
;
DBSObjectFilter
columnFilter
=
null
;
if
(
entityDataView
)
{
// Detect column filter
DBSEntity
entity
=
(
DBSEntity
)
executionSource
.
getDataContainer
();
DBPDataSourceContainer
container
=
entity
.
getDataSource
().
getContainer
();
if
(
container
.
getPreferenceStore
().
getBoolean
(
DBeaverPreferences
.
RESULT_SET_USE_NAVIGATOR_FILTERS
)
&&
attributes
.
length
>
0
)
{
DBSEntityAttribute
entityAttribute
=
attributes
[
0
].
getEntityAttribute
();
if
(
entityAttribute
!=
null
)
{
columnFilter
=
container
.
getObjectFilter
(
entityAttribute
.
getClass
(),
entity
,
false
);
}
}
}
else
{
Collections
.
addAll
(
this
.
visibleAttributes
,
this
.
attributes
);
}
// Filter pseudo attributes if we query single entity
for
(
DBDAttributeBinding
binding
:
this
.
attributes
)
{
if
(!
entityDataView
||
isVisibleByDefault
(
binding
))
{
// Make visible "real" attributes
if
(
columnFilter
!=
null
&&
!
columnFilter
.
matches
(
binding
.
getName
()))
{
// Filtered out by column filter
continue
;
}
this
.
visibleAttributes
.
add
(
binding
);
}
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
752f8660
...
...
@@ -1739,18 +1739,18 @@ public class ResultSetViewer extends Viewer
}
manager
.
add
(
new
GroupMarker
(
MENU_GROUP_EDIT
));
// Filters and View
{
MenuManager
filtersMenu
=
new
MenuManager
(
CoreMessages
.
controls_resultset_viewer_action_order_filter
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
FILTER
),
MENU_ID_FILTERS
);
//$NON-NLS-1$
filtersMenu
.
setActionDefinitionId
(
ResultSetCommandHandler
.
CMD_FILTER_MENU
);
filtersMenu
.
setRemoveAllWhenShown
(
true
);
filtersMenu
.
addMenuListener
(
manager1
->
fillFiltersMenu
(
attr
,
manager1
));
manager
.
add
(
filtersMenu
);
}
if
(
dataSource
!=
null
&&
attr
!=
null
&&
model
.
getVisibleAttributeCount
()
>
0
&&
!
model
.
isUpdateInProgress
())
{
// Filters and View
{
MenuManager
filtersMenu
=
new
MenuManager
(
CoreMessages
.
controls_resultset_viewer_action_order_filter
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
FILTER
),
MENU_ID_FILTERS
);
//$NON-NLS-1$
filtersMenu
.
setActionDefinitionId
(
ResultSetCommandHandler
.
CMD_FILTER_MENU
);
filtersMenu
.
setRemoveAllWhenShown
(
true
);
filtersMenu
.
addMenuListener
(
manager1
->
fillFiltersMenu
(
attr
,
manager1
));
manager
.
add
(
filtersMenu
);
}
{
MenuManager
viewMenu
=
new
MenuManager
(
"View/Format"
,
...
...
@@ -2082,9 +2082,9 @@ public class ResultSetViewer extends Viewer
}
}
private
void
fillFiltersMenu
(
@N
otNull
DBDAttributeBinding
attribute
,
@NotNull
IMenuManager
filtersMenu
)
private
void
fillFiltersMenu
(
@N
ullable
DBDAttributeBinding
attribute
,
@NotNull
IMenuManager
filtersMenu
)
{
if
(
supportsDataFilter
())
{
if
(
attribute
!=
null
&&
supportsDataFilter
())
{
filtersMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_FILTER_MENU_DISTINCT
));
//filtersMenu.add(new FilterByListAction(operator, type, attribute));
...
...
@@ -2125,10 +2125,12 @@ public class ResultSetViewer extends Viewer
filtersMenu
.
add
(
new
FilterResetAttributeAction
(
attribute
));
}
}
filtersMenu
.
add
(
new
Separator
());
filtersMenu
.
add
(
new
OrderByAttributeAction
(
attribute
,
true
));
filtersMenu
.
add
(
new
OrderByAttributeAction
(
attribute
,
false
));
filtersMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_TOGGLE_ORDER
));
if
(
attribute
!=
null
)
{
filtersMenu
.
add
(
new
Separator
());
filtersMenu
.
add
(
new
OrderByAttributeAction
(
attribute
,
true
));
filtersMenu
.
add
(
new
OrderByAttributeAction
(
attribute
,
false
));
filtersMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetCommandHandler
.
CMD_TOGGLE_ORDER
));
}
filtersMenu
.
add
(
new
Separator
());
filtersMenu
.
add
(
new
ToggleServerSideOrderingAction
());
filtersMenu
.
add
(
new
ShowFiltersAction
(
true
));
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageResultSetMain.java
浏览文件 @
752f8660
...
...
@@ -50,6 +50,7 @@ public class PrefPageResultSetMain extends TargetPrefPage
private
Button
alwaysUseAllColumns
;
private
Button
newRowsAfter
;
private
Button
refreshAfterUpdate
;
private
Button
useNavigatorFilters
;
private
Button
advUseFetchSize
;
...
...
@@ -74,7 +75,8 @@ public class PrefPageResultSetMain extends TargetPrefPage
store
.
contains
(
DBeaverPreferences
.
RS_EDIT_REFRESH_AFTER_UPDATE
)
||
store
.
contains
(
DBeaverPreferences
.
KEEP_STATEMENT_OPEN
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_SET_ORDER_SERVER_SIDE
)
||
store
.
contains
(
ModelPreferences
.
RESULT_SET_USE_FETCH_SIZE
)
store
.
contains
(
ModelPreferences
.
RESULT_SET_USE_FETCH_SIZE
)
||
store
.
contains
(
DBeaverPreferences
.
RESULT_SET_USE_NAVIGATOR_FILTERS
)
;
}
...
...
@@ -123,6 +125,7 @@ public class PrefPageResultSetMain extends TargetPrefPage
alwaysUseAllColumns
=
UIUtils
.
createCheckbox
(
miscGroup
,
CoreMessages
.
pref_page_content_editor_checkbox_keys_always_use_all_columns
,
false
);
newRowsAfter
=
UIUtils
.
createCheckbox
(
miscGroup
,
CoreMessages
.
pref_page_content_editor_checkbox_new_rows_after
,
false
);
refreshAfterUpdate
=
UIUtils
.
createCheckbox
(
miscGroup
,
CoreMessages
.
pref_page_content_editor_checkbox_refresh_after_update
,
false
);
useNavigatorFilters
=
UIUtils
.
createCheckbox
(
miscGroup
,
CoreMessages
.
pref_page_content_editor_checkbox_use_navigator_filters
,
CoreMessages
.
pref_page_content_editor_checkbox_use_navigator_filters_tip
,
false
,
1
);
}
{
...
...
@@ -155,6 +158,7 @@ public class PrefPageResultSetMain extends TargetPrefPage
alwaysUseAllColumns
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RS_EDIT_USE_ALL_COLUMNS
));
newRowsAfter
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RS_EDIT_NEW_ROWS_AFTER
));
refreshAfterUpdate
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RS_EDIT_REFRESH_AFTER_UPDATE
));
useNavigatorFilters
.
setSelection
(
store
.
getBoolean
(
DBeaverPreferences
.
RESULT_SET_USE_NAVIGATOR_FILTERS
));
advUseFetchSize
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
RESULT_SET_USE_FETCH_SIZE
));
...
...
@@ -181,6 +185,7 @@ public class PrefPageResultSetMain extends TargetPrefPage
store
.
setValue
(
DBeaverPreferences
.
RS_EDIT_USE_ALL_COLUMNS
,
alwaysUseAllColumns
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RS_EDIT_NEW_ROWS_AFTER
,
newRowsAfter
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RS_EDIT_REFRESH_AFTER_UPDATE
,
refreshAfterUpdate
.
getSelection
());
store
.
setValue
(
DBeaverPreferences
.
RESULT_SET_USE_NAVIGATOR_FILTERS
,
useNavigatorFilters
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
RESULT_SET_USE_FETCH_SIZE
,
advUseFetchSize
.
getSelection
());
}
catch
(
Exception
e
)
{
...
...
@@ -205,6 +210,7 @@ public class PrefPageResultSetMain extends TargetPrefPage
store
.
setToDefault
(
DBeaverPreferences
.
RS_EDIT_USE_ALL_COLUMNS
);
store
.
setToDefault
(
DBeaverPreferences
.
RS_EDIT_NEW_ROWS_AFTER
);
store
.
setToDefault
(
DBeaverPreferences
.
RS_EDIT_REFRESH_AFTER_UPDATE
);
store
.
setToDefault
(
DBeaverPreferences
.
RESULT_SET_USE_NAVIGATOR_FILTERS
);
store
.
setToDefault
(
ModelPreferences
.
RESULT_SET_USE_FETCH_SIZE
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/struct/JDBCTableColumn.java
浏览文件 @
752f8660
...
...
@@ -45,7 +45,7 @@ import java.util.TreeSet;
/**
* JDBC abstract table column
*/
public
abstract
class
JDBCTableColumn
<
TABLE_TYPE
extends
DBSEntity
>
extends
JDBCAttribute
implements
DBSTableColumn
,
DBSAttributeEnumerable
,
DBPSaveableObject
{
public
abstract
class
JDBCTableColumn
<
TABLE_TYPE
extends
DBSEntity
>
extends
JDBCAttribute
implements
DBSTableColumn
,
DBS
EntityAttribute
,
DBS
AttributeEnumerable
,
DBPSaveableObject
{
private
final
TABLE_TYPE
table
;
private
boolean
persisted
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNDatabaseNode.java
浏览文件 @
752f8660
...
...
@@ -604,7 +604,7 @@ public abstract class DBNDatabaseNode extends DBNNode implements DBSWrapper, DBP
{
DBPDataSourceContainer
dataSource
=
getDataSourceContainer
();
if
(
dataSource
!=
null
&&
this
instanceof
DBNContainer
)
{
Class
<?>
childrenClass
=
this
.
getChildrenClass
(
meta
);
Class
<?>
childrenClass
=
this
.
getChildren
OrFolder
Class
(
meta
);
if
(
childrenClass
!=
null
)
{
Object
valueObject
=
getValueObject
();
DBSObject
parentObject
=
null
;
...
...
@@ -621,17 +621,19 @@ public abstract class DBNDatabaseNode extends DBNNode implements DBSWrapper, DBP
{
DBPDataSourceContainer
dataSource
=
getDataSourceContainer
();
if
(
dataSource
!=
null
&&
this
instanceof
DBNContainer
)
{
Class
<?>
childrenClass
=
this
.
getChildrenClass
(
meta
);
Class
<?>
childrenClass
=
this
.
getChildren
OrFolder
Class
(
meta
);
if
(
childrenClass
!=
null
)
{
Object
parentObject
=
getValueObject
();
if
(
parentObject
instanceof
DBPDataSource
)
{
parentObject
=
null
;
}
dataSource
.
setObjectFilter
(
this
.
getChildrenClass
(
meta
)
,
childrenClass
,
(
DBSObject
)
parentObject
,
filter
);
dataSource
.
persistConfiguration
();
}
else
{
log
.
error
(
"Cannot detect child node type - can't save filter configuration"
);
}
}
else
{
log
.
error
(
"No active datasource - can't save filter configuration"
);
...
...
@@ -750,8 +752,7 @@ public abstract class DBNDatabaseNode extends DBNNode implements DBSWrapper, DBP
}
}
protected
Class
<?>
getChildrenClass
(
DBXTreeItem
childMeta
)
{
protected
Class
<?>
getChildrenClass
(
DBXTreeItem
childMeta
)
{
Object
valueObject
=
getValueObject
();
if
(
valueObject
==
null
)
{
return
null
;
...
...
@@ -765,6 +766,14 @@ public abstract class DBNDatabaseNode extends DBNNode implements DBSWrapper, DBP
return
BeanUtils
.
getCollectionType
(
propType
);
}
protected
Class
<?>
getChildrenOrFolderClass
(
DBXTreeItem
childMeta
)
{
Class
<?>
childrenClass
=
this
.
getChildrenClass
(
childMeta
);
if
(
childrenClass
==
null
&&
this
instanceof
DBNContainer
)
{
childrenClass
=
((
DBNContainer
)
this
).
getChildrenClass
();
}
return
childrenClass
;
}
public
IProject
getOwnerProject
()
{
for
(
DBNNode
node
=
getParentNode
();
node
!=
null
;
node
=
node
.
getParentNode
())
{
if
(
node
instanceof
DBNProject
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录