Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
16436324
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
16436324
编写于
12月 03, 2017
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2130 SQL formatters model/registry
Former-commit-id:
b57bc9e5
上级
7e12a18e
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
530 addition
and
26 deletion
+530
-26
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
...ns/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
+1
-0
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+7
-1
plugins/org.jkiss.dbeaver.core/schema/org.jkiss.dbeaver.sqlFormatter.exsd
...s.dbeaver.core/schema/org.jkiss.dbeaver.sqlFormatter.exsd
+223
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
....dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
+7
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/sql/SQLFormatterConfigurationRegistry.java
...eaver/registry/sql/SQLFormatterConfigurationRegistry.java
+125
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/sql/SQLFormatterConfigurer.java
...rg/jkiss/dbeaver/registry/sql/SQLFormatterConfigurer.java
+29
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/sql/SQLFormatterDescriptor.java
...rg/jkiss/dbeaver/registry/sql/SQLFormatterDescriptor.java
+87
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLFormattingStrategy.java
.../dbeaver/ui/editors/sql/syntax/SQLFormattingStrategy.java
+7
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLFormat.java
...c/org/jkiss/dbeaver/ui/preferences/PrefPageSQLFormat.java
+25
-11
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
...eaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
+6
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterConfiguration.java
...s/dbeaver/model/sql/format/SQLFormatterConfiguration.java
+0
-10
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterRegistry.java
.../jkiss/dbeaver/model/sql/format/SQLFormatterRegistry.java
+13
-2
未找到文件。
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
浏览文件 @
16436324
...
@@ -12,6 +12,7 @@ extension-point.org.jkiss.dbeaver.dataTransfer.name = Data Transfer Provider
...
@@ -12,6 +12,7 @@ extension-point.org.jkiss.dbeaver.dataTransfer.name = Data Transfer Provider
extension-point.org.jkiss.dbeaver.dataFormatter.name
=
Data Formatters
extension-point.org.jkiss.dbeaver.dataFormatter.name
=
Data Formatters
extension-point.org.jkiss.dbeaver.aggregateFunction.name
=
Aggregate Functions
extension-point.org.jkiss.dbeaver.aggregateFunction.name
=
Aggregate Functions
extension-point.org.jkiss.dbeaver.sqlCommand.name
=
SQL script commands
extension-point.org.jkiss.dbeaver.sqlCommand.name
=
SQL script commands
extension-point.org.jkiss.dbeaver.sqlFormatter.name
=
SQL formatters
extension-point.org.jkiss.dbeaver.resourceHandler.name
=
Resource Handlers
extension-point.org.jkiss.dbeaver.resourceHandler.name
=
Resource Handlers
extension-point.org.jkiss.dbeaver.networkHandler.name
=
Network Handlers
extension-point.org.jkiss.dbeaver.networkHandler.name
=
Network Handlers
extension-point.org.jkiss.dbeaver.resources.name
=
Resources
extension-point.org.jkiss.dbeaver.resources.name
=
Resources
...
...
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
16436324
...
@@ -28,13 +28,14 @@
...
@@ -28,13 +28,14 @@
<extension-point
id=
"org.jkiss.dbeaver.dataTransfer"
name=
"%extension-point.org.jkiss.dbeaver.dataTransfer.name"
schema=
"schema/org.jkiss.dbeaver.dataTransfer.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataTransfer"
name=
"%extension-point.org.jkiss.dbeaver.dataTransfer.name"
schema=
"schema/org.jkiss.dbeaver.dataTransfer.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataFormatter"
name=
"%extension-point.org.jkiss.dbeaver.dataFormatter.name"
schema=
"schema/org.jkiss.dbeaver.dataFormatter.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.dataFormatter"
name=
"%extension-point.org.jkiss.dbeaver.dataFormatter.name"
schema=
"schema/org.jkiss.dbeaver.dataFormatter.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.aggregateFunction"
name=
"%extension-point.org.jkiss.dbeaver.aggregateFunction.name"
schema=
"schema/org.jkiss.dbeaver.aggregateFunction.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.aggregateFunction"
name=
"%extension-point.org.jkiss.dbeaver.aggregateFunction.name"
schema=
"schema/org.jkiss.dbeaver.aggregateFunction.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.sqlCommand"
name=
"%extension-point.org.jkiss.dbeaver.sqlCommand.name"
schema=
"schema/org.jkiss.dbeaver.sqlCommand.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resourceHandler"
name=
"%extension-point.org.jkiss.dbeaver.resourceHandler.name"
schema=
"schema/org.jkiss.dbeaver.resourceHandler.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resourceHandler"
name=
"%extension-point.org.jkiss.dbeaver.resourceHandler.name"
schema=
"schema/org.jkiss.dbeaver.resourceHandler.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.networkHandler"
name=
"%extension-point.org.jkiss.dbeaver.networkHandler.name"
schema=
"schema/org.jkiss.dbeaver.networkHandler.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.networkHandler"
name=
"%extension-point.org.jkiss.dbeaver.networkHandler.name"
schema=
"schema/org.jkiss.dbeaver.networkHandler.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resources"
name=
"%extension-point.org.jkiss.dbeaver.resources.name"
schema=
"schema/org.jkiss.dbeaver.resources.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resources"
name=
"%extension-point.org.jkiss.dbeaver.resources.name"
schema=
"schema/org.jkiss.dbeaver.resources.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resultset.presentation"
name=
"%extension-point.org.jkiss.dbeaver.resultset.presentation.name"
schema=
"schema/org.jkiss.dbeaver.resultset.presentation.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resultset.presentation"
name=
"%extension-point.org.jkiss.dbeaver.resultset.presentation.name"
schema=
"schema/org.jkiss.dbeaver.resultset.presentation.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resultset.panel"
name=
"%extension-point.org.jkiss.dbeaver.resultset.panel.name"
schema=
"schema/org.jkiss.dbeaver.resultset.panel.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.resultset.panel"
name=
"%extension-point.org.jkiss.dbeaver.resultset.panel.name"
schema=
"schema/org.jkiss.dbeaver.resultset.panel.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.sql.covert"
name=
"%extension-point.org.jkiss.dbeaver.sql.covertname"
schema=
"schema/org.jkiss.dbeaver.sql.convert.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.sql.covert"
name=
"%extension-point.org.jkiss.dbeaver.sql.covertname"
schema=
"schema/org.jkiss.dbeaver.sql.convert.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.sqlCommand"
name=
"%extension-point.org.jkiss.dbeaver.sqlCommand.name"
schema=
"schema/org.jkiss.dbeaver.sqlCommand.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.sqlFormatter"
name=
"%extension-point.org.jkiss.dbeaver.sqlFormatter.name"
schema=
"schema/org.jkiss.dbeaver.sqlFormatter.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.tools"
name=
"%extension-point.org.jkiss.dbeaver.tools.name"
schema=
"schema/org.jkiss.dbeaver.tools.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.tools"
name=
"%extension-point.org.jkiss.dbeaver.tools.name"
schema=
"schema/org.jkiss.dbeaver.tools.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.product.bundles"
name=
"%extension-point.org.jkiss.dbeaver.product.bundles.name"
schema=
"schema/org.jkiss.dbeaver.product.bundles.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.product.bundles"
name=
"%extension-point.org.jkiss.dbeaver.product.bundles.name"
schema=
"schema/org.jkiss.dbeaver.product.bundles.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.workbenchHandler"
name=
"%extension-point.org.jkiss.dbeaver.workbenchHandler.name"
schema=
"schema/org.jkiss.dbeaver.workbenchHandler.exsd"
/>
<extension-point
id=
"org.jkiss.dbeaver.workbenchHandler"
name=
"%extension-point.org.jkiss.dbeaver.workbenchHandler.name"
schema=
"schema/org.jkiss.dbeaver.workbenchHandler.exsd"
/>
...
@@ -3300,6 +3301,11 @@
...
@@ -3300,6 +3301,11 @@
<command
id=
"include"
class=
"org.jkiss.dbeaver.runtime.sql.commands.SQLCommandInclude"
label=
"Include"
description=
"Include another SQL script file"
/>
<command
id=
"include"
class=
"org.jkiss.dbeaver.runtime.sql.commands.SQLCommandInclude"
label=
"Include"
description=
"Include another SQL script file"
/>
</extension>
</extension>
<extension
point=
"org.jkiss.dbeaver.sqlFormatter"
>
<formatter
id=
"default"
class=
"org.jkiss.dbeaver.model.sql.format.tokenized.SQLTokenizedFormatter"
label=
"Default SQL formatter"
description=
"Default tokenized SQL formatter"
/>
<formatter
id=
"external"
class=
"org.jkiss.dbeaver.model.sql.format.external.SQLExternalFormatter"
label=
"External formatter"
description=
"External formatter. Uses configurable command-line executable to format SQL queries"
/>
</extension>
<extension
point=
"org.jkiss.dbeaver.dataManager"
>
<extension
point=
"org.jkiss.dbeaver.dataManager"
>
<!--
<!--
<manager class="org.jkiss.dbeaver.ui.data.managers.BooleanValueManager" id="org.jkiss.dbeaver.ui.data.managers.BooleanValueManager">
<manager class="org.jkiss.dbeaver.ui.data.managers.BooleanValueManager" id="org.jkiss.dbeaver.ui.data.managers.BooleanValueManager">
...
...
plugins/org.jkiss.dbeaver.core/schema/org.jkiss.dbeaver.sqlFormatter.exsd
0 → 100644
浏览文件 @
16436324
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema
targetNamespace=
"org.jkiss.dbeaver.core"
xmlns=
"http://www.w3.org/2001/XMLSchema"
>
<annotation>
<appInfo>
<meta.schema
plugin=
"org.jkiss.dbeaver.core"
id=
"org.jkiss.dbeaver.sqlFormatter"
name=
"SQL Formatter"
/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element
name=
"extension"
>
<annotation>
<appInfo>
<meta.element
/>
</appInfo>
</annotation>
<complexType>
<sequence>
<element
ref=
"formatter"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</sequence>
<attribute
name=
"point"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"id"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"name"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"formatter"
>
<complexType>
<sequence
minOccurs=
"0"
maxOccurs=
"unbounded"
>
<element
ref=
"propertyGroup"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</sequence>
<attribute
name=
"id"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
kind=
"identifier"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"class"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
kind=
"java"
basedOn=
":org.jkiss.dbeaver.model.data.DBDDataFormatter"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"sampleClass"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
kind=
"java"
basedOn=
":org.jkiss.dbeaver.model.data.DBDDataFormatterSample"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"label"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"description"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"property"
>
<complexType>
<attribute
name=
"id"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"label"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"description"
type=
"string"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
<attribute
name=
"type"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"required"
type=
"boolean"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"defaultValue"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute
name=
"validValues"
type=
"string"
>
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element
name=
"propertyGroup"
>
<complexType>
<sequence
minOccurs=
"0"
maxOccurs=
"unbounded"
>
<element
ref=
"property"
/>
</sequence>
<attribute
name=
"label"
type=
"string"
use=
"required"
>
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute
translatable=
"true"
/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section
type=
"since"
/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"examples"
/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"apiinfo"
/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section
type=
"implementation"
/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
浏览文件 @
16436324
...
@@ -40,11 +40,13 @@ import org.jkiss.dbeaver.model.qm.QMController;
...
@@ -40,11 +40,13 @@ import org.jkiss.dbeaver.model.qm.QMController;
import
org.jkiss.dbeaver.model.qm.QMUtils
;
import
org.jkiss.dbeaver.model.qm.QMUtils
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.OSDescriptor
;
import
org.jkiss.dbeaver.model.runtime.OSDescriptor
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterRegistry
;
import
org.jkiss.dbeaver.registry.DataSourceProviderRegistry
;
import
org.jkiss.dbeaver.registry.DataSourceProviderRegistry
;
import
org.jkiss.dbeaver.registry.PluginServiceRegistry
;
import
org.jkiss.dbeaver.registry.PluginServiceRegistry
;
import
org.jkiss.dbeaver.registry.ProjectRegistry
;
import
org.jkiss.dbeaver.registry.ProjectRegistry
;
import
org.jkiss.dbeaver.registry.datatype.DataTypeProviderRegistry
;
import
org.jkiss.dbeaver.registry.datatype.DataTypeProviderRegistry
;
import
org.jkiss.dbeaver.registry.editor.EntityEditorsRegistry
;
import
org.jkiss.dbeaver.registry.editor.EntityEditorsRegistry
;
import
org.jkiss.dbeaver.registry.sql.SQLFormatterConfigurationRegistry
;
import
org.jkiss.dbeaver.runtime.IPluginService
;
import
org.jkiss.dbeaver.runtime.IPluginService
;
import
org.jkiss.dbeaver.runtime.jobs.KeepAliveJob
;
import
org.jkiss.dbeaver.runtime.jobs.KeepAliveJob
;
import
org.jkiss.dbeaver.runtime.net.GlobalProxySelector
;
import
org.jkiss.dbeaver.runtime.net.GlobalProxySelector
;
...
@@ -349,6 +351,11 @@ public class DBeaverCore implements DBPPlatform {
...
@@ -349,6 +351,11 @@ public class DBeaverCore implements DBPPlatform {
return
EntityEditorsRegistry
.
getInstance
();
return
EntityEditorsRegistry
.
getInstance
();
}
}
@Override
public
SQLFormatterRegistry
getSQLFormatterRegistry
()
{
return
SQLFormatterConfigurationRegistry
.
getInstance
();
}
@NotNull
@NotNull
@Override
@Override
public
DBPPreferenceStore
getPreferenceStore
()
{
public
DBPPreferenceStore
getPreferenceStore
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/sql/SQLFormatterConfigurationRegistry.java
0 → 100644
浏览文件 @
16436324
/*
* 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.registry.sql
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.IExtensionRegistry
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatter
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterRegistry
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
SQLFormatterConfigurationRegistry
implements
SQLFormatterRegistry
{
private
static
final
Log
log
=
Log
.
getLog
(
SQLFormatterConfigurationRegistry
.
class
);
private
static
final
String
TAG_FORMATTER
=
"formatter"
;
//$NON-NLS-1$
private
static
SQLFormatterConfigurationRegistry
instance
=
null
;
public
synchronized
static
SQLFormatterConfigurationRegistry
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
SQLFormatterConfigurationRegistry
();
instance
.
loadExtensions
(
Platform
.
getExtensionRegistry
());
}
return
instance
;
}
private
final
List
<
SQLFormatterDescriptor
>
formatters
=
new
ArrayList
<>();
private
SQLFormatterConfigurationRegistry
()
{
}
private
void
loadExtensions
(
IExtensionRegistry
registry
)
{
IConfigurationElement
[]
extConfigs
=
registry
.
getConfigurationElementsFor
(
SQLFormatterDescriptor
.
EXTENSION_ID
);
for
(
IConfigurationElement
ext
:
extConfigs
)
{
// Load formatters
if
(
TAG_FORMATTER
.
equals
(
ext
.
getName
()))
{
this
.
formatters
.
add
(
new
SQLFormatterDescriptor
(
ext
));
}
}
}
public
void
dispose
()
{
formatters
.
clear
();
}
public
List
<
SQLFormatterDescriptor
>
getFormatters
()
{
return
formatters
;
}
public
SQLFormatterDescriptor
getFormatter
(
String
id
)
{
for
(
SQLFormatterDescriptor
formatter
:
formatters
)
{
if
(
formatter
.
getId
().
equalsIgnoreCase
(
id
))
{
return
formatter
;
}
}
return
null
;
}
@Override
@Nullable
public
SQLFormatter
createFormatter
(
SQLFormatterConfiguration
configuration
)
{
final
String
formatterId
=
configuration
.
getFormatterId
();
SQLFormatterDescriptor
formatterDesc
=
getFormatter
(
formatterId
);
if
(
formatterDesc
==
null
)
{
log
.
error
(
"Formatter '"
+
formatterId
+
"' not found"
);
return
null
;
}
try
{
return
formatterDesc
.
createFormatter
();
}
catch
(
DBException
e
)
{
log
.
error
(
"Error creating formatter"
,
e
);
return
null
;
}
}
@Override
@Nullable
public
SQLFormatter
createAndConfigureFormatter
(
SQLFormatterConfiguration
configuration
)
{
final
String
formatterId
=
configuration
.
getFormatterId
();
SQLFormatterDescriptor
formatterDesc
=
getFormatter
(
formatterId
);
if
(
formatterDesc
==
null
)
{
log
.
error
(
"Formatter '"
+
formatterId
+
"' not found"
);
return
null
;
}
try
{
SQLFormatter
formatter
=
formatterDesc
.
createFormatter
();
SQLFormatterConfigurer
configurer
=
formatterDesc
.
createConfigurer
();
if
(
configurer
!=
null
)
{
configurer
.
configure
(
formatter
,
configuration
);
}
return
formatter
;
}
catch
(
DBException
e
)
{
log
.
error
(
"Error creating and configuring formatter"
,
e
);
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/sql/SQLFormatterConfigurer.java
0 → 100644
浏览文件 @
16436324
/*
* 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.registry.sql
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatter
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
/**
* SQL Formatter configurer
*/
public
interface
SQLFormatterConfigurer
{
void
configure
(
SQLFormatter
formatter
,
SQLFormatterConfiguration
configuration
);
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/sql/SQLFormatterDescriptor.java
0 → 100644
浏览文件 @
16436324
/*
* 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.registry.sql
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.jgit.annotations.Nullable
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.impl.AbstractDescriptor
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatter
;
import
org.jkiss.dbeaver.registry.AbstractContextDescriptor
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.utils.CommonUtils
;
/**
* SQLFormatterDescriptor
*/
public
class
SQLFormatterDescriptor
extends
AbstractContextDescriptor
{
public
static
final
String
EXTENSION_ID
=
"org.jkiss.dbeaver.sqlFormatter"
;
//$NON-NLS-1$
private
final
String
id
;
private
final
String
label
;
private
final
String
description
;
private
final
AbstractDescriptor
.
ObjectType
formatterImplClass
;
private
final
AbstractDescriptor
.
ObjectType
configurerImplClass
;
public
SQLFormatterDescriptor
(
IConfigurationElement
config
)
{
super
(
config
);
this
.
id
=
config
.
getAttribute
(
"id"
);
this
.
label
=
config
.
getAttribute
(
"label"
);
this
.
description
=
config
.
getAttribute
(
"description"
);
this
.
formatterImplClass
=
new
AbstractDescriptor
.
ObjectType
(
config
.
getAttribute
(
"class"
));
if
(!
CommonUtils
.
isEmpty
(
config
.
getAttribute
(
"configurerClass"
)))
{
this
.
configurerImplClass
=
new
AbstractDescriptor
.
ObjectType
(
config
.
getAttribute
(
"configurerClass"
));
}
else
{
this
.
configurerImplClass
=
null
;
}
}
public
String
getId
()
{
return
id
;
}
public
String
getLabel
()
{
return
label
;
}
public
String
getDescription
()
{
return
description
;
}
@NotNull
public
SQLFormatter
createFormatter
()
throws
DBException
{
return
formatterImplClass
.
createInstance
(
SQLFormatter
.
class
);
}
@Nullable
public
SQLFormatterConfigurer
createConfigurer
()
throws
DBException
{
if
(
configurerImplClass
==
null
)
{
return
null
;
}
return
configurerImplClass
.
createInstance
(
SQLFormatterConfigurer
.
class
);
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLFormattingStrategy.java
浏览文件 @
16436324
...
@@ -19,9 +19,11 @@ package org.jkiss.dbeaver.ui.editors.sql.syntax;
...
@@ -19,9 +19,11 @@ package org.jkiss.dbeaver.ui.editors.sql.syntax;
import
org.eclipse.jface.text.IDocument
;
import
org.eclipse.jface.text.IDocument
;
import
org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy
;
import
org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy
;
import
org.eclipse.jface.text.source.ISourceViewer
;
import
org.eclipse.jface.text.source.ISourceViewer
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.sql.SQLSyntaxManager
;
import
org.jkiss.dbeaver.model.sql.SQLSyntaxManager
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatter
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatter
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
import
org.jkiss.dbeaver.registry.sql.SQLFormatterConfigurationRegistry
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorSourceViewerConfiguration
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorSourceViewerConfiguration
;
/**
/**
...
@@ -55,7 +57,11 @@ public class SQLFormattingStrategy extends ContextBasedFormattingStrategy
...
@@ -55,7 +57,11 @@ public class SQLFormattingStrategy extends ContextBasedFormattingStrategy
SQLFormatterConfiguration
configuration
=
new
SQLFormatterConfiguration
(
sqlSyntax
);
SQLFormatterConfiguration
configuration
=
new
SQLFormatterConfiguration
(
sqlSyntax
);
configuration
.
setIndentString
(
indentPrefixes
[
0
]);
configuration
.
setIndentString
(
indentPrefixes
[
0
]);
SQLFormatter
formatter
=
configuration
.
createFormatter
();
SQLFormatter
formatter
=
SQLFormatterConfigurationRegistry
.
getInstance
().
createAndConfigureFormatter
(
configuration
);
if
(
formatter
==
null
)
{
DBeaverUI
.
getInstance
().
showError
(
"SQL Format"
,
"Can't create SQL formatter. See error log."
);
return
content
;
}
return
formatter
.
format
(
content
,
configuration
);
return
formatter
.
format
(
content
,
configuration
);
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLFormat.java
浏览文件 @
16436324
...
@@ -31,6 +31,7 @@ import org.eclipse.swt.layout.GridData;
...
@@ -31,6 +31,7 @@ import org.eclipse.swt.layout.GridData;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.IEditorSite
;
import
org.eclipse.ui.IEditorSite
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
...
@@ -38,7 +39,8 @@ import org.jkiss.dbeaver.model.DBPIdentifierCase;
...
@@ -38,7 +39,8 @@ import org.jkiss.dbeaver.model.DBPIdentifierCase;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.sql.format.external.SQLExternalFormatter
;
import
org.jkiss.dbeaver.model.sql.format.external.SQLExternalFormatter
;
import
org.jkiss.dbeaver.model.sql.format.tokenized.SQLTokenizedFormatter
;
import
org.jkiss.dbeaver.registry.sql.SQLFormatterConfigurationRegistry
;
import
org.jkiss.dbeaver.registry.sql.SQLFormatterDescriptor
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.StringEditorInput
;
import
org.jkiss.dbeaver.ui.editors.StringEditorInput
;
import
org.jkiss.dbeaver.ui.editors.SubEditorSite
;
import
org.jkiss.dbeaver.ui.editors.SubEditorSite
;
...
@@ -48,9 +50,9 @@ import org.jkiss.dbeaver.utils.ContentUtils;
...
@@ -48,9 +50,9 @@ import org.jkiss.dbeaver.utils.ContentUtils;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
/**
/**
...
@@ -81,6 +83,7 @@ public class PrefPageSQLFormat extends TargetPrefPage
...
@@ -81,6 +83,7 @@ public class PrefPageSQLFormat extends TargetPrefPage
private
SQLEditorBase
sqlViewer
;
private
SQLEditorBase
sqlViewer
;
private
Composite
defaultGroup
;
private
Composite
defaultGroup
;
private
Composite
externalGroup
;
private
Composite
externalGroup
;
private
List
<
SQLFormatterDescriptor
>
formatters
;
public
PrefPageSQLFormat
()
public
PrefPageSQLFormat
()
{
{
...
@@ -148,8 +151,10 @@ public class PrefPageSQLFormat extends TargetPrefPage
...
@@ -148,8 +151,10 @@ public class PrefPageSQLFormat extends TargetPrefPage
formatterPanel
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
formatterPanel
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
formatterSelector
=
UIUtils
.
createLabelCombo
(
formatterPanel
,
CoreMessages
.
pref_page_sql_format_label_formatter
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
formatterSelector
=
UIUtils
.
createLabelCombo
(
formatterPanel
,
CoreMessages
.
pref_page_sql_format_label_formatter
,
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
formatterSelector
.
add
(
capitalizeCaseName
(
SQLTokenizedFormatter
.
FORMATTER_ID
));
formatters
=
SQLFormatterConfigurationRegistry
.
getInstance
().
getFormatters
();
formatterSelector
.
add
(
capitalizeCaseName
(
SQLExternalFormatter
.
FORMATTER_ID
));
for
(
SQLFormatterDescriptor
formatterDesc
:
formatters
)
{
formatterSelector
.
add
(
capitalizeCaseName
(
formatterDesc
.
getLabel
()));
}
formatterSelector
.
addSelectionListener
(
new
SelectionAdapter
()
{
formatterSelector
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
public
void
widgetSelected
(
SelectionEvent
e
)
{
...
@@ -259,8 +264,15 @@ public class PrefPageSQLFormat extends TargetPrefPage
...
@@ -259,8 +264,15 @@ public class PrefPageSQLFormat extends TargetPrefPage
afKeywordCase
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
SQL_FORMAT_KEYWORD_CASE_AUTO
));
afKeywordCase
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
SQL_FORMAT_KEYWORD_CASE_AUTO
));
afExtractFromSource
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
SQL_FORMAT_EXTRACT_FROM_SOURCE
));
afExtractFromSource
.
setSelection
(
store
.
getBoolean
(
SQLPreferenceConstants
.
SQL_FORMAT_EXTRACT_FROM_SOURCE
));
String
formatterId
=
store
.
getString
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
);
for
(
int
i
=
0
;
i
<
formatters
.
size
();
i
++)
{
if
(
formatters
.
get
(
i
).
getId
().
equalsIgnoreCase
(
formatterId
))
{
formatterSelector
.
select
(
i
);
break
;
}
}
if
(
formatterSelector
.
getSelectionIndex
()
<
0
)
formatterSelector
.
select
(
0
);
UIUtils
.
setComboSelection
(
formatterSelector
,
capitalizeCaseName
(
store
.
getString
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
)));
final
String
caseName
=
store
.
getString
(
ModelPreferences
.
SQL_FORMAT_KEYWORD_CASE
);
final
String
caseName
=
store
.
getString
(
ModelPreferences
.
SQL_FORMAT_KEYWORD_CASE
);
if
(
CommonUtils
.
isEmpty
(
caseName
))
{
if
(
CommonUtils
.
isEmpty
(
caseName
))
{
keywordCaseCombo
.
select
(
0
);
keywordCaseCombo
.
select
(
0
);
...
@@ -286,7 +298,8 @@ public class PrefPageSQLFormat extends TargetPrefPage
...
@@ -286,7 +298,8 @@ public class PrefPageSQLFormat extends TargetPrefPage
store
.
setValue
(
SQLPreferenceConstants
.
SQL_FORMAT_KEYWORD_CASE_AUTO
,
afKeywordCase
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
SQL_FORMAT_KEYWORD_CASE_AUTO
,
afKeywordCase
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
SQL_FORMAT_EXTRACT_FROM_SOURCE
,
afExtractFromSource
.
getSelection
());
store
.
setValue
(
SQLPreferenceConstants
.
SQL_FORMAT_EXTRACT_FROM_SOURCE
,
afExtractFromSource
.
getSelection
());
store
.
setValue
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
,
formatterSelector
.
getText
().
toUpperCase
(
Locale
.
ENGLISH
));
store
.
setValue
(
ModelPreferences
.
SQL_FORMAT_FORMATTER
,
formatters
.
get
(
formatterSelector
.
getSelectionIndex
()).
getId
().
toUpperCase
(
Locale
.
ENGLISH
));
final
String
caseName
;
final
String
caseName
;
if
(
keywordCaseCombo
.
getSelectionIndex
()
==
0
)
{
if
(
keywordCaseCombo
.
getSelectionIndex
()
==
0
)
{
...
@@ -330,11 +343,12 @@ public class PrefPageSQLFormat extends TargetPrefPage
...
@@ -330,11 +343,12 @@ public class PrefPageSQLFormat extends TargetPrefPage
}
}
private
void
showFormatterSettings
()
{
private
void
showFormatterSettings
()
{
final
boolean
isDefFormatter
=
formatterSelector
.
getSelectionIndex
()
==
0
;
SQLFormatterDescriptor
selFormatter
=
formatters
.
get
(
formatterSelector
.
getSelectionIndex
());
defaultGroup
.
setVisible
(
isDefFormatter
);
boolean
isExternal
=
selFormatter
.
getId
().
equalsIgnoreCase
(
SQLExternalFormatter
.
FORMATTER_ID
);
externalGroup
.
setVisible
(!
isDefFormatter
);
defaultGroup
.
setVisible
(!
isExternal
);
((
GridData
)
defaultGroup
.
getLayoutData
()).
exclude
=
!
isDefFormatter
;
externalGroup
.
setVisible
(
isExternal
);
((
GridData
)
externalGroup
.
getLayoutData
()).
exclude
=
isDefFormatter
;
((
GridData
)
defaultGroup
.
getLayoutData
()).
exclude
=
isExternal
;
((
GridData
)
externalGroup
.
getLayoutData
()).
exclude
=
!
isExternal
;
defaultGroup
.
getParent
().
layout
();
defaultGroup
.
getParent
().
layout
();
}
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
浏览文件 @
16436324
...
@@ -29,6 +29,7 @@ import org.jkiss.dbeaver.model.exec.DBCSession;
...
@@ -29,6 +29,7 @@ import org.jkiss.dbeaver.model.exec.DBCSession;
import
org.jkiss.dbeaver.model.impl.sql.BasicSQLDialect
;
import
org.jkiss.dbeaver.model.impl.sql.BasicSQLDialect
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatter
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
import
org.jkiss.dbeaver.model.sql.format.SQLFormatterConfiguration
;
import
org.jkiss.dbeaver.model.struct.DBSAttributeBase
;
import
org.jkiss.dbeaver.model.struct.DBSAttributeBase
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
...
@@ -280,7 +281,11 @@ public final class SQLUtils {
...
@@ -280,7 +281,11 @@ public final class SQLUtils {
SQLSyntaxManager
syntaxManager
=
new
SQLSyntaxManager
();
SQLSyntaxManager
syntaxManager
=
new
SQLSyntaxManager
();
syntaxManager
.
init
(
dataSource
.
getSQLDialect
(),
dataSource
.
getContainer
().
getPreferenceStore
());
syntaxManager
.
init
(
dataSource
.
getSQLDialect
(),
dataSource
.
getContainer
().
getPreferenceStore
());
SQLFormatterConfiguration
configuration
=
new
SQLFormatterConfiguration
(
syntaxManager
);
SQLFormatterConfiguration
configuration
=
new
SQLFormatterConfiguration
(
syntaxManager
);
return
configuration
.
createFormatter
().
format
(
query
,
configuration
);
SQLFormatter
formatter
=
dataSource
.
getDataSource
().
getContainer
().
getPlatform
().
getSQLFormatterRegistry
().
createFormatter
(
configuration
);
if
(
formatter
==
null
)
{
return
query
;
}
return
formatter
.
format
(
query
,
configuration
);
}
}
public
static
void
appendLikeCondition
(
StringBuilder
sql
,
String
value
,
boolean
not
)
public
static
void
appendLikeCondition
(
StringBuilder
sql
,
String
value
,
boolean
not
)
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterConfiguration.java
浏览文件 @
16436324
...
@@ -23,8 +23,6 @@ import org.jkiss.dbeaver.model.DBPIdentifierCase;
...
@@ -23,8 +23,6 @@ import org.jkiss.dbeaver.model.DBPIdentifierCase;
import
org.jkiss.dbeaver.model.DBPKeywordType
;
import
org.jkiss.dbeaver.model.DBPKeywordType
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.sql.SQLSyntaxManager
;
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.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
...
@@ -112,14 +110,6 @@ public class SQLFormatterConfiguration {
...
@@ -112,14 +110,6 @@ public class SQLFormatterConfiguration {
this
.
properties
=
properties
;
this
.
properties
=
properties
;
}
}
public
SQLFormatter
createFormatter
()
{
if
(
SQLExternalFormatter
.
FORMATTER_ID
.
equals
(
formatterId
))
{
return
new
SQLExternalFormatter
();
}
else
{
return
new
SQLTokenizedFormatter
();
}
}
public
DBPPreferenceStore
getPreferenceStore
()
{
public
DBPPreferenceStore
getPreferenceStore
()
{
return
syntaxManager
.
getPreferenceStore
();
return
syntaxManager
.
getPreferenceStore
();
}
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/format/SQLFormatterRegistry.java
浏览文件 @
16436324
...
@@ -16,13 +16,24 @@
...
@@ -16,13 +16,24 @@
*/
*/
package
org.jkiss.dbeaver.model.sql.format
;
package
org.jkiss.dbeaver.model.sql.format
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
/**
/**
* SQL Formatter registry
* SQL Formatter registry
*/
*/
public
interface
SQLFormatterRegistry
{
public
interface
SQLFormatterRegistry
{
SQLFormatter
createAndConfigureFormatter
(
SQLFormatterConfiguration
configuration
)
throws
DBException
;
/**
* Creates new formatter. Uses default config and doesn't interact with user for any configuration.
*/
@Nullable
SQLFormatter
createFormatter
(
@NotNull
SQLFormatterConfiguration
configuration
);
/**
* Creates and configures new formatter. Interacts with user in needed.
*/
@Nullable
SQLFormatter
createAndConfigureFormatter
(
@NotNull
SQLFormatterConfiguration
configuration
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录