Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
c5dd5eb6
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,发现更多精彩内容 >>
提交
c5dd5eb6
编写于
1月 01, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#10 SQL Editor extraction: prefs + utils refactoring
上级
942af566
变更
25
展开全部
隐藏空白更改
内联
并排
Showing
25 changed file
with
972 addition
and
952 deletion
+972
-952
plugins/org.jkiss.dbeaver.core.application/plugin.xml
plugins/org.jkiss.dbeaver.core.application/plugin.xml
+6
-6
plugins/org.jkiss.dbeaver.core.eclipse/plugin.xml
plugins/org.jkiss.dbeaver.core.eclipse/plugin.xml
+6
-6
plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF
+1
-0
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+7
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/scripts/ScriptsImportWizard.java
.../org/jkiss/dbeaver/tools/scripts/ScriptsImportWizard.java
+3
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/ScriptSelectorPanel.java
...rc/org/jkiss/dbeaver/ui/controls/ScriptSelectorPanel.java
+3
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/EditConnectionWizard.java
...s/dbeaver/ui/dialogs/connection/EditConnectionWizard.java
+2
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
...e/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorUtils.java
.../src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorUtils.java
+76
-98
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/handlers/OpenHandler.java
...rg/jkiss/dbeaver/ui/editors/sql/handlers/OpenHandler.java
+8
-8
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/handlers/OpenObjectConsoleHandler.java
...ver/ui/editors/sql/handlers/OpenObjectConsoleHandler.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/PrefPageSQLCompletion.java
...ver/ui/editors/sql/preferences/PrefPageSQLCompletion.java
+5
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/PrefPageSQLEditor.java
...dbeaver/ui/editors/sql/preferences/PrefPageSQLEditor.java
+220
-216
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/PrefPageSQLExecute.java
...beaver/ui/editors/sql/preferences/PrefPageSQLExecute.java
+305
-301
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/PrefPageSQLFormat.java
...dbeaver/ui/editors/sql/preferences/PrefPageSQLFormat.java
+5
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/PrefPageSQLResources.java
...aver/ui/editors/sql/preferences/PrefPageSQLResources.java
+2
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/PrefPageSQLTemplates.java
...aver/ui/editors/sql/preferences/PrefPageSQLTemplates.java
+55
-54
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/preferences/format_preview.sql
...iss/dbeaver/ui/editors/sql/preferences/format_preview.sql
+0
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/scripts/ScriptsHandlerImpl.java
...ss/dbeaver/ui/editors/sql/scripts/ScriptsHandlerImpl.java
+131
-129
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageDatabaseGeneral.java
...jkiss/dbeaver/ui/preferences/PrefPageDatabaseGeneral.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/resources/bookmarks/BookmarksHandlerImpl.java
.../dbeaver/ui/resources/bookmarks/BookmarksHandlerImpl.java
+1
-2
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/navigator/ERDResourceHandler.java
...g/jkiss/dbeaver/ext/erd/navigator/ERDResourceHandler.java
+1
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
...eaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
+19
-0
plugins/org.jkiss.dbeaver.ui.navigator/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.ui.navigator/META-INF/MANIFEST.MF
+1
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/resources/AbstractResourceHandler.java
...g/jkiss/dbeaver/ui/resources/AbstractResourceHandler.java
+111
-111
未找到文件。
plugins/org.jkiss.dbeaver.core.application/plugin.xml
浏览文件 @
c5dd5eb6
...
...
@@ -287,27 +287,27 @@
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.entity"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.editors"
id=
"org.jkiss.dbeaver.preferences.main.sqleditor"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLEditor"
name=
"%pref.page.name.sql.editor"
>
<page
category=
"org.jkiss.dbeaver.preferences.editors"
id=
"org.jkiss.dbeaver.preferences.main.sqleditor"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLEditor"
name=
"%pref.page.name.sql.editor"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sqlexecute"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLExecute"
name=
"%pref.page.name.sql.execute"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sqlexecute"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLExecute"
name=
"%pref.page.name.sql.execute"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.completion"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLCompletion"
name=
"%pref.page.name.sql.completion"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.completion"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLCompletion"
name=
"%pref.page.name.sql.completion"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.format"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLFormat"
name=
"%pref.page.name.sql.format"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.format"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLFormat"
name=
"%pref.page.name.sql.format"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.resources"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLResources"
name=
"%pref.page.name.sql.resources"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.resources"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLResources"
name=
"%pref.page.name.sql.resources"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.templates"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLTemplates"
name=
"%pref.page.name.sql.templates"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.templates"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLTemplates"
name=
"%pref.page.name.sql.templates"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
...
...
plugins/org.jkiss.dbeaver.core.eclipse/plugin.xml
浏览文件 @
c5dd5eb6
...
...
@@ -106,27 +106,27 @@
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.entity"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.editors"
id=
"org.jkiss.dbeaver.preferences.main.sqleditor"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLEditor"
name=
"%pref.page.name.sql.editor"
>
<page
category=
"org.jkiss.dbeaver.preferences.editors"
id=
"org.jkiss.dbeaver.preferences.main.sqleditor"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLEditor"
name=
"%pref.page.name.sql.editor"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sqlexecute"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLExecute"
name=
"%pref.page.name.sql.execute"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sqlexecute"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLExecute"
name=
"%pref.page.name.sql.execute"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.format"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLFormat"
name=
"%pref.page.name.sql.format"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.format"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLFormat"
name=
"%pref.page.name.sql.format"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.resources"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLResources"
name=
"%pref.page.name.sql.resources"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.resources"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLResources"
name=
"%pref.page.name.sql.resources"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.templates"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLTemplates"
name=
"%pref.page.name.sql.templates"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.templates"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLTemplates"
name=
"%pref.page.name.sql.templates"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.completion"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLCompletion"
name=
"%pref.page.name.sql.completion"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.completion"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLCompletion"
name=
"%pref.page.name.sql.completion"
>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.pref.editor.sql"
/>
<keywordReference
id=
"org.jkiss.dbeaver.core.keyword.dbeaver"
/>
</page>
...
...
plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF
浏览文件 @
c5dd5eb6
...
...
@@ -43,6 +43,7 @@ Export-Package: org.jkiss.dbeaver,
org.jkiss.dbeaver.ui.editors.sql.indent,
org.jkiss.dbeaver.ui.editors.sql.log,
org.jkiss.dbeaver.ui.editors.sql.registry,
org.jkiss.dbeaver.ui.editors.sql.scripts,
org.jkiss.dbeaver.ui.editors.sql.syntax,
org.jkiss.dbeaver.ui.editors.sql.syntax.rules,
org.jkiss.dbeaver.ui.editors.sql.syntax.tokens,
...
...
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
c5dd5eb6
...
...
@@ -2409,22 +2409,22 @@
</enabledWhen>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.editors"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLEditor"
id=
"org.jkiss.dbeaver.preferences.main.sqleditor"
name=
"%page.org.jkiss.dbeaver.preferences.main.sqleditor.name"
>
<page
category=
"org.jkiss.dbeaver.preferences.editors"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLEditor"
id=
"org.jkiss.dbeaver.preferences.main.sqleditor"
name=
"%page.org.jkiss.dbeaver.preferences.main.sqleditor.name"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.preferences.datasource"
/></enabledWhen>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.completion"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLCompletion"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.completion.name"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.completion"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLCompletion"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.completion.name"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.preferences.datasource"
/></enabledWhen>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.resources"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLResources"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.resources.name"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.resources"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLResources"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.resources.name"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.preferences.datasource"
/></enabledWhen>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.format"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLFormat"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.format.name"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sql.format"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLFormat"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.format.name"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.preferences.datasource"
/></enabledWhen>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sqlexecute"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLExecute"
name=
"%page.org.jkiss.dbeaver.preferences.main.sqlexecute.name"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
id=
"org.jkiss.dbeaver.preferences.main.sqlexecute"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLExecute"
name=
"%page.org.jkiss.dbeaver.preferences.main.sqlexecute.name"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.preferences.datasource"
/></enabledWhen>
</page>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageSQLTemplates"
id=
"org.jkiss.dbeaver.preferences.main.sql.templates"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.templates.name"
>
<page
category=
"org.jkiss.dbeaver.preferences.main.sqleditor"
class=
"org.jkiss.dbeaver.ui.
editors.sql.
preferences.PrefPageSQLTemplates"
id=
"org.jkiss.dbeaver.preferences.main.sql.templates"
name=
"%page.org.jkiss.dbeaver.preferences.main.sql.templates.name"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.preferences.datasource"
/></enabledWhen>
</page>
<page
class=
"org.jkiss.dbeaver.ui.preferences.PrefPageQueryManager"
id=
"org.jkiss.dbeaver.preferences.main.qm"
name=
"%page.org.jkiss.dbeaver.preferences.main.qm.name"
>
...
...
@@ -2872,7 +2872,7 @@
<handler
id=
"projects"
class=
"org.jkiss.dbeaver.ui.resources.ProjectHandlerImpl"
>
<resourceTypeBinding
resourceType=
"org.eclipse.core.resources.IProject"
/>
</handler>
<handler
id=
"scripts"
class=
"org.jkiss.dbeaver.ui.
resource
s.ScriptsHandlerImpl"
name=
"SQL scripts"
managable=
"true"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/scripts.png"
>
<handler
id=
"scripts"
class=
"org.jkiss.dbeaver.ui.
editors.sql.script
s.ScriptsHandlerImpl"
name=
"SQL scripts"
managable=
"true"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/scripts.png"
>
<root
folder=
"Scripts"
/>
<contentTypeBinding
contentTypeId=
"org.jkiss.dbeaver.sql"
/>
</handler>
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/scripts/ScriptsImportWizard.java
浏览文件 @
c5dd5eb6
...
...
@@ -35,7 +35,7 @@ import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.
resources.Resource
Utils
;
import
org.jkiss.dbeaver.ui.
editors.sql.SQLEditor
Utils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -138,8 +138,8 @@ public class ScriptsImportWizard extends Wizard implements IImportWizard {
}
}
String
targetName
=
file
.
getName
();
if
(!
targetName
.
toLowerCase
().
endsWith
(
"."
+
Resource
Utils
.
SCRIPT_FILE_EXTENSION
))
{
//$NON-NLS-1$
targetName
+=
"."
+
Resource
Utils
.
SCRIPT_FILE_EXTENSION
;
//$NON-NLS-1$
if
(!
targetName
.
toLowerCase
().
endsWith
(
"."
+
SQLEditor
Utils
.
SCRIPT_FILE_EXTENSION
))
{
//$NON-NLS-1$
targetName
+=
"."
+
SQLEditor
Utils
.
SCRIPT_FILE_EXTENSION
;
//$NON-NLS-1$
}
final
IFile
targetFile
=
targetDir
.
getFile
(
targetName
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/ScriptSelectorPanel.java
浏览文件 @
c5dd5eb6
...
...
@@ -45,9 +45,9 @@ import org.jkiss.dbeaver.ui.DBeaverIcons;
import
org.jkiss.dbeaver.ui.TextUtils
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.handlers.OpenHandler
;
import
org.jkiss.dbeaver.ui.resources.ResourceUtils
;
import
org.jkiss.dbeaver.ui.resources.ResourceUtils.ResourceInfo
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorUtils.ResourceInfo
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.File
;
...
...
@@ -135,7 +135,7 @@ public class ScriptSelectorPanel {
popup
.
dispose
();
IFile
scriptFile
;
try
{
scriptFile
=
Resource
Utils
.
createNewScript
(
rootFolder
.
getProject
(),
rootFolder
,
containers
.
length
==
0
?
null
:
containers
[
0
]);
scriptFile
=
SQLEditor
Utils
.
createNewScript
(
rootFolder
.
getProject
(),
rootFolder
,
containers
.
length
==
0
?
null
:
containers
[
0
]);
OpenHandler
.
openResource
(
scriptFile
,
workbenchWindow
);
}
catch
(
CoreException
ex
)
{
log
.
error
(
ex
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/EditConnectionWizard.java
浏览文件 @
c5dd5eb6
...
...
@@ -43,6 +43,8 @@ import org.jkiss.dbeaver.ui.editors.data.preferences.PrefPageDataFormat;
import
org.jkiss.dbeaver.ui.editors.data.preferences.PrefPageResultSetEditors
;
import
org.jkiss.dbeaver.ui.editors.data.preferences.PrefPageResultSetMain
;
import
org.jkiss.dbeaver.ui.editors.data.preferences.PrefPageResultSetPresentation
;
import
org.jkiss.dbeaver.ui.editors.sql.preferences.PrefPageSQLEditor
;
import
org.jkiss.dbeaver.ui.editors.sql.preferences.PrefPageSQLExecute
;
import
org.jkiss.dbeaver.ui.preferences.*
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
浏览文件 @
c5dd5eb6
...
...
@@ -58,6 +58,7 @@ import org.jkiss.dbeaver.runtime.DBWorkbench;
import
org.jkiss.dbeaver.ui.*
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages
;
import
org.jkiss.dbeaver.ui.editors.sql.preferences.*
;
import
org.jkiss.dbeaver.ui.editors.sql.registry.SQLCommandsRegistry
;
import
org.jkiss.dbeaver.ui.editors.sql.syntax.SQLCharacterPairMatcher
;
import
org.jkiss.dbeaver.ui.editors.sql.syntax.SQLPartitionScanner
;
...
...
@@ -69,7 +70,6 @@ import org.jkiss.dbeaver.ui.editors.sql.syntax.tokens.SQLToken;
import
org.jkiss.dbeaver.ui.editors.sql.templates.SQLTemplatesPage
;
import
org.jkiss.dbeaver.ui.editors.sql.util.SQLSymbolInserter
;
import
org.jkiss.dbeaver.ui.editors.text.BaseTextEditor
;
import
org.jkiss.dbeaver.ui.preferences.*
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.Pair
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
resources/Resource
Utils.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/SQLEditor
Utils.java
浏览文件 @
c5dd5eb6
...
...
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.
resources
;
package
org.jkiss.dbeaver.ui.
editors.sql
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IFolder
;
...
...
@@ -22,17 +22,14 @@ import org.eclipse.core.resources.IProject;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.*
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBPDataSourceFolder
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.
SQLPreferenceConstants
;
import
org.jkiss.dbeaver.ui.editors.sql.
scripts.ScriptsHandlerImpl
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -44,90 +41,14 @@ import java.util.List;
import
java.util.Map
;
/**
*
ResourceU
tils
*
SQLEditor u
tils
*/
public
class
Resource
Utils
{
public
class
SQLEditor
Utils
{
private
static
final
Log
log
=
Log
.
getLog
(
Resource
Utils
.
class
);
private
static
final
Log
log
=
Log
.
getLog
(
SQLEditor
Utils
.
class
);
public
static
final
String
SCRIPT_FILE_EXTENSION
=
"sql"
;
//$NON-NLS-1$
public
static
class
ResourceInfo
{
private
final
IResource
resource
;
private
final
File
localFile
;
private
final
DBPDataSourceContainer
dataSource
;
private
final
List
<
ResourceInfo
>
children
;
private
String
description
;
public
ResourceInfo
(
IFile
file
,
DBPDataSourceContainer
dataSource
)
{
this
.
resource
=
file
;
this
.
localFile
=
file
.
getLocation
().
toFile
();
this
.
dataSource
=
dataSource
;
this
.
children
=
null
;
}
public
ResourceInfo
(
IFolder
folder
)
{
this
.
resource
=
folder
;
this
.
localFile
=
folder
.
getLocation
().
toFile
();
this
.
dataSource
=
null
;
this
.
children
=
new
ArrayList
<>();
}
public
ResourceInfo
(
File
localFile
,
DBPDataSourceContainer
dataSource
)
{
this
.
resource
=
null
;
this
.
localFile
=
localFile
;
this
.
dataSource
=
dataSource
;
this
.
children
=
null
;
}
public
IResource
getResource
()
{
return
resource
;
}
public
File
getLocalFile
()
{
return
localFile
;
}
public
String
getName
()
{
return
resource
!=
null
?
resource
.
getName
()
:
localFile
.
getName
();
}
public
DBPDataSourceContainer
getDataSource
()
{
return
dataSource
;
}
public
boolean
isDirectory
()
{
return
resource
instanceof
IFolder
;
}
public
List
<
ResourceInfo
>
getChildren
()
{
return
children
;
}
public
String
getDescription
()
{
if
(
description
==
null
)
{
description
=
getResourceDescription
(
resource
);
}
return
description
;
}
@Override
public
String
toString
()
{
return
getName
();
}
}
public
static
String
getResourceDescription
(
IResource
resource
)
{
if
(
resource
instanceof
IFolder
)
{
return
""
;
}
else
if
(
resource
instanceof
IFile
&&
SCRIPT_FILE_EXTENSION
.
equals
(
resource
.
getFileExtension
()))
{
String
description
=
SQLUtils
.
getScriptDescription
((
IFile
)
resource
);
if
(
CommonUtils
.
isEmptyTrimmed
(
description
))
{
description
=
"<empty>"
;
}
return
description
;
}
else
{
return
""
;
}
}
public
static
IFolder
getScriptsFolder
(
IProject
project
,
boolean
forceCreate
)
throws
CoreException
{
if
(
project
==
null
)
{
...
...
@@ -252,7 +173,7 @@ public class ResourceUtils {
final
IProgressMonitor
progressMonitor
=
new
NullProgressMonitor
();
// Get folder
final
IFolder
scriptsRootFolder
=
ResourceUtils
.
getScriptsFolder
(
project
,
true
);
final
IFolder
scriptsRootFolder
=
getScriptsFolder
(
project
,
true
);
IFolder
scriptsFolder
=
folder
;
if
(
scriptsFolder
==
null
)
{
scriptsFolder
=
scriptsRootFolder
;
...
...
@@ -309,22 +230,79 @@ public class ResourceUtils {
return
tempFile
;
}
public
static
void
checkFolderExists
(
IFolder
folder
)
throws
DBException
{
checkFolderExists
(
folder
,
new
VoidProgressMonitor
());
public
static
String
getResourceDescription
(
IResource
resource
)
{
if
(
resource
instanceof
IFolder
)
{
return
""
;
}
else
if
(
resource
instanceof
IFile
&&
SCRIPT_FILE_EXTENSION
.
equals
(
resource
.
getFileExtension
()))
{
String
description
=
SQLUtils
.
getScriptDescription
((
IFile
)
resource
);
if
(
CommonUtils
.
isEmptyTrimmed
(
description
))
{
description
=
"<empty>"
;
}
return
description
;
}
else
{
return
""
;
}
}
public
static
void
checkFolderExists
(
IFolder
folder
,
DBRProgressMonitor
monitor
)
throws
DBException
{
if
(!
folder
.
exists
())
{
try
{
folder
.
create
(
true
,
true
,
monitor
.
getNestedMonitor
());
}
catch
(
CoreException
e
)
{
throw
new
DBException
(
"Can't create folder '"
+
folder
.
getFullPath
()
+
"'"
,
e
);
public
static
class
ResourceInfo
{
private
final
IResource
resource
;
private
final
File
localFile
;
private
final
DBPDataSourceContainer
dataSource
;
private
final
List
<
ResourceInfo
>
children
;
private
String
description
;
public
ResourceInfo
(
IFile
file
,
DBPDataSourceContainer
dataSource
)
{
this
.
resource
=
file
;
this
.
localFile
=
file
.
getLocation
().
toFile
();
this
.
dataSource
=
dataSource
;
this
.
children
=
null
;
}
public
ResourceInfo
(
IFolder
folder
)
{
this
.
resource
=
folder
;
this
.
localFile
=
folder
.
getLocation
().
toFile
();
this
.
dataSource
=
null
;
this
.
children
=
new
ArrayList
<>();
}
public
ResourceInfo
(
File
localFile
,
DBPDataSourceContainer
dataSource
)
{
this
.
resource
=
null
;
this
.
localFile
=
localFile
;
this
.
dataSource
=
dataSource
;
this
.
children
=
null
;
}
public
IResource
getResource
()
{
return
resource
;
}
public
File
getLocalFile
()
{
return
localFile
;
}
public
String
getName
()
{
return
resource
!=
null
?
resource
.
getName
()
:
localFile
.
getName
();
}
public
DBPDataSourceContainer
getDataSource
()
{
return
dataSource
;
}
public
boolean
isDirectory
()
{
return
resource
instanceof
IFolder
;
}
public
List
<
ResourceInfo
>
getChildren
()
{
return
children
;
}
public
String
getDescription
()
{
if
(
description
==
null
)
{
description
=
getResourceDescription
(
resource
);
}
return
description
;
}
}
@Override
public
String
toString
()
{
return
getName
();
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/handlers/OpenHandler.java
浏览文件 @
c5dd5eb6
...
...
@@ -50,13 +50,13 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.actions.AbstractDataSourceHandler
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorUtils
;
import
org.jkiss.dbeaver.ui.internal.UINavigatorMessages
;
import
org.jkiss.dbeaver.ui.controls.ScriptSelectorPanel
;
import
org.jkiss.dbeaver.ui.navigator.dialogs.SelectDataSourceDialog
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.editors.StringEditorInput
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditor
;
import
org.jkiss.dbeaver.ui.resources.ResourceUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
java.lang.reflect.InvocationTargetException
;
...
...
@@ -77,7 +77,7 @@ public class OpenHandler extends AbstractDataSourceHandler {
}
}
public
static
void
openResourceEditor
(
IWorkbenchWindow
workbenchWindow
,
Resource
Utils
.
ResourceInfo
resourceInfo
)
{
public
static
void
openResourceEditor
(
IWorkbenchWindow
workbenchWindow
,
SQLEditor
Utils
.
ResourceInfo
resourceInfo
)
{
if
(
resourceInfo
.
getResource
()
!=
null
)
{
openResource
(
resourceInfo
.
getResource
(),
workbenchWindow
);
}
else
if
(
resourceInfo
.
getLocalFile
()
!=
null
)
{
...
...
@@ -117,11 +117,11 @@ public class OpenHandler extends AbstractDataSourceHandler {
checkProjectIsOpen
(
project
);
final
DBPDataSourceContainer
[]
containerList
=
containers
.
toArray
(
new
DBPDataSourceContainer
[
containers
.
size
()]);
final
IFolder
rootFolder
=
Resource
Utils
.
getScriptsFolder
(
project
,
true
);
final
List
<
ResourceUtils
.
ResourceInfo
>
scriptTree
=
Resource
Utils
.
findScriptTree
(
rootFolder
,
containerList
.
length
==
0
?
null
:
containerList
);
final
IFolder
rootFolder
=
SQLEditor
Utils
.
getScriptsFolder
(
project
,
true
);
final
List
<
SQLEditorUtils
.
ResourceInfo
>
scriptTree
=
SQLEditor
Utils
.
findScriptTree
(
rootFolder
,
containerList
.
length
==
0
?
null
:
containerList
);
if
(
scriptTree
.
isEmpty
()
&&
containerList
.
length
==
1
)
{
// Create new script
final
IFile
newScript
=
Resource
Utils
.
createNewScript
(
project
,
rootFolder
,
containers
.
isEmpty
()
?
null
:
containers
.
get
(
0
));
final
IFile
newScript
=
SQLEditor
Utils
.
createNewScript
(
project
,
rootFolder
,
containers
.
isEmpty
()
?
null
:
containers
.
get
(
0
));
openResource
(
newScript
,
workbenchWindow
);
}
else
{
// Show script chooser
...
...
@@ -134,7 +134,7 @@ public class OpenHandler extends AbstractDataSourceHandler {
IProject
project
=
dataSourceContainer
!=
null
?
dataSourceContainer
.
getRegistry
().
getProject
()
:
DBWorkbench
.
getPlatform
().
getProjectManager
().
getActiveProject
();
checkProjectIsOpen
(
project
);
IFolder
folder
=
getCurrentScriptFolder
(
selection
);
IFile
scriptFile
=
Resource
Utils
.
createNewScript
(
project
,
folder
,
dataSourceContainer
);
IFile
scriptFile
=
SQLEditor
Utils
.
createNewScript
(
project
,
folder
,
dataSourceContainer
);
openResource
(
scriptFile
,
workbenchWindow
);
}
...
...
@@ -250,11 +250,11 @@ public class OpenHandler extends AbstractDataSourceHandler {
public
static
void
openRecentScript
(
@NotNull
IWorkbenchWindow
workbenchWindow
,
@Nullable
DBPDataSourceContainer
dataSourceContainer
,
@Nullable
IFolder
scriptFolder
)
throws
CoreException
{
final
IProject
project
=
dataSourceContainer
!=
null
?
dataSourceContainer
.
getRegistry
().
getProject
()
:
DBWorkbench
.
getPlatform
().
getProjectManager
().
getActiveProject
();
checkProjectIsOpen
(
project
);
ResourceUtils
.
ResourceInfo
res
=
Resource
Utils
.
findRecentScript
(
project
,
dataSourceContainer
);
SQLEditorUtils
.
ResourceInfo
res
=
SQLEditor
Utils
.
findRecentScript
(
project
,
dataSourceContainer
);
if
(
res
!=
null
)
{
openResourceEditor
(
workbenchWindow
,
res
);
}
else
{
IFile
scriptFile
=
Resource
Utils
.
createNewScript
(
project
,
scriptFolder
,
dataSourceContainer
);
IFile
scriptFile
=
SQLEditor
Utils
.
createNewScript
(
project
,
scriptFolder
,
dataSourceContainer
);
openResource
(
scriptFile
,
workbenchWindow
);
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/handlers/OpenObjectConsoleHandler.java
浏览文件 @
c5dd5eb6
...
...
@@ -41,9 +41,9 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditor
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.generator.GenerateSQLContributor
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorUtils
;
import
org.jkiss.dbeaver.ui.resources.ResourceUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -94,7 +94,7 @@ public class OpenObjectConsoleHandler extends AbstractHandler {
IProject
project
=
ds
!=
null
?
ds
.
getRegistry
().
getProject
()
:
DBWorkbench
.
getPlatform
().
getProjectManager
().
getActiveProject
();
OpenHandler
.
checkProjectIsOpen
(
project
);
IFolder
folder
=
OpenHandler
.
getCurrentScriptFolder
(
currentSelection
);
IFile
scriptFile
=
Resource
Utils
.
createNewScript
(
project
,
folder
,
ds
);
IFile
scriptFile
=
SQLEditor
Utils
.
createNewScript
(
project
,
folder
,
ds
);
//InputStream is = new ByteArrayInputStream(sql.getBytes(GeneralUtils.getDefaultFileEncoding()));
//scriptFile.setContents(is, true, false, new NullProgressMonitor());
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLCompletion.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/PrefPageSQLCompletion.java
浏览文件 @
c5dd5eb6
...
...
@@ -15,17 +15,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.preferences
;
package
org.jkiss.dbeaver.ui.
editors.sql.
preferences
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLPreferenceConstants
;
import
org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages
;
import
org.jkiss.dbeaver.ui.preferences.TargetPrefPage
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
/**
...
...
@@ -33,6 +35,8 @@ import org.jkiss.dbeaver.utils.PrefUtils;
*/
public
class
PrefPageSQLCompletion
extends
TargetPrefPage
{
private
static
final
Log
log
=
Log
.
getLog
(
PrefPageSQLCompletion
.
class
);
public
static
final
String
PAGE_ID
=
"org.jkiss.dbeaver.preferences.main.sql.completion"
;
//$NON-NLS-1$
private
Button
csAutoActivationCheck
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLEditor.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/PrefPageSQLEditor.java
浏览文件 @
c5dd5eb6
此差异已折叠。
点击以展开。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLExecute.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/PrefPageSQLExecute.java
浏览文件 @
c5dd5eb6
此差异已折叠。
点击以展开。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLFormat.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/PrefPageSQLFormat.java
浏览文件 @
c5dd5eb6
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.preferences
;
package
org.jkiss.dbeaver.ui.
editors.sql.
preferences
;
import
org.eclipse.jface.text.source.ISourceViewer
;
import
org.eclipse.swt.SWT
;
...
...
@@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Composite;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.ui.IEditorSite
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
...
...
@@ -45,6 +46,7 @@ import org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages;
import
org.jkiss.dbeaver.ui.editors.sql.registry.SQLFormatterConfigurationRegistry
;
import
org.jkiss.dbeaver.ui.editors.sql.registry.SQLFormatterConfigurator
;
import
org.jkiss.dbeaver.ui.editors.sql.registry.SQLFormatterDescriptor
;
import
org.jkiss.dbeaver.ui.preferences.TargetPrefPage
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
...
...
@@ -59,6 +61,8 @@ import java.util.Locale;
*/
public
class
PrefPageSQLFormat
extends
TargetPrefPage
{
private
static
final
Log
log
=
Log
.
getLog
(
PrefPageSQLFormat
.
class
);
public
static
final
String
PAGE_ID
=
"org.jkiss.dbeaver.preferences.main.sql.format"
;
//$NON-NLS-1$
private
final
static
String
FORMAT_FILE_NAME
=
"format_preview.sql"
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLResources.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/PrefPageSQLResources.java
浏览文件 @
c5dd5eb6
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.preferences
;
package
org.jkiss.dbeaver.ui.
editors.sql.
preferences
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.jface.dialogs.ControlEnableState
;
...
...
@@ -38,6 +38,7 @@ import org.jkiss.dbeaver.ui.editors.sql.SQLEditor;
import
org.jkiss.dbeaver.ui.editors.sql.SQLPreferenceConstants
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLScriptBindingType
;
import
org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages
;
import
org.jkiss.dbeaver.ui.preferences.AbstractPrefPage
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageSQLTemplates.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/PrefPageSQLTemplates.java
浏览文件 @
c5dd5eb6
/*
* 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.ui.preferences
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.ui.IWorkbenchPropertyPage
;
import
org.eclipse.ui.texteditor.templates.TemplatePreferencePage
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.editors.sql.templates.SQLTemplateStore
;
import
org.jkiss.dbeaver.ui.editors.sql.templates.SQLTemplatesRegistry
;
/**
* Templates preference page
*/
public
class
PrefPageSQLTemplates
extends
TemplatePreferencePage
implements
IWorkbenchPropertyPage
{
public
static
final
String
PAGE_ID
=
"org.jkiss.dbeaver.preferences.main.sql.templates"
;
public
PrefPageSQLTemplates
()
{
setPreferenceStore
(
new
PreferenceStoreDelegate
(
DBWorkbench
.
getPlatform
().
getPreferenceStore
()));
setTemplateStore
(
SQLTemplatesRegistry
.
getInstance
().
getTemplateStore
());
setContextTypeRegistry
(
SQLTemplatesRegistry
.
getInstance
().
getTemplateContextRegistry
());
}
protected
String
getFormatterPreferenceKey
()
{
return
SQLTemplateStore
.
PREF_STORE_KEY
;
}
@Override
public
IAdaptable
getElement
()
{
return
null
;
}
@Override
public
void
setElement
(
IAdaptable
element
)
{
}
}
/*
* 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.ui.editors.sql.preferences
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.ui.IWorkbenchPropertyPage
;
import
org.eclipse.ui.texteditor.templates.TemplatePreferencePage
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.editors.sql.templates.SQLTemplateStore
;
import
org.jkiss.dbeaver.ui.editors.sql.templates.SQLTemplatesRegistry
;
import
org.jkiss.dbeaver.ui.preferences.PreferenceStoreDelegate
;
/**
* Templates preference page
*/
public
class
PrefPageSQLTemplates
extends
TemplatePreferencePage
implements
IWorkbenchPropertyPage
{
public
static
final
String
PAGE_ID
=
"org.jkiss.dbeaver.preferences.main.sql.templates"
;
public
PrefPageSQLTemplates
()
{
setPreferenceStore
(
new
PreferenceStoreDelegate
(
DBWorkbench
.
getPlatform
().
getPreferenceStore
()));
setTemplateStore
(
SQLTemplatesRegistry
.
getInstance
().
getTemplateStore
());
setContextTypeRegistry
(
SQLTemplatesRegistry
.
getInstance
().
getTemplateContextRegistry
());
}
protected
String
getFormatterPreferenceKey
()
{
return
SQLTemplateStore
.
PREF_STORE_KEY
;
}
@Override
public
IAdaptable
getElement
()
{
return
null
;
}
@Override
public
void
setElement
(
IAdaptable
element
)
{
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/format_preview.sql
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/
preferences/format_preview.sql
浏览文件 @
c5dd5eb6
文件已移动
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
resource
s/ScriptsHandlerImpl.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/
editors/sql/script
s/ScriptsHandlerImpl.java
浏览文件 @
c5dd5eb6
/*
* 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.ui.resources
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.ui.part.FileEditorInput
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.navigator.DBNResource
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditor
;
import
java.util.Collection
;
import
java.util.Collections
;
/**
* Scripts handler
*/
public
class
ScriptsHandlerImpl
extends
AbstractResourceHandler
{
private
static
final
Log
log
=
Log
.
getLog
(
ScriptsHandlerImpl
.
class
);
@Override
public
int
getFeatures
(
IResource
resource
)
{
if
(
resource
instanceof
IFile
)
{
return
FEATURE_OPEN
|
FEATURE_DELETE
|
FEATURE_RENAME
;
}
return
super
.
getFeatures
(
resource
);
}
@NotNull
@Override
public
String
getTypeName
(
@NotNull
IResource
resource
)
{
if
(
resource
instanceof
IFolder
)
{
return
"script folder"
;
//$NON-NLS-1$
}
else
{
return
"script"
;
//$NON-NLS-1$
}
}
@Override
public
String
getResourceDescription
(
@NotNull
IResource
resource
)
{
return
ResourceUtils
.
getResourceDescription
(
resource
);
}
@NotNull
@Override
public
DBNResource
makeNavigatorNode
(
@NotNull
DBNNode
parentNode
,
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
DBNResource
node
=
super
.
makeNavigatorNode
(
parentNode
,
resource
);
updateNavigatorNode
(
node
,
resource
);
return
node
;
}
@Override
public
void
updateNavigatorNode
(
@NotNull
DBNResource
node
,
@NotNull
IResource
resource
)
{
super
.
updateNavigatorNode
(
node
,
resource
);
if
(
resource
instanceof
IFolder
)
{
if
(
resource
.
getParent
()
instanceof
IProject
)
{
node
.
setResourceImage
(
UIIcon
.
SCRIPTS
);
}
}
else
{
node
.
setResourceImage
(
UIIcon
.
SQL_SCRIPT
);
}
}
@Override
public
void
openResource
(
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
if
(
resource
instanceof
IFile
)
{
FileEditorInput
sqlInput
=
new
FileEditorInput
((
IFile
)
resource
);
UIUtils
.
getActiveWorkbenchWindow
().
getActivePage
().
openEditor
(
sqlInput
,
SQLEditor
.
class
.
getName
());
}
else
{
super
.
openResource
(
resource
);
}
}
@Nullable
@Override
public
Collection
<
DBPDataSourceContainer
>
getAssociatedDataSources
(
IResource
resource
)
{
if
(
resource
instanceof
IFile
)
{
DBPDataSourceContainer
dataSource
=
EditorUtils
.
getFileDataSource
((
IFile
)
resource
);
return
dataSource
==
null
?
null
:
Collections
.
singleton
(
dataSource
);
}
return
null
;
}
@NotNull
@Override
public
String
getResourceNodeName
(
@NotNull
IResource
resource
)
{
// if (resource.getParent() instanceof IProject && resource.equals(getDefaultRoot(resource.getProject()))) {
// return "SQL Scripts";
// } else {
return
super
.
getResourceNodeName
(
resource
);
// }
}
}
/*
* 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.ui.editors.sql.scripts
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.ui.part.FileEditorInput
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.navigator.DBNResource
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditor
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorUtils
;
import
org.jkiss.dbeaver.ui.resources.AbstractResourceHandler
;
import
java.util.Collection
;
import
java.util.Collections
;
/**
* Scripts handler
*/
public
class
ScriptsHandlerImpl
extends
AbstractResourceHandler
{
private
static
final
Log
log
=
Log
.
getLog
(
ScriptsHandlerImpl
.
class
);
@Override
public
int
getFeatures
(
IResource
resource
)
{
if
(
resource
instanceof
IFile
)
{
return
FEATURE_OPEN
|
FEATURE_DELETE
|
FEATURE_RENAME
;
}
return
super
.
getFeatures
(
resource
);
}
@NotNull
@Override
public
String
getTypeName
(
@NotNull
IResource
resource
)
{
if
(
resource
instanceof
IFolder
)
{
return
"script folder"
;
//$NON-NLS-1$
}
else
{
return
"script"
;
//$NON-NLS-1$
}
}
@Override
public
String
getResourceDescription
(
@NotNull
IResource
resource
)
{
return
SQLEditorUtils
.
getResourceDescription
(
resource
);
}
@NotNull
@Override
public
DBNResource
makeNavigatorNode
(
@NotNull
DBNNode
parentNode
,
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
DBNResource
node
=
super
.
makeNavigatorNode
(
parentNode
,
resource
);
updateNavigatorNode
(
node
,
resource
);
return
node
;
}
@Override
public
void
updateNavigatorNode
(
@NotNull
DBNResource
node
,
@NotNull
IResource
resource
)
{
super
.
updateNavigatorNode
(
node
,
resource
);
if
(
resource
instanceof
IFolder
)
{
if
(
resource
.
getParent
()
instanceof
IProject
)
{
node
.
setResourceImage
(
UIIcon
.
SCRIPTS
);
}
}
else
{
node
.
setResourceImage
(
UIIcon
.
SQL_SCRIPT
);
}
}
@Override
public
void
openResource
(
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
if
(
resource
instanceof
IFile
)
{
FileEditorInput
sqlInput
=
new
FileEditorInput
((
IFile
)
resource
);
UIUtils
.
getActiveWorkbenchWindow
().
getActivePage
().
openEditor
(
sqlInput
,
SQLEditor
.
class
.
getName
());
}
else
{
super
.
openResource
(
resource
);
}
}
@Nullable
@Override
public
Collection
<
DBPDataSourceContainer
>
getAssociatedDataSources
(
IResource
resource
)
{
if
(
resource
instanceof
IFile
)
{
DBPDataSourceContainer
dataSource
=
EditorUtils
.
getFileDataSource
((
IFile
)
resource
);
return
dataSource
==
null
?
null
:
Collections
.
singleton
(
dataSource
);
}
return
null
;
}
@NotNull
@Override
public
String
getResourceNodeName
(
@NotNull
IResource
resource
)
{
// if (resource.getParent() instanceof IProject && resource.equals(getDefaultRoot(resource.getProject()))) {
// return "SQL Scripts";
// } else {
return
super
.
getResourceNodeName
(
resource
);
// }
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/preferences/PrefPageDatabaseGeneral.java
浏览文件 @
c5dd5eb6
...
...
@@ -41,6 +41,7 @@ import org.jkiss.dbeaver.registry.language.PlatformLanguageDescriptor;
import
org.jkiss.dbeaver.registry.language.PlatformLanguageRegistry
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.preferences.PrefPageSQLEditor
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.PrefUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/resources/bookmarks/BookmarksHandlerImpl.java
浏览文件 @
c5dd5eb6
...
...
@@ -34,7 +34,6 @@ import org.jkiss.dbeaver.ui.UIUtils;
import
org.jkiss.dbeaver.ui.navigator.NavigatorUtils
;
import
org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectOpen
;
import
org.jkiss.dbeaver.ui.resources.AbstractResourceHandler
;
import
org.jkiss.dbeaver.ui.resources.ResourceUtils
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.utils.ArrayUtils
;
...
...
@@ -192,7 +191,7 @@ public class BookmarksHandlerImpl extends AbstractResourceHandler {
if
(
folder
==
null
)
{
throw
new
DBException
(
"Can't detect folder for bookmark"
);
}
Resource
Utils
.
checkFolderExists
(
folder
);
Content
Utils
.
checkFolderExists
(
folder
);
IFile
file
=
ContentUtils
.
getUniqueFile
(
folder
,
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/navigator/ERDResourceHandler.java
浏览文件 @
c5dd5eb6
...
...
@@ -37,7 +37,6 @@ import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.resources.AbstractResourceHandler
;
import
org.jkiss.dbeaver.ui.resources.ResourceUtils
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -137,7 +136,7 @@ public class ERDResourceHandler extends AbstractResourceHandler {
if
(
folder
==
null
)
{
throw
new
DBException
(
"Can't detect folder for diagram"
);
}
Resource
Utils
.
checkFolderExists
(
folder
,
monitor
);
Content
Utils
.
checkFolderExists
(
folder
,
monitor
);
final
IFile
file
=
ContentUtils
.
getUniqueFile
(
folder
,
CommonUtils
.
escapeFileName
(
title
),
ERD_EXT
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
浏览文件 @
c5dd5eb6
...
...
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.CoreException;
import
org.eclipse.core.runtime.IPath
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.app.DBPPlatform
;
import
org.jkiss.dbeaver.model.data.DBDContent
;
...
...
@@ -30,6 +31,7 @@ import org.jkiss.dbeaver.model.data.DBDContentStorage;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.messages.ModelMessages
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.IOUtils
;
...
...
@@ -465,4 +467,21 @@ public class ContentUtils {
return
file
.
delete
();
}
public
static
void
checkFolderExists
(
IFolder
folder
)
throws
DBException
{
checkFolderExists
(
folder
,
new
VoidProgressMonitor
());
}
public
static
void
checkFolderExists
(
IFolder
folder
,
DBRProgressMonitor
monitor
)
throws
DBException
{
if
(!
folder
.
exists
())
{
try
{
folder
.
create
(
true
,
true
,
monitor
.
getNestedMonitor
());
}
catch
(
CoreException
e
)
{
throw
new
DBException
(
"Can't create folder '"
+
folder
.
getFullPath
()
+
"'"
,
e
);
}
}
}
}
plugins/org.jkiss.dbeaver.ui.navigator/META-INF/MANIFEST.MF
浏览文件 @
c5dd5eb6
...
...
@@ -36,4 +36,5 @@ Export-Package: org.jkiss.dbeaver.ui.controls,
org.jkiss.dbeaver.ui.navigator.dialogs,
org.jkiss.dbeaver.ui.navigator.project,
org.jkiss.dbeaver.ui.preferences,
org.jkiss.dbeaver.ui.resources,
org.jkiss.dbeaver.tools.project
plugins/org.jkiss.dbeaver.
core
/src/org/jkiss/dbeaver/ui/resources/AbstractResourceHandler.java
→
plugins/org.jkiss.dbeaver.
ui.navigator
/src/org/jkiss/dbeaver/ui/resources/AbstractResourceHandler.java
浏览文件 @
c5dd5eb6
/*
* 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.ui.resources
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.CoreException
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.app.DBPResourceHandler
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.navigator.DBNResource
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.NodeEditorInput
;
import
org.jkiss.dbeaver.ui.editors.entity.FolderEditor
;
import
java.util.Collection
;
/**
* Abstract resource handler
*/
public
abstract
class
AbstractResourceHandler
implements
DBPResourceHandler
{
@Override
public
int
getFeatures
(
IResource
resource
)
{
if
(
resource
instanceof
IFolder
)
{
if
(
resource
.
getParent
()
instanceof
IFolder
)
{
return
FEATURE_DELETE
|
FEATURE_MOVE_INTO
|
FEATURE_RENAME
|
FEATURE_CREATE_FOLDER
;
}
return
FEATURE_MOVE_INTO
|
FEATURE_CREATE_FOLDER
;
}
return
0
;
}
@NotNull
@Override
public
DBNResource
makeNavigatorNode
(
@NotNull
DBNNode
parentNode
,
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
return
new
DBNResource
(
parentNode
,
resource
,
this
);
}
@Override
public
void
updateNavigatorNode
(
@NotNull
DBNResource
node
,
@NotNull
IResource
resource
)
{
// Reset icon
node
.
setResourceImage
(
null
);
}
@Override
public
void
openResource
(
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
if
(
resource
instanceof
IFolder
)
{
DBNResource
node
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByResource
(
resource
);
if
(
node
!=
null
)
{
NodeEditorInput
nodeInput
=
new
NodeEditorInput
(
node
);
UIUtils
.
getActiveWorkbenchWindow
().
getActivePage
().
openEditor
(
nodeInput
,
FolderEditor
.
class
.
getName
());
}
}
//throw new DBException("Resource open is not implemented");
}
@NotNull
@Override
public
String
getTypeName
(
@NotNull
IResource
resource
)
{
return
"resource"
;
}
@Override
public
String
getResourceDescription
(
@NotNull
IResource
resource
)
{
return
resource
.
getName
();
}
@Nullable
@Override
public
Collection
<
DBPDataSourceContainer
>
getAssociatedDataSources
(
IResource
resource
)
{
return
null
;
}
@NotNull
@Override
public
String
getResourceNodeName
(
@NotNull
IResource
resource
)
{
return
resource
.
getName
();
}
protected
IFolder
getDefaultRoot
(
IProject
project
)
{
return
DBWorkbench
.
getPlatform
().
getProjectManager
().
getResourceDefaultRoot
(
project
,
getClass
(),
false
);
}
}
/*
* 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.ui.resources
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.CoreException
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.app.DBPResourceHandler
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.navigator.DBNResource
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.NodeEditorInput
;
import
org.jkiss.dbeaver.ui.editors.entity.FolderEditor
;
import
java.util.Collection
;
/**
* Abstract resource handler
*/
public
abstract
class
AbstractResourceHandler
implements
DBPResourceHandler
{
@Override
public
int
getFeatures
(
IResource
resource
)
{
if
(
resource
instanceof
IFolder
)
{
if
(
resource
.
getParent
()
instanceof
IFolder
)
{
return
FEATURE_DELETE
|
FEATURE_MOVE_INTO
|
FEATURE_RENAME
|
FEATURE_CREATE_FOLDER
;
}
return
FEATURE_MOVE_INTO
|
FEATURE_CREATE_FOLDER
;
}
return
0
;
}
@NotNull
@Override
public
DBNResource
makeNavigatorNode
(
@NotNull
DBNNode
parentNode
,
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
return
new
DBNResource
(
parentNode
,
resource
,
this
);
}
@Override
public
void
updateNavigatorNode
(
@NotNull
DBNResource
node
,
@NotNull
IResource
resource
)
{
// Reset icon
node
.
setResourceImage
(
null
);
}
@Override
public
void
openResource
(
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
if
(
resource
instanceof
IFolder
)
{
DBNResource
node
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByResource
(
resource
);
if
(
node
!=
null
)
{
NodeEditorInput
nodeInput
=
new
NodeEditorInput
(
node
);
UIUtils
.
getActiveWorkbenchWindow
().
getActivePage
().
openEditor
(
nodeInput
,
FolderEditor
.
class
.
getName
());
}
}
//throw new DBException("Resource open is not implemented");
}
@NotNull
@Override
public
String
getTypeName
(
@NotNull
IResource
resource
)
{
return
"resource"
;
}
@Override
public
String
getResourceDescription
(
@NotNull
IResource
resource
)
{
return
resource
.
getName
();
}
@Nullable
@Override
public
Collection
<
DBPDataSourceContainer
>
getAssociatedDataSources
(
IResource
resource
)
{
return
null
;
}
@NotNull
@Override
public
String
getResourceNodeName
(
@NotNull
IResource
resource
)
{
return
resource
.
getName
();
}
protected
IFolder
getDefaultRoot
(
IProject
project
)
{
return
DBWorkbench
.
getPlatform
().
getProjectManager
().
getResourceDefaultRoot
(
project
,
getClass
(),
false
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录