Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
7e12a18e
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,发现更多精彩内容 >>
提交
7e12a18e
编写于
12月 03, 2017
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cell value save->apply
Former-commit-id:
34bb1ce3
上级
688457e3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
81 addition
and
18 deletion
+81
-18
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
...ns/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/panel/ViewValuePanel.java
...s/dbeaver/ui/controls/resultset/panel/ViewValuePanel.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/app/DBPPlatform.java
...er.model/src/org/jkiss/dbeaver/model/app/DBPPlatform.java
+4
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
...eaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
+5
-4
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatter.java
.../src/org/jkiss/dbeaver/model/sql/format/SQLFormatter.java
+9
-9
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterConfiguration.java
...s/dbeaver/model/sql/format/SQLFormatterConfiguration.java
+31
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterRegistry.java
.../jkiss/dbeaver/model/sql/format/SQLFormatterRegistry.java
+28
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
浏览文件 @
7e12a18e
...
...
@@ -264,8 +264,8 @@ command.org.jkiss.dbeaver.core.resultset.rejectChanges.name=Reject changes
command.org.jkiss.dbeaver.core.resultset.rejectChanges.description
=
Reject data changes
command.org.jkiss.dbeaver.core.resultset.generateScript.name
=
Generate script
command.org.jkiss.dbeaver.core.resultset.generateScript.description
=
Generate changes script
command.org.jkiss.dbeaver.core.resultset.cell.save.name
=
Save
cell value
command.org.jkiss.dbeaver.core.resultset.cell.save.description
=
Save
cell value
command.org.jkiss.dbeaver.core.resultset.cell.save.name
=
Apply
cell value
command.org.jkiss.dbeaver.core.resultset.cell.save.description
=
Apply
cell value
command.org.jkiss.dbeaver.core.resultset.filterMenu.name
=
Filter menu
command.org.jkiss.dbeaver.core.resultset.filterMenu.description
=
Filer context menu
command.org.jkiss.dbeaver.core.resultset.referencesMenu.name
=
Referencing tables
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/panel/ViewValuePanel.java
浏览文件 @
7e12a18e
...
...
@@ -323,7 +323,7 @@ public class ViewValuePanel implements IResultSetPanel, IAdaptable {
previewController
.
updateValue
(
newValue
,
true
);
presentation
.
updateValueView
();
}
catch
(
Exception
e
)
{
DBUserInterface
.
getInstance
().
showError
(
"Value
save"
,
"Can't save
edited value"
,
e
);
DBUserInterface
.
getInstance
().
showError
(
"Value
apply"
,
"Can't apply
edited value"
,
e
);
}
finally
{
valueSaving
=
false
;
}
...
...
@@ -363,7 +363,7 @@ public class ViewValuePanel implements IResultSetPanel, IAdaptable {
ActionUtils
.
makeCommandContribution
(
presentation
.
getController
().
getSite
(),
ValueViewCommandHandler
.
CMD_SAVE_VALUE
));
contributionManager
.
add
(
new
Action
(
"Auto-
flush value (from panel to grid)
"
,
Action
.
AS_CHECK_BOX
)
{
new
Action
(
"Auto-
apply value
"
,
Action
.
AS_CHECK_BOX
)
{
{
setImageDescriptor
(
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
LINK_TO_EDITOR
));
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/app/DBPPlatform.java
浏览文件 @
7e12a18e
...
...
@@ -26,6 +26,7 @@ import org.jkiss.dbeaver.model.edit.DBERegistry;
import
org.jkiss.dbeaver.model.navigator.DBNModel
;
import
org.jkiss.dbeaver.model.qm.QMController
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterRegistry
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -60,6 +61,9 @@ public interface DBPPlatform
@NotNull
DBERegistry
getEditorsRegistry
();
@NotNull
SQLFormatterRegistry
getSQLFormatterRegistry
();
@NotNull
DBPPreferenceStore
getPreferenceStore
();
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
浏览文件 @
7e12a18e
...
...
@@ -30,9 +30,7 @@ import org.jkiss.dbeaver.model.impl.sql.BasicSQLDialect;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
import
org.jkiss.dbeaver.model.sql.format.tokenized.SQLTokenizedFormatter
;
import
org.jkiss.dbeaver.model.struct.DBSAttributeBase
;
import
org.jkiss.dbeaver.model.struct.DBSDataType
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
...
...
@@ -45,7 +43,10 @@ import java.io.BufferedReader;
import
java.io.InputStreamReader
;
import
java.io.StringWriter
;
import
java.lang.reflect.Array
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -279,7 +280,7 @@ public final class SQLUtils {
SQLSyntaxManager
syntaxManager
=
new
SQLSyntaxManager
();
syntaxManager
.
init
(
dataSource
.
getSQLDialect
(),
dataSource
.
getContainer
().
getPreferenceStore
());
SQLFormatterConfiguration
configuration
=
new
SQLFormatterConfiguration
(
syntaxManager
);
return
new
SQLTokenized
Formatter
().
format
(
query
,
configuration
);
return
configuration
.
create
Formatter
().
format
(
query
,
configuration
);
}
public
static
void
appendLikeCondition
(
StringBuilder
sql
,
String
value
,
boolean
not
)
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatter.java
浏览文件 @
7e12a18e
...
...
@@ -16,17 +16,17 @@
*/
package
org.jkiss.dbeaver.model.sql.format
;
/**
* SQL Formatter
*/
public
interface
SQLFormatter
{
/**
* Format the source SQL string.
*
* @param source original SQL string
*
* @return formatted version
*/
String
format
(
String
source
,
SQLFormatterConfiguration
configuration
);
/**
* Format the source SQL string.
*
* @param source original SQL string
* @return formatted version
*/
String
format
(
String
source
,
SQLFormatterConfiguration
configuration
);
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterConfiguration.java
浏览文件 @
7e12a18e
...
...
@@ -21,19 +21,24 @@ import org.jkiss.code.NotNull;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.DBPIdentifierCase
;
import
org.jkiss.dbeaver.model.DBPKeywordType
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.sql.SQLSyntaxManager
;
import
org.jkiss.dbeaver.model.sql.format.external.SQLExternalFormatter
;
import
org.jkiss.dbeaver.model.sql.format.tokenized.SQLTokenizedFormatter
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Map
;
/**
* SQLFormatterConfiguration
*/
public
class
SQLFormatterConfiguration
{
private
String
formatterId
;
@NotNull
private
DBPIdentifierCase
keywordCase
;
private
String
indentString
=
" "
;
...
...
@@ -41,10 +46,14 @@ public class SQLFormatterConfiguration {
@NotNull
private
String
sourceEncoding
=
GeneralUtils
.
DEFAULT_ENCODING
;
private
Map
<
String
,
Object
>
properties
=
new
HashMap
<>();
public
SQLFormatterConfiguration
(
SQLSyntaxManager
syntaxManager
)
{
this
.
syntaxManager
=
syntaxManager
;
this
.
keywordCase
=
syntaxManager
.
getKeywordCase
();
this
.
formatterId
=
CommonUtils
.
notEmpty
(
syntaxManager
.
getPreferenceStore
().
getString
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
)).
toUpperCase
(
Locale
.
ENGLISH
);
}
public
SQLSyntaxManager
getSyntaxManager
()
...
...
@@ -52,6 +61,16 @@ public class SQLFormatterConfiguration {
return
syntaxManager
;
}
public
String
getFormatterId
()
{
return
formatterId
;
}
public
void
setFormatterId
(
String
formatterId
)
{
this
.
formatterId
=
formatterId
;
syntaxManager
.
getPreferenceStore
().
setValue
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
,
formatterId
.
toUpperCase
(
Locale
.
ENGLISH
));
}
public
String
getIndentString
()
{
return
indentString
;
...
...
@@ -85,12 +104,23 @@ public class SQLFormatterConfiguration {
return
syntaxManager
.
getDialect
().
getKeywordType
(
name
)
==
DBPKeywordType
.
FUNCTION
;
}
public
Object
getProperty
(
String
name
)
{
return
properties
.
get
(
name
);
}
public
void
setProperties
(
Map
<
String
,
Object
>
properties
)
{
this
.
properties
=
properties
;
}
public
SQLFormatter
createFormatter
()
{
final
String
formatterId
=
CommonUtils
.
notEmpty
(
syntaxManager
.
getPreferenceStore
().
getString
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
)).
toUpperCase
(
Locale
.
ENGLISH
);
if
(
SQLExternalFormatter
.
FORMATTER_ID
.
equals
(
formatterId
))
{
return
new
SQLExternalFormatter
();
}
else
{
return
new
SQLTokenizedFormatter
();
}
}
public
DBPPreferenceStore
getPreferenceStore
()
{
return
syntaxManager
.
getPreferenceStore
();
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterRegistry.java
0 → 100644
浏览文件 @
7e12a18e
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.model.sql.format
;
import
org.jkiss.dbeaver.DBException
;
/**
* SQL Formatter registry
*/
public
interface
SQLFormatterRegistry
{
SQLFormatter
createAndConfigureFormatter
(
SQLFormatterConfiguration
configuration
)
throws
DBException
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录