Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
5a13318c
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,发现更多精彩内容 >>
提交
5a13318c
编写于
8月 10, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6344 Default table editor page configuration
上级
c034f362
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
174 addition
and
46 deletion
+174
-46
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/AbstractContextDescriptor.java
...g/jkiss/dbeaver/model/impl/AbstractContextDescriptor.java
+4
-0
plugins/org.jkiss.dbeaver.ui.editors.base/src/org/jkiss/dbeaver/ui/editors/MultiPageDatabaseEditor.java
...org/jkiss/dbeaver/ui/editors/MultiPageDatabaseEditor.java
+3
-0
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/Spreadsheet.java
...beaver/ui/controls/resultset/spreadsheet/Spreadsheet.java
+4
-2
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/editors/data/preferences/PrefPageResultSetPresentation.java
...itors/data/preferences/PrefPageResultSetPresentation.java
+7
-2
plugins/org.jkiss.dbeaver.ui.navigator/plugin.xml
plugins/org.jkiss.dbeaver.ui.navigator/plugin.xml
+4
-1
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/EntityEditorsRegistry.java
...kiss/dbeaver/ui/editors/entity/EntityEditorsRegistry.java
+4
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/internal/UINavigatorMessages.java
...rc/org/jkiss/dbeaver/ui/internal/UINavigatorMessages.java
+2
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/internal/UINavigatorMessages.properties
.../jkiss/dbeaver/ui/internal/UINavigatorMessages.properties
+3
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/internal/UINavigatorPreferencesInitializer.java
...beaver/ui/internal/UINavigatorPreferencesInitializer.java
+3
-4
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorPreferences.java
.../org/jkiss/dbeaver/ui/navigator/NavigatorPreferences.java
+8
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorUtils.java
...or/src/org/jkiss/dbeaver/ui/navigator/NavigatorUtils.java
+11
-2
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerObjectOpen.java
...aver/ui/navigator/actions/NavigatorHandlerObjectOpen.java
+1
-1
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/NavigatorViewBase.java
...kiss/dbeaver/ui/navigator/database/NavigatorViewBase.java
+30
-18
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/preferences/PrefPageDatabaseNavigator.java
...iss/dbeaver/ui/preferences/PrefPageDatabaseNavigator.java
+60
-13
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ActionUtils.java
...kiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ActionUtils.java
+30
-3
未找到文件。
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/AbstractContextDescriptor.java
浏览文件 @
5a13318c
...
@@ -57,6 +57,10 @@ public abstract class AbstractContextDescriptor extends AbstractDescriptor
...
@@ -57,6 +57,10 @@ public abstract class AbstractContextDescriptor extends AbstractDescriptor
return
!
objectTypes
.
isEmpty
();
return
!
objectTypes
.
isEmpty
();
}
}
public
List
<
ObjectType
>
getObjectTypes
()
{
return
objectTypes
;
}
public
boolean
appliesTo
(
DBPObject
object
)
public
boolean
appliesTo
(
DBPObject
object
)
{
{
return
appliesTo
(
object
,
null
);
return
appliesTo
(
object
,
null
);
...
...
plugins/org.jkiss.dbeaver.ui.editors.base/src/org/jkiss/dbeaver/ui/editors/MultiPageDatabaseEditor.java
浏览文件 @
5a13318c
...
@@ -32,6 +32,9 @@ import org.jkiss.dbeaver.ui.css.DBStyles;
...
@@ -32,6 +32,9 @@ import org.jkiss.dbeaver.ui.css.DBStyles;
*/
*/
public
abstract
class
MultiPageDatabaseEditor
extends
MultiPageAbstractEditor
implements
IDatabaseEditor
,
DBPContextProvider
public
abstract
class
MultiPageDatabaseEditor
extends
MultiPageAbstractEditor
implements
IDatabaseEditor
,
DBPContextProvider
{
{
public
static
final
String
PARAMETER_ACTIVE_PAGE
=
"activePage"
;
public
static
final
String
PARAMETER_ACTIVE_FOLDER
=
"activeFolder"
;
private
DatabaseEditorListener
listener
;
private
DatabaseEditorListener
listener
;
@Override
@Override
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/Spreadsheet.java
浏览文件 @
5a13318c
...
@@ -36,6 +36,7 @@ import org.jkiss.dbeaver.ui.UIUtils;
...
@@ -36,6 +36,7 @@ import org.jkiss.dbeaver.ui.UIUtils;
import
org.jkiss.dbeaver.ui.controls.lightgrid.*
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.*
;
import
org.jkiss.dbeaver.ui.controls.resultset.AbstractPresentation
;
import
org.jkiss.dbeaver.ui.controls.resultset.AbstractPresentation
;
import
org.jkiss.dbeaver.ui.controls.resultset.ResultSetPreferences
;
import
org.jkiss.dbeaver.ui.controls.resultset.ResultSetPreferences
;
import
org.jkiss.utils.CommonUtils
;
/**
/**
* ResultSetControl
* ResultSetControl
...
@@ -280,8 +281,9 @@ public class Spreadsheet extends LightGrid implements Listener {
...
@@ -280,8 +281,9 @@ public class Spreadsheet extends LightGrid implements Listener {
GridPos
pos
=
super
.
getCell
(
new
Point
(
event
.
x
,
event
.
y
));
GridPos
pos
=
super
.
getCell
(
new
Point
(
event
.
x
,
event
.
y
));
GridPos
focusPos
=
super
.
getFocusPos
();
GridPos
focusPos
=
super
.
getFocusPos
();
if
(
pos
!=
null
&&
focusPos
!=
null
&&
pos
.
equals
(
super
.
getFocusPos
()))
{
if
(
pos
!=
null
&&
focusPos
!=
null
&&
pos
.
equals
(
super
.
getFocusPos
()))
{
DoubleClickBehavior
doubleClickBehavior
=
DoubleClickBehavior
.
valueOf
(
DoubleClickBehavior
doubleClickBehavior
=
CommonUtils
.
valueOf
(
DoubleClickBehavior
.
class
,
presentation
.
getPreferenceStore
().
getString
(
ResultSetPreferences
.
RESULT_SET_DOUBLE_CLICK
));
presentation
.
getPreferenceStore
().
getString
(
ResultSetPreferences
.
RESULT_SET_DOUBLE_CLICK
),
DoubleClickBehavior
.
NONE
);
switch
(
doubleClickBehavior
)
{
switch
(
doubleClickBehavior
)
{
case
NONE:
case
NONE:
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/editors/data/preferences/PrefPageResultSetPresentation.java
浏览文件 @
5a13318c
...
@@ -174,7 +174,11 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
...
@@ -174,7 +174,11 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
gridShowAttrFilters
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_FILTERS
));
gridShowAttrFilters
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_FILTERS
));
gridShowAttrOrder
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_ORDERING
));
gridShowAttrOrder
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_ORDERING
));
gridDoubleClickBehavior
.
select
(
gridDoubleClickBehavior
.
select
(
Spreadsheet
.
DoubleClickBehavior
.
valueOf
(
store
.
getString
(
ResultSetPreferences
.
RESULT_SET_DOUBLE_CLICK
)).
ordinal
());
CommonUtils
.
valueOf
(
Spreadsheet
.
DoubleClickBehavior
.
class
,
store
.
getString
(
ResultSetPreferences
.
RESULT_SET_DOUBLE_CLICK
),
Spreadsheet
.
DoubleClickBehavior
.
NONE
)
.
ordinal
());
autoSwitchMode
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_AUTO_SWITCH_MODE
));
autoSwitchMode
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_AUTO_SWITCH_MODE
));
showDescription
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_SHOW_DESCRIPTION
));
showDescription
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_SHOW_DESCRIPTION
));
columnWidthByValue
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_CALC_COLUMN_WIDTH_BY_VALUES
));
columnWidthByValue
.
setSelection
(
store
.
getBoolean
(
ResultSetPreferences
.
RESULT_SET_CALC_COLUMN_WIDTH_BY_VALUES
));
...
@@ -206,7 +210,8 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
...
@@ -206,7 +210,8 @@ public class PrefPageResultSetPresentation extends TargetPrefPage
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_ICONS
,
gridShowAttrIcons
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_ICONS
,
gridShowAttrIcons
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_FILTERS
,
gridShowAttrFilters
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_FILTERS
,
gridShowAttrFilters
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_ORDERING
,
gridShowAttrOrder
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_ATTR_ORDERING
,
gridShowAttrOrder
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_DOUBLE_CLICK
,
CommonUtils
.
fromOrdinal
(
Spreadsheet
.
DoubleClickBehavior
.
class
,
gridDoubleClickBehavior
.
getSelectionIndex
()).
name
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_DOUBLE_CLICK
,
CommonUtils
.
fromOrdinal
(
Spreadsheet
.
DoubleClickBehavior
.
class
,
gridDoubleClickBehavior
.
getSelectionIndex
()).
name
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_AUTO_SWITCH_MODE
,
autoSwitchMode
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_AUTO_SWITCH_MODE
,
autoSwitchMode
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_DESCRIPTION
,
showDescription
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_SHOW_DESCRIPTION
,
showDescription
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_CALC_COLUMN_WIDTH_BY_VALUES
,
columnWidthByValue
.
getSelection
());
store
.
setValue
(
ResultSetPreferences
.
RESULT_SET_CALC_COLUMN_WIDTH_BY_VALUES
,
columnWidthByValue
.
getSelection
());
...
...
plugins/org.jkiss.dbeaver.ui.navigator/plugin.xml
浏览文件 @
5a13318c
...
@@ -213,7 +213,10 @@
...
@@ -213,7 +213,10 @@
<extension
point=
"org.eclipse.ui.commands"
>
<extension
point=
"org.eclipse.ui.commands"
>
<category
id=
"org.jkiss.dbeaver.core.navigator"
name=
"%category.dbnavigator.name"
description=
"%category.dbnavigator.description"
/>
<category
id=
"org.jkiss.dbeaver.core.navigator"
name=
"%category.dbnavigator.name"
description=
"%category.dbnavigator.description"
/>
<command
id=
"org.jkiss.dbeaver.core.object.open"
name=
"%command.org.jkiss.dbeaver.core.object.open.name"
description=
"%command.org.jkiss.dbeaver.core.object.open.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
<command
id=
"org.jkiss.dbeaver.core.object.open"
name=
"%command.org.jkiss.dbeaver.core.object.open.name"
description=
"%command.org.jkiss.dbeaver.core.object.open.description"
categoryId=
"org.jkiss.dbeaver.core.database"
>
<commandParameter
id=
"activePage"
name=
"Active page"
optional=
"true"
/>
<commandParameter
id=
"activeFolder"
name=
"Active folder"
optional=
"true"
/>
</command>
<command
id=
"org.jkiss.dbeaver.core.object.create"
name=
"%command.org.jkiss.dbeaver.core.object.create.name"
description=
"%command.org.jkiss.dbeaver.core.object.create.description"
categoryId=
"org.jkiss.dbeaver.core.database"
>
<command
id=
"org.jkiss.dbeaver.core.object.create"
name=
"%command.org.jkiss.dbeaver.core.object.create.name"
description=
"%command.org.jkiss.dbeaver.core.object.create.description"
categoryId=
"org.jkiss.dbeaver.core.database"
>
<commandParameter
id=
"org.jkiss.dbeaver.core.object.type"
name=
"Object type"
optional=
"true"
/>
<commandParameter
id=
"org.jkiss.dbeaver.core.object.type"
name=
"Object type"
optional=
"true"
/>
<commandParameter
id=
"org.jkiss.dbeaver.core.object.typeName"
name=
"Object type name"
optional=
"true"
/>
<commandParameter
id=
"org.jkiss.dbeaver.core.object.typeName"
name=
"Object type name"
optional=
"true"
/>
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/EntityEditorsRegistry.java
浏览文件 @
5a13318c
...
@@ -87,6 +87,10 @@ public class EntityEditorsRegistry {
...
@@ -87,6 +87,10 @@ public class EntityEditorsRegistry {
return
defaultEditor
;
return
defaultEditor
;
}
}
public
List
<
EntityEditorDescriptor
>
getEntityEditors
()
{
return
entityEditors
;
}
public
List
<
EntityEditorDescriptor
>
getEntityEditors
(
DBPObject
object
,
IEntityEditorContext
context
,
String
position
)
{
public
List
<
EntityEditorDescriptor
>
getEntityEditors
(
DBPObject
object
,
IEntityEditorContext
context
,
String
position
)
{
List
<
EntityEditorDescriptor
>
editors
=
new
ArrayList
<>();
List
<
EntityEditorDescriptor
>
editors
=
new
ArrayList
<>();
final
List
<
EntityEditorDescriptor
>
positionList
=
final
List
<
EntityEditorDescriptor
>
positionList
=
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/internal/UINavigatorMessages.java
浏览文件 @
5a13318c
...
@@ -105,6 +105,8 @@ public class UINavigatorMessages extends NLS {
...
@@ -105,6 +105,8 @@ public class UINavigatorMessages extends NLS {
public
static
String
pref_page_database_general_label_double_click_connection_open_sqleditor
;
public
static
String
pref_page_database_general_label_double_click_connection_open_sqleditor
;
public
static
String
pref_page_database_general_label_double_click_connection_open_new_sqleditor
;
public
static
String
pref_page_database_general_label_double_click_connection_open_new_sqleditor
;
public
static
String
pref_page_database_general_label_double_click_connection_expand_collapse
;
public
static
String
pref_page_database_general_label_double_click_connection_expand_collapse
;
public
static
String
pref_page_navigator_default_editor_page_label
;
public
static
String
pref_page_navigator_default_editor_page_tip
;
// ProjectSettings
// ProjectSettings
public
static
String
pref_page_projects_settings_label_resource_location
;
public
static
String
pref_page_projects_settings_label_resource_location
;
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/internal/UINavigatorMessages.properties
浏览文件 @
5a13318c
...
@@ -81,6 +81,9 @@ pref_page_database_general_label_double_click_connection_conn_disconn = Connect
...
@@ -81,6 +81,9 @@ pref_page_database_general_label_double_click_connection_conn_disconn = Connect
pref_page_database_general_label_double_click_connection_open_sqleditor
=
Open SQL Editor
pref_page_database_general_label_double_click_connection_open_sqleditor
=
Open SQL Editor
pref_page_database_general_label_double_click_connection_open_new_sqleditor
=
Open new SQL Editor
pref_page_database_general_label_double_click_connection_open_new_sqleditor
=
Open new SQL Editor
pref_page_database_general_label_double_click_connection_expand_collapse
=
Expand / Collapse
pref_page_database_general_label_double_click_connection_expand_collapse
=
Expand / Collapse
pref_page_navigator_default_editor_page_label
=
Default editor page
pref_page_navigator_default_editor_page_tip
=
Activates specified page in object editors. If not specified then activates default page
#ProjectSettings
#ProjectSettings
pref_page_projects_settings_label_resource_location
=
Resource locations
pref_page_projects_settings_label_resource_location
=
Resource locations
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/internal/UINavigatorPreferencesInitializer.java
浏览文件 @
5a13318c
...
@@ -17,11 +17,9 @@
...
@@ -17,11 +17,9 @@
package
org.jkiss.dbeaver.ui.internal
;
package
org.jkiss.dbeaver.ui.internal
;
import
org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
;
import
org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorPreferences
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorPreferences
;
import
org.jkiss.dbeaver.ui.navigator.database.NavigatorViewBase
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
/**
/**
...
@@ -46,8 +44,9 @@ public class UINavigatorPreferencesInitializer extends AbstractPreferenceInitial
...
@@ -46,8 +44,9 @@ public class UINavigatorPreferencesInitializer extends AbstractPreferenceInitial
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_GROUP_BY_DRIVER
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_GROUP_BY_DRIVER
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_EDITOR_SHOW_TABLE_GRID
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_EDITOR_SHOW_TABLE_GRID
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
,
NavigatorViewBase
.
DoubleClickBehavior
.
EDIT
.
name
());
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
,
NavigatorPreferences
.
DoubleClickBehavior
.
EDIT
.
name
());
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
,
NavigatorViewBase
.
DoubleClickBehavior
.
EXPAND
.
name
());
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
,
NavigatorPreferences
.
DoubleClickBehavior
.
EXPAND
.
name
());
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_DEFAULT_EDITOR_PAGE
,
""
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_SHOW_SQL_PREVIEW
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_SHOW_SQL_PREVIEW
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_SHOW_OBJECT_TIPS
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_SHOW_OBJECT_TIPS
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_LONG_LIST_FETCH_SIZE
,
5000
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
NavigatorPreferences
.
NAVIGATOR_LONG_LIST_FETCH_SIZE
,
5000
);
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorPreferences.java
浏览文件 @
5a13318c
...
@@ -31,6 +31,7 @@ public class NavigatorPreferences {
...
@@ -31,6 +31,7 @@ public class NavigatorPreferences {
public
static
final
String
NAVIGATOR_EDITOR_SHOW_TABLE_GRID
=
"navigator.editor.showGrid"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_EDITOR_SHOW_TABLE_GRID
=
"navigator.editor.showGrid"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_OBJECT_DOUBLE_CLICK
=
"navigator.object.doubleClick"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_OBJECT_DOUBLE_CLICK
=
"navigator.object.doubleClick"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_CONNECTION_DOUBLE_CLICK
=
"navigator.connection.doubleClick"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_CONNECTION_DOUBLE_CLICK
=
"navigator.connection.doubleClick"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_DEFAULT_EDITOR_PAGE
=
"navigator.object.defaultEditorPage"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_SHOW_SQL_PREVIEW
=
"navigator.editor.show.preview"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_SHOW_SQL_PREVIEW
=
"navigator.editor.show.preview"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_SHOW_OBJECT_TIPS
=
"navigator.show.objects.tips"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_SHOW_OBJECT_TIPS
=
"navigator.show.objects.tips"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_LONG_LIST_FETCH_SIZE
=
"navigator.long.list.fetch.size"
;
//$NON-NLS-1$
public
static
final
String
NAVIGATOR_LONG_LIST_FETCH_SIZE
=
"navigator.long.list.fetch.size"
;
//$NON-NLS-1$
...
@@ -48,4 +49,11 @@ public class NavigatorPreferences {
...
@@ -48,4 +49,11 @@ public class NavigatorPreferences {
public
static
final
int
MIN_LONG_LIST_FETCH_SIZE
=
100
;
public
static
final
int
MIN_LONG_LIST_FETCH_SIZE
=
100
;
public
enum
DoubleClickBehavior
{
EDIT
,
CONNECT
,
SQL_EDITOR
,
EXPAND
,
SQL_EDITOR_NEW
}
}
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorUtils.java
浏览文件 @
5a13318c
...
@@ -49,6 +49,7 @@ import org.jkiss.dbeaver.ui.UIUtils;
...
@@ -49,6 +49,7 @@ import org.jkiss.dbeaver.ui.UIUtils;
import
org.jkiss.dbeaver.ui.controls.ViewerColumnController
;
import
org.jkiss.dbeaver.ui.controls.ViewerColumnController
;
import
org.jkiss.dbeaver.ui.dnd.DatabaseObjectTransfer
;
import
org.jkiss.dbeaver.ui.dnd.DatabaseObjectTransfer
;
import
org.jkiss.dbeaver.ui.dnd.TreeNodeTransfer
;
import
org.jkiss.dbeaver.ui.dnd.TreeNodeTransfer
;
import
org.jkiss.dbeaver.ui.editors.MultiPageDatabaseEditor
;
import
org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectOpen
;
import
org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectOpen
;
import
org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerRefresh
;
import
org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerRefresh
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView
;
...
@@ -242,13 +243,17 @@ public class NavigatorUtils {
...
@@ -242,13 +243,17 @@ public class NavigatorUtils {
}
}
public
static
void
executeNodeAction
(
DBXTreeNodeHandler
.
Action
action
,
Object
node
,
IServiceLocator
serviceLocator
)
{
public
static
void
executeNodeAction
(
DBXTreeNodeHandler
.
Action
action
,
Object
node
,
IServiceLocator
serviceLocator
)
{
executeNodeAction
(
action
,
node
,
null
,
serviceLocator
);
}
public
static
void
executeNodeAction
(
DBXTreeNodeHandler
.
Action
action
,
Object
node
,
Map
<
String
,
Object
>
parameters
,
IServiceLocator
serviceLocator
)
{
String
defCommandId
=
null
;
String
defCommandId
=
null
;
if
(
action
==
DBXTreeNodeHandler
.
Action
.
open
)
{
if
(
action
==
DBXTreeNodeHandler
.
Action
.
open
)
{
defCommandId
=
NavigatorCommands
.
CMD_OBJECT_OPEN
;
defCommandId
=
NavigatorCommands
.
CMD_OBJECT_OPEN
;
}
}
String
actionCommand
=
getNodeActionCommand
(
action
,
node
,
defCommandId
);
String
actionCommand
=
getNodeActionCommand
(
action
,
node
,
defCommandId
);
if
(
actionCommand
!=
null
)
{
if
(
actionCommand
!=
null
)
{
ActionUtils
.
runCommand
(
actionCommand
,
new
StructuredSelection
(
node
),
serviceLocator
);
ActionUtils
.
runCommand
(
actionCommand
,
new
StructuredSelection
(
node
),
parameters
,
serviceLocator
);
}
else
{
}
else
{
// do nothing
// do nothing
// TODO: implement some other behavior
// TODO: implement some other behavior
...
@@ -551,15 +556,19 @@ public class NavigatorUtils {
...
@@ -551,15 +556,19 @@ public class NavigatorUtils {
}
}
public
static
void
openNavigatorNode
(
Object
node
,
IWorkbenchWindow
window
)
{
public
static
void
openNavigatorNode
(
Object
node
,
IWorkbenchWindow
window
)
{
}
public
static
void
openNavigatorNode
(
Object
node
,
IWorkbenchWindow
window
,
Map
<?,
?>
parameters
)
{
if
(
node
instanceof
DBNResource
)
{
if
(
node
instanceof
DBNResource
)
{
UIServiceSQL
serviceSQL
=
DBWorkbench
.
getService
(
UIServiceSQL
.
class
);
UIServiceSQL
serviceSQL
=
DBWorkbench
.
getService
(
UIServiceSQL
.
class
);
if
(
serviceSQL
!=
null
)
{
if
(
serviceSQL
!=
null
)
{
serviceSQL
.
openResource
(((
DBNResource
)
node
).
getResource
());
serviceSQL
.
openResource
(((
DBNResource
)
node
).
getResource
());
}
}
}
else
if
(
node
instanceof
DBNNode
&&
((
DBNNode
)
node
).
allowsOpen
())
{
}
else
if
(
node
instanceof
DBNNode
&&
((
DBNNode
)
node
).
allowsOpen
())
{
Object
activePage
=
parameters
==
null
?
null
:
parameters
.
get
(
MultiPageDatabaseEditor
.
PARAMETER_ACTIVE_PAGE
);
NavigatorHandlerObjectOpen
.
openEntityEditor
(
NavigatorHandlerObjectOpen
.
openEntityEditor
(
(
DBNNode
)
node
,
(
DBNNode
)
node
,
null
,
CommonUtils
.
toString
(
activePage
,
null
)
,
window
);
window
);
}
}
}
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerObjectOpen.java
浏览文件 @
5a13318c
...
@@ -105,7 +105,7 @@ public class NavigatorHandlerObjectOpen extends NavigatorHandlerObjectBase imple
...
@@ -105,7 +105,7 @@ public class NavigatorHandlerObjectOpen extends NavigatorHandlerObjectBase imple
}
}
}
}
if
(
node
!=
null
)
{
if
(
node
!=
null
)
{
NavigatorUtils
.
openNavigatorNode
(
node
,
HandlerUtil
.
getActiveWorkbenchWindow
(
event
));
NavigatorUtils
.
openNavigatorNode
(
node
,
HandlerUtil
.
getActiveWorkbenchWindow
(
event
)
,
event
.
getParameters
()
);
}
}
}
}
}
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/NavigatorViewBase.java
浏览文件 @
5a13318c
...
@@ -33,11 +33,13 @@ import org.jkiss.dbeaver.model.IDataSourceContainerProvider;
...
@@ -33,11 +33,13 @@ import org.jkiss.dbeaver.model.IDataSourceContainerProvider;
import
org.jkiss.dbeaver.model.navigator.*
;
import
org.jkiss.dbeaver.model.navigator.*
;
import
org.jkiss.dbeaver.model.navigator.meta.DBXTreeNodeHandler
;
import
org.jkiss.dbeaver.model.navigator.meta.DBXTreeNodeHandler
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceListener
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceListener
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceConnections
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceConnections
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceSQL
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceSQL
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.PropertyPageStandard
;
import
org.jkiss.dbeaver.ui.controls.PropertyPageStandard
;
import
org.jkiss.dbeaver.ui.editors.MultiPageDatabaseEditor
;
import
org.jkiss.dbeaver.ui.navigator.INavigatorFilter
;
import
org.jkiss.dbeaver.ui.navigator.INavigatorFilter
;
import
org.jkiss.dbeaver.ui.navigator.INavigatorModelView
;
import
org.jkiss.dbeaver.ui.navigator.INavigatorModelView
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorPreferences
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorPreferences
;
...
@@ -47,17 +49,11 @@ import org.jkiss.dbeaver.ui.navigator.database.load.TreeNodeSpecial;
...
@@ -47,17 +49,11 @@ import org.jkiss.dbeaver.ui.navigator.database.load.TreeNodeSpecial;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Map
;
public
abstract
class
NavigatorViewBase
extends
ViewPart
implements
INavigatorModelView
,
IDataSourceContainerProvider
,
DBPPreferenceListener
{
public
abstract
class
NavigatorViewBase
extends
ViewPart
implements
INavigatorModelView
,
IDataSourceContainerProvider
,
DBPPreferenceListener
{
public
enum
DoubleClickBehavior
{
EDIT
,
CONNECT
,
SQL_EDITOR
,
EXPAND
,
SQL_EDITOR_NEW
,
}
private
DBNModel
model
;
private
DBNModel
model
;
private
DatabaseNavigatorTree
tree
;
private
DatabaseNavigatorTree
tree
;
private
transient
Object
lastSelection
;
private
transient
Object
lastSelection
;
...
@@ -126,8 +122,11 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
...
@@ -126,8 +122,11 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
if
((
node
instanceof
DBNResource
&&
((
DBNResource
)
node
).
getResource
()
instanceof
IFolder
))
{
if
((
node
instanceof
DBNResource
&&
((
DBNResource
)
node
).
getResource
()
instanceof
IFolder
))
{
toggleNode
(
viewer
,
node
);
toggleNode
(
viewer
,
node
);
}
else
if
(
node
instanceof
DBNDataSource
)
{
}
else
if
(
node
instanceof
DBNDataSource
)
{
DoubleClickBehavior
dsBehaviorDefault
=
DoubleClickBehavior
.
valueOf
(
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getString
(
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
));
NavigatorPreferences
.
DoubleClickBehavior
dsBehaviorDefault
=
CommonUtils
.
valueOf
(
if
(
dsBehaviorDefault
==
DoubleClickBehavior
.
EXPAND
)
{
NavigatorPreferences
.
DoubleClickBehavior
.
class
,
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getString
(
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
),
NavigatorPreferences
.
DoubleClickBehavior
.
EDIT
);
if
(
dsBehaviorDefault
==
NavigatorPreferences
.
DoubleClickBehavior
.
EXPAND
)
{
toggleNode
(
viewer
,
node
);
toggleNode
(
viewer
,
node
);
}
else
{
}
else
{
DBPDataSourceContainer
dataSource
=
((
DBNDataSource
)
node
).
getObject
();
DBPDataSourceContainer
dataSource
=
((
DBNDataSource
)
node
).
getObject
();
...
@@ -137,10 +136,12 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
...
@@ -137,10 +136,12 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
break
;
break
;
case
CONNECT:
{
case
CONNECT:
{
UIServiceConnections
serviceConnections
=
DBWorkbench
.
getService
(
UIServiceConnections
.
class
);
UIServiceConnections
serviceConnections
=
DBWorkbench
.
getService
(
UIServiceConnections
.
class
);
if
(
dataSource
.
isConnected
())
{
if
(
serviceConnections
!=
null
)
{
serviceConnections
.
disconnectDataSource
(
dataSource
);
if
(
dataSource
.
isConnected
())
{
}
else
{
serviceConnections
.
disconnectDataSource
(
dataSource
);
serviceConnections
.
connectDataSource
(
dataSource
,
null
);
}
else
{
serviceConnections
.
connectDataSource
(
dataSource
,
null
);
}
}
}
break
;
break
;
}
}
...
@@ -163,12 +164,23 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
...
@@ -163,12 +164,23 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
}
else
if
(
node
instanceof
TreeNodeSpecial
)
{
}
else
if
(
node
instanceof
TreeNodeSpecial
)
{
((
TreeNodeSpecial
)
node
).
handleDefaultAction
(
navigatorTree
);
((
TreeNodeSpecial
)
node
).
handleDefaultAction
(
navigatorTree
);
}
else
{
}
else
{
DoubleClickBehavior
dcBehaviorDefault
=
DoubleClickBehavior
.
valueOf
(
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getString
(
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
));
String
defaultEditorPageId
=
null
;
NavigatorPreferences
.
DoubleClickBehavior
dcBehaviorDefault
=
CommonUtils
.
valueOf
(
NavigatorPreferences
.
DoubleClickBehavior
.
class
,
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getString
(
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
));
if
(
node
instanceof
DBNDatabaseNode
&&
((
DBNDatabaseNode
)
node
).
getObject
()
instanceof
DBSDataContainer
)
{
defaultEditorPageId
=
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getString
(
NavigatorPreferences
.
NAVIGATOR_DEFAULT_EDITOR_PAGE
);
}
boolean
hasChildren
=
node
instanceof
DBNNode
&&
((
DBNNode
)
node
).
hasChildren
(
true
);
boolean
hasChildren
=
node
instanceof
DBNNode
&&
((
DBNNode
)
node
).
hasChildren
(
true
);
if
(
hasChildren
&&
dcBehaviorDefault
==
DoubleClickBehavior
.
EXPAND
)
{
if
(
hasChildren
&&
dcBehaviorDefault
==
NavigatorPreferences
.
DoubleClickBehavior
.
EXPAND
)
{
toggleNode
(
viewer
,
node
);
toggleNode
(
viewer
,
node
);
}
else
{
}
else
{
NavigatorUtils
.
executeNodeAction
(
DBXTreeNodeHandler
.
Action
.
open
,
node
,
getSite
());
Map
<
String
,
Object
>
parameters
=
null
;
if
(!
CommonUtils
.
isEmpty
(
defaultEditorPageId
))
{
parameters
=
Collections
.
singletonMap
(
MultiPageDatabaseEditor
.
PARAMETER_ACTIVE_PAGE
,
defaultEditorPageId
);
}
NavigatorUtils
.
executeNodeAction
(
DBXTreeNodeHandler
.
Action
.
open
,
node
,
parameters
,
getSite
());
}
}
}
}
}
}
...
@@ -192,7 +204,7 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
...
@@ -192,7 +204,7 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
}
}
}
}
pr
otected
void
onSelectionChange
(
IStructuredSelection
structSel
)
{
pr
ivate
void
onSelectionChange
(
IStructuredSelection
structSel
)
{
if
(!
structSel
.
isEmpty
())
{
if
(!
structSel
.
isEmpty
())
{
lastSelection
=
structSel
.
getFirstElement
();
lastSelection
=
structSel
.
getFirstElement
();
if
(
lastSelection
instanceof
DBNNode
)
{
if
(
lastSelection
instanceof
DBNNode
)
{
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/preferences/PrefPageDatabaseNavigator.java
浏览文件 @
5a13318c
...
@@ -25,15 +25,23 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
...
@@ -25,15 +25,23 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import
org.eclipse.ui.IWorkbenchPropertyPage
;
import
org.eclipse.ui.IWorkbenchPropertyPage
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.
ui.internal.UINavigatorMessages
;
import
org.jkiss.dbeaver.
model.impl.AbstractDescriptor
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.model.struct.DBSEntity
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.entity.EntityEditorDescriptor
;
import
org.jkiss.dbeaver.ui.editors.entity.EntityEditorsRegistry
;
import
org.jkiss.dbeaver.ui.internal.UINavigatorMessages
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorPreferences
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorPreferences
;
import
org.jkiss.dbeaver.ui.navigator.database.NavigatorViewBase
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
/**
/**
...
@@ -53,6 +61,7 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
...
@@ -53,6 +61,7 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
private
Text
longListFetchSizeText
;
private
Text
longListFetchSizeText
;
private
Combo
dsDoubleClickBehavior
;
private
Combo
dsDoubleClickBehavior
;
private
Combo
objDoubleClickBehavior
;
private
Combo
objDoubleClickBehavior
;
private
Combo
defaultEditorPageCombo
;
public
PrefPageDatabaseNavigator
()
public
PrefPageDatabaseNavigator
()
{
{
...
@@ -94,11 +103,13 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
...
@@ -94,11 +103,13 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
objDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_node_expand_collapse
,
1
);
objDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_node_expand_collapse
,
1
);
dsDoubleClickBehavior
=
UIUtils
.
createLabelCombo
(
navigatorGroup
,
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
dsDoubleClickBehavior
=
UIUtils
.
createLabelCombo
(
navigatorGroup
,
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_open_properties
,
NavigatorViewBase
.
DoubleClickBehavior
.
EDIT
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_open_properties
,
NavigatorPreferences
.
DoubleClickBehavior
.
EDIT
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_conn_disconn
,
NavigatorViewBase
.
DoubleClickBehavior
.
CONNECT
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_conn_disconn
,
NavigatorPreferences
.
DoubleClickBehavior
.
CONNECT
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_open_sqleditor
,
NavigatorViewBase
.
DoubleClickBehavior
.
SQL_EDITOR
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_open_sqleditor
,
NavigatorPreferences
.
DoubleClickBehavior
.
SQL_EDITOR
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_expand_collapse
,
NavigatorViewBase
.
DoubleClickBehavior
.
EXPAND
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_expand_collapse
,
NavigatorPreferences
.
DoubleClickBehavior
.
EXPAND
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_open_new_sqleditor
,
NavigatorViewBase
.
DoubleClickBehavior
.
SQL_EDITOR_NEW
.
ordinal
());
dsDoubleClickBehavior
.
add
(
UINavigatorMessages
.
pref_page_database_general_label_double_click_connection_open_new_sqleditor
,
NavigatorPreferences
.
DoubleClickBehavior
.
SQL_EDITOR_NEW
.
ordinal
());
defaultEditorPageCombo
=
UIUtils
.
createLabelCombo
(
navigatorGroup
,
UINavigatorMessages
.
pref_page_navigator_default_editor_page_label
,
UINavigatorMessages
.
pref_page_navigator_default_editor_page_tip
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
}
}
performDefaults
();
performDefaults
();
...
@@ -119,10 +130,24 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
...
@@ -119,10 +130,24 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
showResourceFolderPlaceholdersCheck
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
NAVIGATOR_SHOW_FOLDER_PLACEHOLDERS
));
showResourceFolderPlaceholdersCheck
.
setSelection
(
store
.
getBoolean
(
ModelPreferences
.
NAVIGATOR_SHOW_FOLDER_PLACEHOLDERS
));
groupByDriverCheck
.
setSelection
(
store
.
getBoolean
(
NavigatorPreferences
.
NAVIGATOR_GROUP_BY_DRIVER
));
groupByDriverCheck
.
setSelection
(
store
.
getBoolean
(
NavigatorPreferences
.
NAVIGATOR_GROUP_BY_DRIVER
));
longListFetchSizeText
.
setText
(
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_LONG_LIST_FETCH_SIZE
));
longListFetchSizeText
.
setText
(
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_LONG_LIST_FETCH_SIZE
));
Navigator
ViewBase
.
DoubleClickBehavior
objDCB
=
NavigatorViewBase
.
DoubleClickBehavior
.
valueOf
(
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
));
Navigator
Preferences
.
DoubleClickBehavior
objDCB
=
CommonUtils
.
valueOf
(
NavigatorPreferences
.
DoubleClickBehavior
.
class
,
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
));
objDoubleClickBehavior
.
select
(
objDCB
==
Navigator
ViewBase
.
DoubleClickBehavior
.
EXPAND
?
1
:
0
);
objDoubleClickBehavior
.
select
(
objDCB
==
Navigator
Preferences
.
DoubleClickBehavior
.
EXPAND
?
1
:
0
);
dsDoubleClickBehavior
.
select
(
dsDoubleClickBehavior
.
select
(
NavigatorViewBase
.
DoubleClickBehavior
.
valueOf
(
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
)).
ordinal
());
CommonUtils
.
valueOf
(
NavigatorPreferences
.
DoubleClickBehavior
.
class
,
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
),
NavigatorPreferences
.
DoubleClickBehavior
.
EDIT
)
.
ordinal
());
String
defEditorPage
=
store
.
getString
(
NavigatorPreferences
.
NAVIGATOR_DEFAULT_EDITOR_PAGE
);
List
<
EntityEditorDescriptor
>
entityEditors
=
getAvailableEditorPages
();
defaultEditorPageCombo
.
add
(
""
);
for
(
EntityEditorDescriptor
eed
:
entityEditors
)
{
defaultEditorPageCombo
.
add
(
eed
.
getName
());
if
(
eed
.
getId
().
equals
(
defEditorPage
))
{
defaultEditorPageCombo
.
select
(
defaultEditorPageCombo
.
getItemCount
()
-
1
);
}
}
}
}
@Override
@Override
...
@@ -138,19 +163,41 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
...
@@ -138,19 +163,41 @@ public class PrefPageDatabaseNavigator extends AbstractPrefPage implements IWork
store
.
setValue
(
ModelPreferences
.
NAVIGATOR_SHOW_FOLDER_PLACEHOLDERS
,
showResourceFolderPlaceholdersCheck
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
NAVIGATOR_SHOW_FOLDER_PLACEHOLDERS
,
showResourceFolderPlaceholdersCheck
.
getSelection
());
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_GROUP_BY_DRIVER
,
groupByDriverCheck
.
getSelection
());
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_GROUP_BY_DRIVER
,
groupByDriverCheck
.
getSelection
());
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_LONG_LIST_FETCH_SIZE
,
longListFetchSizeText
.
getText
());
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_LONG_LIST_FETCH_SIZE
,
longListFetchSizeText
.
getText
());
Navigator
ViewBase
.
DoubleClickBehavior
objDCB
=
NavigatorViewBase
.
DoubleClickBehavior
.
EXPAND
;
Navigator
Preferences
.
DoubleClickBehavior
objDCB
=
NavigatorPreferences
.
DoubleClickBehavior
.
EXPAND
;
if
(
objDoubleClickBehavior
.
getSelectionIndex
()
==
0
)
{
if
(
objDoubleClickBehavior
.
getSelectionIndex
()
==
0
)
{
objDCB
=
Navigator
ViewBase
.
DoubleClickBehavior
.
EDIT
;
objDCB
=
Navigator
Preferences
.
DoubleClickBehavior
.
EDIT
;
}
}
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
,
objDCB
.
name
());
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_OBJECT_DOUBLE_CLICK
,
objDCB
.
name
());
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
,
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_CONNECTION_DOUBLE_CLICK
,
CommonUtils
.
fromOrdinal
(
NavigatorViewBase
.
DoubleClickBehavior
.
class
,
dsDoubleClickBehavior
.
getSelectionIndex
()).
name
());
CommonUtils
.
fromOrdinal
(
NavigatorPreferences
.
DoubleClickBehavior
.
class
,
dsDoubleClickBehavior
.
getSelectionIndex
()).
name
());
List
<
EntityEditorDescriptor
>
entityEditors
=
getAvailableEditorPages
();
int
defEditorIndex
=
defaultEditorPageCombo
.
getSelectionIndex
();
store
.
setValue
(
NavigatorPreferences
.
NAVIGATOR_DEFAULT_EDITOR_PAGE
,
defEditorIndex
==
0
?
""
:
entityEditors
.
get
(
defEditorIndex
-
1
).
getId
());
PrefUtils
.
savePreferenceStore
(
store
);
PrefUtils
.
savePreferenceStore
(
store
);
return
true
;
return
true
;
}
}
private
List
<
EntityEditorDescriptor
>
getAvailableEditorPages
()
{
List
<
EntityEditorDescriptor
>
editors
=
new
ArrayList
<>(
EntityEditorsRegistry
.
getInstance
().
getEntityEditors
());
editors
.
removeIf
(
editor
->
{
if
(
editor
.
getType
()
!=
EntityEditorDescriptor
.
Type
.
editor
)
return
true
;
for
(
AbstractDescriptor
.
ObjectType
ot
:
editor
.
getObjectTypes
())
{
if
(!
DBSDataContainer
.
class
.
getName
().
equals
(
ot
.
getImplName
())
&&
!
DBSObjectContainer
.
class
.
getName
().
equals
(
ot
.
getImplName
())
&&
!
DBSEntity
.
class
.
getName
().
equals
(
ot
.
getImplName
()))
{
return
true
;
}
}
return
false
;
});
editors
.
sort
(
Comparator
.
comparing
(
EntityEditorDescriptor:
:
getName
));
return
editors
;
}
@Override
@Override
public
void
applyData
(
Object
data
)
public
void
applyData
(
Object
data
)
{
{
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ActionUtils.java
浏览文件 @
5a13318c
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
package
org.jkiss.dbeaver.ui
;
package
org.jkiss.dbeaver.ui
;
import
org.eclipse.core.commands.Command
;
import
org.eclipse.core.commands.Command
;
import
org.eclipse.core.commands.IParameter
;
import
org.eclipse.core.commands.Parameterization
;
import
org.eclipse.core.commands.ParameterizedCommand
;
import
org.eclipse.core.commands.ParameterizedCommand
;
import
org.eclipse.core.commands.common.NotDefinedException
;
import
org.eclipse.core.commands.common.NotDefinedException
;
import
org.eclipse.core.expressions.EvaluationContext
;
import
org.eclipse.core.expressions.EvaluationContext
;
...
@@ -32,7 +34,6 @@ import org.eclipse.jface.commands.ToggleState;
...
@@ -32,7 +34,6 @@ import org.eclipse.jface.commands.ToggleState;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.commands.ICommandImageService
;
import
org.eclipse.ui.commands.ICommandImageService
;
import
org.eclipse.ui.commands.ICommandService
;
import
org.eclipse.ui.commands.ICommandService
;
...
@@ -49,6 +50,8 @@ import org.jkiss.dbeaver.model.DBPImage;
...
@@ -49,6 +50,8 @@ import org.jkiss.dbeaver.model.DBPImage;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Map
;
/**
/**
* Action utils
* Action utils
*/
*/
...
@@ -271,6 +274,11 @@ public class ActionUtils
...
@@ -271,6 +274,11 @@ public class ActionUtils
}
}
public
static
void
runCommand
(
String
commandId
,
ISelection
selection
,
IServiceLocator
serviceLocator
)
public
static
void
runCommand
(
String
commandId
,
ISelection
selection
,
IServiceLocator
serviceLocator
)
{
runCommand
(
commandId
,
selection
,
null
,
serviceLocator
);
}
public
static
void
runCommand
(
String
commandId
,
ISelection
selection
,
Map
<
String
,
Object
>
parameters
,
IServiceLocator
serviceLocator
)
{
{
if
(
commandId
!=
null
)
{
if
(
commandId
!=
null
)
{
try
{
try
{
...
@@ -293,6 +301,24 @@ public class ActionUtils
...
@@ -293,6 +301,24 @@ public class ActionUtils
}
}
}
}
}
}
Parameterization
[]
parametrization
=
null
;
if
(!
CommonUtils
.
isEmpty
(
parameters
))
{
parametrization
=
new
Parameterization
[
parameters
.
size
()];
int
paramIndex
=
0
;
for
(
Map
.
Entry
<
String
,
Object
>
param
:
parameters
.
entrySet
())
{
IParameter
parameter
=
command
.
getParameter
(
param
.
getKey
());
if
(
parameter
!=
null
)
{
parametrization
[
paramIndex
]
=
new
Parameterization
(
parameter
,
CommonUtils
.
toString
(
param
.
getValue
()));
}
else
{
log
.
debug
(
"Parameter '"
+
param
.
getKey
()
+
"' not found in command '"
+
commandId
+
"'"
);
parametrization
[
paramIndex
]
=
null
;
}
paramIndex
++;
}
}
if
(
selection
!=
null
&&
needContextPatch
)
{
if
(
selection
!=
null
&&
needContextPatch
)
{
// Create new eval context
// Create new eval context
IEvaluationContext
context
=
new
EvaluationContext
(
IEvaluationContext
context
=
new
EvaluationContext
(
...
@@ -302,11 +328,12 @@ public class ActionUtils
...
@@ -302,11 +328,12 @@ public class ActionUtils
}
}
context
.
addVariable
(
ISources
.
ACTIVE_CURRENT_SELECTION_NAME
,
selection
);
context
.
addVariable
(
ISources
.
ACTIVE_CURRENT_SELECTION_NAME
,
selection
);
ParameterizedCommand
pc
=
new
ParameterizedCommand
(
command
,
null
);
ParameterizedCommand
pc
=
new
ParameterizedCommand
(
command
,
parametrization
);
handlerService
.
executeCommandInContext
(
pc
,
null
,
context
);
handlerService
.
executeCommandInContext
(
pc
,
null
,
context
);
}
else
if
(
command
!=
null
)
{
}
else
if
(
command
!=
null
)
{
if
(
command
.
isEnabled
())
{
if
(
command
.
isEnabled
())
{
handlerService
.
executeCommand
(
commandId
,
null
);
ParameterizedCommand
pc
=
new
ParameterizedCommand
(
command
,
parametrization
);
handlerService
.
executeCommand
(
pc
,
null
);
}
else
{
}
else
{
log
.
warn
(
"Command '"
+
commandId
+
"' is disabled"
);
log
.
warn
(
"Command '"
+
commandId
+
"' is disabled"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录