Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
3250bf70
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,发现更多精彩内容 >>
提交
3250bf70
编写于
6月 30, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Nested SQL editor refactoring
Former-commit-id:
ef1861c6
上级
0e36d114
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
35 addition
and
35 deletion
+35
-35
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorNested.java
...src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorNested.java
+14
-10
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLSourceViewer.java
...src/org/jkiss/dbeaver/ui/editors/sql/SQLSourceViewer.java
+10
-7
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/editors/DB2RoutineDDLEditor.java
...rg/jkiss/dbeaver/ext/db2/editors/DB2RoutineDDLEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/editors/ExasolSourceViewEditor.java
...ss/dbeaver/ext/exasol/editors/ExasolSourceViewEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/editors/MySQLPackageBodyEditor.java
...iss/dbeaver/ext/mysql/editors/MySQLPackageBodyEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/editors/MySQLSourceViewEditor.java
...kiss/dbeaver/ext/mysql/editors/MySQLSourceViewEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/OracleObjectDDLEditor.java
...iss/dbeaver/ext/oracle/editors/OracleObjectDDLEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/OracleSourceDeclarationEditor.java
...ver/ext/oracle/editors/OracleSourceDeclarationEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/OracleSourceDefinitionEditor.java
...aver/ext/oracle/editors/OracleSourceDefinitionEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/SchedulerJobActionEditor.java
.../dbeaver/ext/oracle/editors/SchedulerJobActionEditor.java
+1
-1
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java
...er/ext/postgresql/ui/editors/PostgreSourceViewEditor.java
+3
-10
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorNested.java
浏览文件 @
3250bf70
...
...
@@ -39,6 +39,7 @@ import org.eclipse.swt.events.FocusEvent;
import
org.eclipse.swt.events.FocusListener
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.ui.IEditorInput
;
import
org.eclipse.ui.IEditorSite
;
import
org.eclipse.ui.part.MultiPageEditorSite
;
import
org.eclipse.ui.texteditor.IDocumentProvider
;
...
...
@@ -49,6 +50,7 @@ import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import
org.jkiss.dbeaver.model.exec.compile.DBCCompileLog
;
import
org.jkiss.dbeaver.model.exec.compile.DBCSourceHost
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabaseNode
;
import
org.jkiss.dbeaver.model.preferences.DBPPropertySource
;
import
org.jkiss.dbeaver.model.runtime.AbstractJob
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
...
...
@@ -84,28 +86,31 @@ public abstract class SQLEditorNested<T extends DBSObject>
//setHasVerticalRuler(false);
}
@Override
public
IDatabaseEditorInput
getEditorInput
()
{
public
IDatabaseEditorInput
getDatabaseEditorInput
()
{
return
(
IDatabaseEditorInput
)
super
.
getEditorInput
();
}
@Override
public
T
getSourceObject
()
{
I
Database
EditorInput
editorInput
=
getEditorInput
();
if
(
editorInput
==
null
)
{
IEditorInput
editorInput
=
getEditorInput
();
if
(
!(
editorInput
instanceof
IDatabaseEditorInput
)
)
{
return
null
;
}
return
(
T
)
editorInput
.
getDatabaseObject
();
return
(
T
)
((
IDatabaseEditorInput
)
editorInput
)
.
getDatabaseObject
();
}
@Override
public
DBCExecutionContext
getExecutionContext
()
{
I
Database
EditorInput
editorInput
=
getEditorInput
();
if
(
editorInput
==
null
)
{
IEditorInput
editorInput
=
getEditorInput
();
if
(
!(
editorInput
instanceof
IDatabaseEditorInput
)
)
{
return
null
;
}
return
editorInput
.
getExecutionContext
();
return
((
IDatabaseEditorInput
)
editorInput
).
getExecutionContext
();
}
public
DBPPropertySource
getInputPropertySource
()
{
return
getDatabaseEditorInput
().
getPropertySource
();
}
@Override
...
...
@@ -273,8 +278,7 @@ public abstract class SQLEditorNested<T extends DBSObject>
@Override
protected
IAnnotationModel
createAnnotationModel
(
Object
element
)
throws
CoreException
{
IDatabaseEditorInput
editorInput
=
SQLEditorNested
.
this
.
getEditorInput
();
DBSObject
databaseObject
=
editorInput
.
getDatabaseObject
();
DBSObject
databaseObject
=
getSourceObject
();
DBNDatabaseNode
node
=
DBeaverCore
.
getInstance
().
getNavigatorModel
().
getNodeByObject
(
databaseObject
);
IResource
resource
=
DBeaverIDECore
.
resolveWorkspaceResource
(
databaseObject
);
if
(
resource
!=
null
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLSourceViewer.java
浏览文件 @
3250bf70
...
...
@@ -18,6 +18,7 @@
package
org.jkiss.dbeaver.ui.editors.sql
;
import
org.eclipse.jface.action.*
;
import
org.eclipse.ui.IEditorInput
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPScriptObject
;
...
...
@@ -59,14 +60,16 @@ public class SQLSourceViewer<T extends DBPScriptObject & DBSObject> extends SQLE
}
protected
Map
<
String
,
Object
>
getSourceOptions
()
{
IDatabaseEditorInput
editorInput
=
getEditorInput
();
Collection
<
String
>
attributeNames
=
editorInput
.
getAttributeNames
();
IEditorInput
editorInput
=
getEditorInput
();
Map
<
String
,
Object
>
options
=
new
HashMap
<>();
options
.
put
(
DBPScriptObject
.
OPTION_DDL_SOURCE
,
true
);
if
(!
attributeNames
.
isEmpty
())
{
for
(
String
name
:
attributeNames
)
{
Object
attribute
=
editorInput
.
getAttribute
(
name
);
options
.
put
(
name
,
attribute
);
if
(
editorInput
instanceof
IDatabaseEditorInput
)
{
Collection
<
String
>
attributeNames
=
((
IDatabaseEditorInput
)
editorInput
).
getAttributeNames
();
options
.
put
(
DBPScriptObject
.
OPTION_DDL_SOURCE
,
true
);
if
(!
attributeNames
.
isEmpty
())
{
for
(
String
name
:
attributeNames
)
{
Object
attribute
=
((
IDatabaseEditorInput
)
editorInput
).
getAttribute
(
name
);
options
.
put
(
name
,
attribute
);
}
}
}
return
options
;
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/editors/DB2RoutineDDLEditor.java
浏览文件 @
3250bf70
...
...
@@ -68,7 +68,7 @@ public class DB2RoutineDDLEditor extends SQLSourceViewer<DB2Routine> {
{
for
(
DB2DDLFormat
format
:
DB2DDLFormat
.
values
())
{
if
(
format
.
ordinal
()
==
ddlFormatCombo
.
getSelectionIndex
())
{
get
EditorInput
().
getDatabas
eObject
().
getDataSource
().
getContainer
().
getPreferenceStore
()
get
Sourc
eObject
().
getDataSource
().
getContainer
().
getPreferenceStore
()
.
setValue
(
DB2Constants
.
PREF_KEY_DDL_FORMAT
,
format
.
name
());
refreshPart
(
this
,
true
);
break
;
...
...
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/editors/ExasolSourceViewEditor.java
浏览文件 @
3250bf70
...
...
@@ -34,7 +34,7 @@ public class ExasolSourceViewEditor extends SQLSourceViewer<ExasolSourceObject>
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
monitor
,
"objectDefinitionText"
,
sourceText
);
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
"objectDefinitionText"
,
sourceText
);
}
}
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/editors/MySQLPackageBodyEditor.java
浏览文件 @
3250bf70
...
...
@@ -45,7 +45,7 @@ public class MySQLPackageBodyEditor extends SQLSourceViewer<MySQLSourceObject> {
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
"extendedDefinitionText"
,
sourceText
);
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/editors/MySQLSourceViewEditor.java
浏览文件 @
3250bf70
...
...
@@ -39,7 +39,7 @@ public class MySQLSourceViewEditor extends SQLSourceViewer<MySQLSourceObject> {
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
monitor
,
"objectDefinitionText"
,
sourceText
);
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
"objectDefinitionText"
,
sourceText
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/OracleObjectDDLEditor.java
浏览文件 @
3250bf70
...
...
@@ -63,7 +63,7 @@ public class OracleObjectDDLEditor extends SQLSourceViewer<OracleTable> {
public
void
widgetSelected
(
SelectionEvent
e
)
{
for
(
OracleDDLFormat
format
:
OracleDDLFormat
.
values
())
{
if
(
format
.
ordinal
()
==
ddlFormatCombo
.
getSelectionIndex
())
{
get
EditorInput
().
getDatabas
eObject
().
getDataSource
().
getContainer
().
getPreferenceStore
().
setValue
(
get
Sourc
eObject
().
getDataSource
().
getContainer
().
getPreferenceStore
().
setValue
(
OracleConstants
.
PREF_KEY_DDL_FORMAT
,
format
.
name
());
refreshPart
(
this
,
true
);
break
;
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/OracleSourceDeclarationEditor.java
浏览文件 @
3250bf70
...
...
@@ -34,7 +34,7 @@ public class OracleSourceDeclarationEditor extends SQLSourceViewer<OracleSourceO
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
OracleConstants
.
PROP_OBJECT_DEFINITION
,
sourceText
);
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/OracleSourceDefinitionEditor.java
浏览文件 @
3250bf70
...
...
@@ -42,7 +42,7 @@ public class OracleSourceDefinitionEditor extends SQLSourceViewer<OracleSourceOb
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
OracleConstants
.
PROP_OBJECT_BODY_DEFINITION
,
sourceText
);
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/editors/SchedulerJobActionEditor.java
浏览文件 @
3250bf70
...
...
@@ -44,7 +44,7 @@ public class SchedulerJobActionEditor extends SQLSourceViewer<OracleSchedulerJob
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
OracleConstants
.
PROP_OBJECT_BODY_DEFINITION
,
sourceText
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java
浏览文件 @
3250bf70
...
...
@@ -18,14 +18,8 @@
package
org.jkiss.dbeaver.ext.postgresql.ui.editors
;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.ControlContribution
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.eclipse.jface.action.Separator
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreConstants
;
import
org.jkiss.dbeaver.ext.postgresql.model.*
;
import
org.jkiss.dbeaver.model.DBIcon
;
...
...
@@ -33,7 +27,6 @@ import org.jkiss.dbeaver.model.DBPScriptObject;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.ui.ActionUtils
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLSourceViewer
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -74,7 +67,7 @@ public class PostgreSourceViewEditor extends SQLSourceViewer<PostgreScriptObject
@Override
protected
void
setSourceText
(
DBRProgressMonitor
monitor
,
String
sourceText
)
{
get
EditorInput
().
ge
tPropertySource
().
setPropertyValue
(
monitor
,
"objectDefinitionText"
,
sourceText
);
get
Inpu
tPropertySource
().
setPropertyValue
(
monitor
,
"objectDefinitionText"
,
sourceText
);
}
@Override
...
...
@@ -93,7 +86,7 @@ public class PostgreSourceViewEditor extends SQLSourceViewer<PostgreScriptObject
}
@Override
public
void
run
()
{
getEditorInput
().
setAttribute
(
DBPScriptObject
.
OPTION_DEBUGGER_SOURCE
,
!
isChecked
());
get
Database
EditorInput
().
setAttribute
(
DBPScriptObject
.
OPTION_DEBUGGER_SOURCE
,
!
isChecked
());
refreshPart
(
PostgreSourceViewEditor
.
this
,
true
);
}
},
true
));
...
...
@@ -142,7 +135,7 @@ public class PostgreSourceViewEditor extends SQLSourceViewer<PostgreScriptObject
private
boolean
isInDebugMode
()
{
return
CommonUtils
.
getBoolean
(
get
EditorInput
().
getAttribute
(
DBPScriptObject
.
OPTION_DEBUGGER_SOURCE
),
false
);
getDatabase
EditorInput
().
getAttribute
(
DBPScriptObject
.
OPTION_DEBUGGER_SOURCE
),
false
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录