Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
21863acb
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,发现更多精彩内容 >>
提交
21863acb
编写于
6月 21, 2018
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SQL editor extra presentation model
Former-commit-id:
fcf3636a
上级
9289c228
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
78 addition
and
33 deletion
+78
-33
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
....core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
+53
-33
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorPresentation.java
...g/jkiss/dbeaver/ui/editors/sql/SQLEditorPresentation.java
+25
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
21863acb
...
...
@@ -149,7 +149,9 @@ public class SQLEditor extends SQLEditorBase implements
public
static
final
String
DEFAULT_TITLE_PATTERN
=
"<${"
+
VAR_CONNECTION_NAME
+
"}> ${"
+
VAR_FILE_NAME
+
"}"
;
private
ResultSetOrientation
resultSetOrientation
=
ResultSetOrientation
.
HORIZONTAL
;
private
SashForm
sashForm
;
private
SashForm
resultsSash
;
@Nullable
private
SashForm
presentationSash
;
private
Control
editorControl
;
private
CTabFolder
resultTabs
;
...
...
@@ -171,6 +173,7 @@ public class SQLEditor extends SQLEditorBase implements
private
QueryResultsContainer
curResultsContainer
;
private
Image
editorImage
;
private
ToolBarManager
viewsToolBar
;
private
SQLEditorPresentation
extraPresentation
;
public
SQLEditor
()
{
...
...
@@ -479,16 +482,33 @@ public class SQLEditor extends SQLEditorBase implements
{
setRangeIndicator
(
new
DefaultRangeIndicator
());
sashForm
=
UIUtils
.
createPartDivider
(
// divides editor area and results/panels area
resultsSash
=
UIUtils
.
createPartDivider
(
this
,
parent
,
resultSetOrientation
.
getSashOrientation
()
|
SWT
.
SMOOTH
);
sashForm
.
setSashWidth
(
5
);
UIUtils
.
setHelp
(
sashForm
,
IHelpContextIds
.
CTX_SQL_EDITOR
);
resultsSash
.
setSashWidth
(
5
);
UIUtils
.
setHelp
(
resultsSash
,
IHelpContextIds
.
CTX_SQL_EDITOR
);
SashForm
editorSash
=
resultsSash
;
// divides SQL editor presentations
extraPresentation
=
Adapters
.
adapt
(
this
,
SQLEditorPresentation
.
class
);
if
(
extraPresentation
!=
null
)
{
presentationSash
=
UIUtils
.
createPartDivider
(
this
,
resultsSash
,
((
resultSetOrientation
.
getSashOrientation
()
==
SWT
.
VERTICAL
)
?
SWT
.
HORIZONTAL
:
SWT
.
VERTICAL
)
|
SWT
.
SMOOTH
);
presentationSash
.
setSashWidth
(
5
);
editorSash
=
presentationSash
;
}
super
.
createPartControl
(
sashForm
);
super
.
createPartControl
(
editorSash
);
if
(
extraPresentation
!=
null
)
{
extraPresentation
.
createPresentation
(
editorSash
,
this
);
}
editorControl
=
sashForm
.
getChildren
()[
0
];
editorControl
=
editorSash
.
getChildren
()[
0
];
getSite
().
setSelectionProvider
(
new
DynamicSelectionProvider
());
...
...
@@ -526,7 +546,7 @@ public class SQLEditor extends SQLEditorBase implements
private
void
createResultTabs
()
{
resultTabs
=
new
CTabFolder
(
sashForm
,
SWT
.
TOP
|
SWT
.
FLAT
);
resultTabs
=
new
CTabFolder
(
resultsSash
,
SWT
.
TOP
|
SWT
.
FLAT
);
resultTabs
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
resultTabs
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
...
...
@@ -538,8 +558,8 @@ public class SQLEditor extends SQLEditorBase implements
}
});
this
.
resultTabs
.
addListener
(
SWT
.
Resize
,
event
->
{
if
(!
sashForm
.
isDisposed
())
{
int
[]
weights
=
sashForm
.
getWeights
();
if
(!
resultsSash
.
isDisposed
())
{
int
[]
weights
=
resultsSash
.
getWeights
();
IPreferenceStore
prefs
=
getPreferenceStore
();
if
(
prefs
!=
null
)
{
prefs
.
setValue
(
SQLPreferenceConstants
.
RESULTS_PANEL_RATIO
,
weights
[
0
]
+
"-"
+
weights
[
1
]);
...
...
@@ -550,7 +570,7 @@ public class SQLEditor extends SQLEditorBase implements
if
(!
CommonUtils
.
isEmpty
(
resultsPanelRatio
))
{
String
[]
weights
=
resultsPanelRatio
.
split
(
"-"
);
if
(
weights
.
length
>
1
)
{
sashForm
.
setWeights
(
new
int
[]
{
resultsSash
.
setWeights
(
new
int
[]
{
Integer
.
parseInt
(
weights
[
0
]),
Integer
.
parseInt
(
weights
[
1
]),
});
...
...
@@ -731,40 +751,40 @@ public class SQLEditor extends SQLEditorBase implements
}
public
void
showOutputPanel
()
{
if
(
sashForm
.
getMaximizedControl
()
!=
null
)
{
sashForm
.
setMaximizedControl
(
null
);
if
(
resultsSash
.
getMaximizedControl
()
!=
null
)
{
resultsSash
.
setMaximizedControl
(
null
);
}
showExtraView
(
CoreCommands
.
CMD_SQL_SHOW_OUTPUT
,
CoreMessages
.
editors_sql_output
,
"Database server output log"
,
IMG_OUTPUT
,
outputViewer
);
}
public
void
showExecutionLogPanel
()
{
if
(
sashForm
.
getMaximizedControl
()
!=
null
)
{
sashForm
.
setMaximizedControl
(
null
);
if
(
resultsSash
.
getMaximizedControl
()
!=
null
)
{
resultsSash
.
setMaximizedControl
(
null
);
}
showExtraView
(
CoreCommands
.
CMD_SQL_SHOW_LOG
,
CoreMessages
.
editors_sql_execution_log
,
"SQL query execution log"
,
IMG_LOG
,
logViewer
);
}
public
boolean
hasMaximizedControl
()
{
return
sashForm
.
getMaximizedControl
()
!=
null
;
return
resultsSash
.
getMaximizedControl
()
!=
null
;
}
public
void
toggleResultPanel
()
{
if
(
sashForm
.
getMaximizedControl
()
==
null
)
{
sashForm
.
setMaximizedControl
(
editorControl
);
if
(
resultsSash
.
getMaximizedControl
()
==
null
)
{
resultsSash
.
setMaximizedControl
(
editorControl
);
switchFocus
(
false
);
}
else
{
sashForm
.
setMaximizedControl
(
null
);
resultsSash
.
setMaximizedControl
(
null
);
switchFocus
(
true
);
}
}
public
void
toggleEditorMaximize
()
{
if
(
sashForm
.
getMaximizedControl
()
==
null
)
{
sashForm
.
setMaximizedControl
(
resultTabs
);
if
(
resultsSash
.
getMaximizedControl
()
==
null
)
{
resultsSash
.
setMaximizedControl
(
resultTabs
);
switchFocus
(
true
);
}
else
{
sashForm
.
setMaximizedControl
(
null
);
resultsSash
.
setMaximizedControl
(
null
);
switchFocus
(
false
);
}
}
...
...
@@ -786,7 +806,7 @@ public class SQLEditor extends SQLEditorBase implements
}
public
void
toggleActivePanel
()
{
if
(
sashForm
.
getMaximizedControl
()
==
null
)
{
if
(
resultsSash
.
getMaximizedControl
()
==
null
)
{
if
(
UIUtils
.
hasFocus
(
resultTabs
))
{
switchFocus
(
false
);
}
else
{
...
...
@@ -810,8 +830,8 @@ public class SQLEditor extends SQLEditorBase implements
}
catch
(
IllegalArgumentException
e
)
{
resultSetOrientation
=
ResultSetOrientation
.
HORIZONTAL
;
}
if
(
sashForm
!=
null
)
{
sashForm
.
setOrientation
(
resultSetOrientation
.
getSashOrientation
());
if
(
resultsSash
!=
null
)
{
resultsSash
.
setOrientation
(
resultSetOrientation
.
getSashOrientation
());
}
}
...
...
@@ -1133,8 +1153,8 @@ public class SQLEditor extends SQLEditorBase implements
}
if
(
sashForm
.
getMaximizedControl
()
!=
null
)
{
sashForm
.
setMaximizedControl
(
null
);
if
(
resultsSash
.
getMaximizedControl
()
!=
null
)
{
resultsSash
.
setMaximizedControl
(
null
);
}
// Save editor
...
...
@@ -1233,12 +1253,12 @@ public class SQLEditor extends SQLEditorBase implements
private
void
onDataSourceChange
()
{
if
(
sashForm
==
null
||
sashForm
.
isDisposed
())
{
if
(
resultsSash
==
null
||
resultsSash
.
isDisposed
())
{
reloadSyntaxRules
();
return
;
}
DatabaseEditorUtils
.
setPartBackground
(
this
,
sashForm
);
DatabaseEditorUtils
.
setPartBackground
(
this
,
resultsSash
);
DBCExecutionContext
executionContext
=
getExecutionContext
();
...
...
@@ -1263,9 +1283,9 @@ public class SQLEditor extends SQLEditorBase implements
reloadSyntaxRules
();
if
(
getDataSourceContainer
()
==
null
)
{
sashForm
.
setMaximizedControl
(
editorControl
);
resultsSash
.
setMaximizedControl
(
editorControl
);
}
else
{
sashForm
.
setMaximizedControl
(
null
);
resultsSash
.
setMaximizedControl
(
null
);
}
lastExecutionContext
=
executionContext
;
...
...
@@ -2200,7 +2220,7 @@ public class SQLEditor extends SQLEditorBase implements
return
;
}
if
(
getActivePreferenceStore
().
getBoolean
(
SQLPreferenceConstants
.
MAXIMIZE_EDITOR_ON_SCRIPT_EXECUTE
))
{
sashForm
.
setMaximizedControl
(
editorControl
);
resultsSash
.
setMaximizedControl
(
editorControl
);
}
});
}
finally
{
...
...
@@ -2336,7 +2356,7 @@ public class SQLEditor extends SQLEditorBase implements
// Editor closed
return
;
}
sashForm
.
setMaximizedControl
(
null
);
resultsSash
.
setMaximizedControl
(
null
);
if
(!
hasErrors
)
{
getSelectionProvider
().
setSelection
(
originalSelection
);
}
...
...
@@ -2519,7 +2539,7 @@ public class SQLEditor extends SQLEditorBase implements
@Override
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
if
(!
DBeaverCore
.
isClosing
()
&&
sashForm
!=
null
&&
!
sashForm
.
isDisposed
())
{
if
(!
DBeaverCore
.
isClosing
()
&&
resultsSash
!=
null
&&
!
resultsSash
.
isDisposed
())
{
dumpOutput
(
monitor
);
schedule
(
200
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorPresentation.java
0 → 100644
浏览文件 @
21863acb
/*
* 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
;
import
org.eclipse.swt.widgets.Composite
;
public
interface
SQLEditorPresentation
{
void
createPresentation
(
Composite
parent
,
SQLEditor
editor
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录