Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
45eff4c8
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,发现更多精彩内容 >>
提交
45eff4c8
编写于
4月 20, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3318 SQL assistant. Search inside object names (configurable)
上级
4454d843
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
3 deletion
+31
-3
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/editors/sql/SQLPreferenceConstants.java
.../jkiss/dbeaver/ui/editors/sql/SQLPreferenceConstants.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLCompletionAnalyzer.java
.../dbeaver/ui/editors/sql/syntax/SQLCompletionAnalyzer.java
+19
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLCompletion.java
...g/jkiss/dbeaver/ui/preferences/PrefPageSQLCompletion.java
+6
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreMessages.java
浏览文件 @
45eff4c8
...
...
@@ -1081,6 +1081,8 @@ public class CoreMessages extends NLS {
public
static
String
pref_page_sql_completion_label_use_short_names
;
public
static
String
pref_page_sql_completion_label_use_long_names
;
public
static
String
pref_page_sql_completion_label_insert_space
;
public
static
String
pref_page_sql_completion_label_match_contains
;
public
static
String
pref_page_sql_completion_label_match_contains_tip
;
public
static
String
pref_page_sql_completion_label_use_global_search
;
public
static
String
pref_page_sql_completion_label_use_global_search_tip
;
public
static
String
pref_page_sql_completion_group_folding
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/CoreResources.properties
浏览文件 @
45eff4c8
...
...
@@ -1033,6 +1033,8 @@ pref_page_sql_completion_label_hide_duplicate_names = Hide duplicate names from
pref_page_sql_completion_label_use_short_names
=
Use short object names (omit schema/catalog)
pref_page_sql_completion_label_use_long_names
=
Use long object names (always use schema/catalog)
pref_page_sql_completion_label_insert_space
=
Insert space after table/column names
pref_page_sql_completion_label_match_contains
=
Search inside names
pref_page_sql_completion_label_match_contains_tip
=
Search object names which contain the string. Otherwise search names which start from the string.
pref_page_sql_completion_label_use_global_search
=
Use global search (in all schemas)
pref_page_sql_completion_label_use_global_search_tip
=
Search for objects in all schemas. Otherwise search only in current/system schemas.
pref_page_sql_completion_group_folding
=
Folding
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverPreferencesInitializer.java
浏览文件 @
45eff4c8
...
...
@@ -129,6 +129,7 @@ public class DBeaverPreferencesInitializer extends AbstractPreferenceInitializer
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SQLPreferenceConstants
.
PROPOSAL_ALWAYS_FQ
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SQLPreferenceConstants
.
INSERT_SPACE_AFTER_PROPOSALS
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SQLPreferenceConstants
.
USE_GLOBAL_ASSISTANT
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
,
false
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SQLPreferenceConstants
.
SQLEDITOR_CLOSE_SINGLE_QUOTES
,
true
);
PrefUtils
.
setDefaultPreferenceValue
(
store
,
SQLPreferenceConstants
.
SQLEDITOR_CLOSE_DOUBLE_QUOTES
,
true
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLPreferenceConstants.java
浏览文件 @
45eff4c8
...
...
@@ -69,6 +69,7 @@ public class SQLPreferenceConstants
public
static
final
String
PROPOSAL_ALWAYS_FQ
=
"SQLEditor.ContentAssistant.proposals.long.name"
;
public
static
final
String
INSERT_SPACE_AFTER_PROPOSALS
=
"SQLEditor.ContentAssistant.insert.space.after.proposal"
;
public
static
final
String
USE_GLOBAL_ASSISTANT
=
"SQLEditor.ContentAssistant.use.global.search"
;
public
static
final
String
PROPOSALS_MATCH_CONTAINS
=
"SQLEditor.ContentAssistant.matching.contains"
;
public
static
final
String
FOLDING_ENABLED
=
"SQLEditor.Folding.enabled"
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLCompletionAnalyzer.java
浏览文件 @
45eff4c8
...
...
@@ -46,6 +46,8 @@ class SQLCompletionAnalyzer
{
private
static
final
Log
log
=
Log
.
getLog
(
SQLCompletionAnalyzer
.
class
);
private
static
final
String
MATCH_ANY_PATTERN
=
"%"
;
static
class
CompletionRequest
{
final
SQLEditorBase
editor
;
final
boolean
simpleMode
;
...
...
@@ -495,6 +497,8 @@ class SQLCompletionAnalyzer
}
}
try
{
DBPDataSource
dataSource
=
request
.
editor
.
getDataSource
();
boolean
matchContains
=
dataSource
!=
null
&&
dataSource
.
getContainer
().
getPreferenceStore
().
getBoolean
(
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
);
Collection
<?
extends
DBSObject
>
children
=
null
;
if
(
parent
instanceof
DBSObjectContainer
)
{
children
=
((
DBSObjectContainer
)
parent
).
getChildren
(
monitor
);
...
...
@@ -530,7 +534,7 @@ class SQLCompletionAnalyzer
}
combinedMatch
.
append
(
DBUtils
.
getQuotedIdentifier
(
child
));
}
else
if
(
simpleMode
)
{
if
(
startPart
==
null
||
child
.
getName
().
toUpperCase
(
Locale
.
ENGLISH
).
startsWith
(
startPart
))
{
if
(
startPart
==
null
||
objectNameMatches
(
startPart
,
child
,
matchContains
))
{
matchedObjects
.
add
(
child
);
}
}
else
{
...
...
@@ -578,6 +582,11 @@ class SQLCompletionAnalyzer
}
}
private
boolean
objectNameMatches
(
@Nullable
String
startPart
,
DBSObject
child
,
boolean
matchContains
)
{
String
nameCI
=
child
.
getName
().
toUpperCase
(
Locale
.
ENGLISH
);
return
matchContains
?
nameCI
.
contains
(
startPart
)
:
nameCI
.
startsWith
(
startPart
);
}
private
void
makeProposalsFromAssistant
(
DBPDataSource
dataSource
,
DBSStructureAssistant
assistant
,
...
...
@@ -589,7 +598,7 @@ class SQLCompletionAnalyzer
monitor
,
rootSC
,
assistant
.
getAutoCompleteObjectTypes
(),
request
.
wordDetector
.
removeQuotes
(
objectName
)
+
"%"
,
makeObjectNameMask
(
dataSource
,
request
.
wordDetector
.
removeQuotes
(
objectName
))
,
request
.
wordDetector
.
isQuoted
(
objectName
),
dataSource
.
getContainer
().
getPreferenceStore
().
getBoolean
(
SQLPreferenceConstants
.
USE_GLOBAL_ASSISTANT
),
100
);
...
...
@@ -601,6 +610,14 @@ class SQLCompletionAnalyzer
}
}
private
String
makeObjectNameMask
(
DBPDataSource
dataSource
,
String
objectName
)
{
if
(
dataSource
.
getContainer
().
getPreferenceStore
().
getBoolean
(
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
))
{
return
MATCH_ANY_PATTERN
+
objectName
+
MATCH_ANY_PATTERN
;
}
else
{
return
objectName
+
MATCH_ANY_PATTERN
;
}
}
private
SQLCompletionProposal
makeProposalsFromObject
(
DBSObject
object
)
{
DBNNode
node
=
NavigatorUtils
.
getNodeByObject
(
monitor
,
object
,
false
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLCompletion.java
浏览文件 @
45eff4c8
...
...
@@ -43,6 +43,7 @@ public class PrefPageSQLCompletion extends TargetPrefPage
private
Button
csShortName
;
private
Button
csLongName
;
private
Button
csInsertSpace
;
private
Button
csMatchContains
;
private
Button
csUseGlobalSearch
;
private
Button
csFoldingEnabled
;
...
...
@@ -66,6 +67,7 @@ public class PrefPageSQLCompletion extends TargetPrefPage
store
.
contains
(
SQLPreferenceConstants
.
PROPOSAL_SHORT_NAME
)
||
store
.
contains
(
SQLPreferenceConstants
.
PROPOSAL_ALWAYS_FQ
)
||
store
.
contains
(
SQLPreferenceConstants
.
INSERT_SPACE_AFTER_PROPOSALS
)
||
store
.
contains
(
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
)
||
store
.
contains
(
SQLPreferenceConstants
.
USE_GLOBAL_ASSISTANT
)
||
store
.
contains
(
SQLPreferenceConstants
.
FOLDING_ENABLED
)
...
...
@@ -119,6 +121,7 @@ public class PrefPageSQLCompletion extends TargetPrefPage
csShortName
=
UIUtils
.
createCheckbox
(
assistGroup
,
CoreMessages
.
pref_page_sql_completion_label_use_short_names
,
null
,
false
,
2
);
csLongName
=
UIUtils
.
createCheckbox
(
assistGroup
,
CoreMessages
.
pref_page_sql_completion_label_use_long_names
,
null
,
false
,
2
);
csInsertSpace
=
UIUtils
.
createCheckbox
(
assistGroup
,
CoreMessages
.
pref_page_sql_completion_label_insert_space
,
null
,
false
,
2
);
csMatchContains
=
UIUtils
.
createCheckbox
(
assistGroup
,
CoreMessages
.
pref_page_sql_completion_label_match_contains
,
CoreMessages
.
pref_page_sql_completion_label_match_contains_tip
,
false
,
2
);
csUseGlobalSearch
=
UIUtils
.
createCheckbox
(
assistGroup
,
CoreMessages
.
pref_page_sql_completion_label_use_global_search
,
CoreMessages
.
pref_page_sql_completion_label_use_global_search_tip
,
false
,
2
);
}
...
...
@@ -145,7 +148,7 @@ public class PrefPageSQLCompletion extends TargetPrefPage
csShortName
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
PROPOSAL_SHORT_NAME
));
csLongName
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
PROPOSAL_ALWAYS_FQ
));
csInsertSpace
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
INSERT_SPACE_AFTER_PROPOSALS
));
csMatchContains
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
));
csUseGlobalSearch
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
USE_GLOBAL_ASSISTANT
));
csFoldingEnabled
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
FOLDING_ENABLED
));
...
...
@@ -167,6 +170,7 @@ public class PrefPageSQLCompletion extends TargetPrefPage
store
.
setValue
(
SQLPreferenceConstants
.
PROPOSAL_SHORT_NAME
,
csShortName
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
PROPOSAL_ALWAYS_FQ
,
csLongName
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
INSERT_SPACE_AFTER_PROPOSALS
,
csInsertSpace
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
,
csMatchContains
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
USE_GLOBAL_ASSISTANT
,
csUseGlobalSearch
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
FOLDING_ENABLED
,
csFoldingEnabled
.
getSelection
());
...
...
@@ -188,6 +192,7 @@ public class PrefPageSQLCompletion extends TargetPrefPage
store
.
setToDefault
(
SQLPreferenceConstants
.
PROPOSAL_SHORT_NAME
);
store
.
setToDefault
(
SQLPreferenceConstants
.
PROPOSAL_ALWAYS_FQ
);
store
.
setToDefault
(
SQLPreferenceConstants
.
INSERT_SPACE_AFTER_PROPOSALS
);
store
.
setToDefault
(
SQLPreferenceConstants
.
PROPOSALS_MATCH_CONTAINS
);
store
.
setToDefault
(
SQLPreferenceConstants
.
USE_GLOBAL_ASSISTANT
);
store
.
setToDefault
(
SQLPreferenceConstants
.
FOLDING_ENABLED
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录