Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d63b0345
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,发现更多精彩内容 >>
提交
d63b0345
编写于
12月 02, 2019
作者:
M
Marat Kalibekov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#5986 - Migrate sql server output component to text console viewer
Former-commit-id:
9fd40f7c
上级
78c413cd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
146 addition
and
5 deletion
+146
-5
plugins/org.jkiss.dbeaver.ui.editors.sql/META-INF/MANIFEST.MF
...ins/org.jkiss.dbeaver.ui.editors.sql/META-INF/MANIFEST.MF
+2
-1
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
...s.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
+4
-4
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorOutputConsoleViewer.java
.../dbeaver/ui/editors/sql/SQLEditorOutputConsoleViewer.java
+140
-0
未找到文件。
plugins/org.jkiss.dbeaver.ui.editors.sql/META-INF/MANIFEST.MF
浏览文件 @
d63b0345
...
...
@@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface.text;visibility:=reexport,
org.eclipse.ui.editors;visibility:=reexport,
org.eclipse.ui.ide,
org.eclipse.ui.workbench.texteditor;visibility:=reexport
org.eclipse.ui.workbench.texteditor;visibility:=reexport,
org.eclipse.ui.console
Export-Package: org.jkiss.dbeaver.runtime.sql,
org.jkiss.dbeaver.ui.controls,
org.jkiss.dbeaver.ui.controls.querylog,
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
d63b0345
...
...
@@ -173,7 +173,7 @@ public class SQLEditor extends SQLEditorBase implements
private
CTabItem
activeResultsTab
;
private
SQLLogPanel
logViewer
;
private
SQLEditorOutputViewer
outputViewer
;
private
SQLEditorOutput
Console
Viewer
outputViewer
;
private
volatile
QueryProcessor
curQueryProcessor
;
private
final
List
<
QueryProcessor
>
queryProcessors
=
new
ArrayList
<>();
...
...
@@ -952,7 +952,7 @@ public class SQLEditor extends SQLEditorBase implements
// Extra views
//planView = new ExplainPlanViewer(this, resultTabs);
logViewer
=
new
SQLLogPanel
(
resultTabs
,
this
);
outputViewer
=
new
SQLEditorOutputViewer
(
getSite
(),
resultTabs
,
SWT
.
NONE
);
outputViewer
=
new
SQLEditorOutput
Console
Viewer
(
getSite
(),
resultTabs
,
SWT
.
NONE
);
// Create results tab
createQueryProcessor
(
true
,
true
);
...
...
@@ -1063,7 +1063,7 @@ public class SQLEditor extends SQLEditorBase implements
}
}
if
(
view
==
outputViewer
)
{
if
(
view
==
outputViewer
.
getControl
()
)
{
updateOutputViewerIcon
(
false
);
outputViewer
.
resetNewOutput
();
}
...
...
@@ -1116,7 +1116,7 @@ public class SQLEditor extends SQLEditorBase implements
if
(
resultsSash
.
getMaximizedControl
()
!=
null
)
{
resultsSash
.
setMaximizedControl
(
null
);
}
showExtraView
(
SQLEditorCommands
.
CMD_SQL_SHOW_OUTPUT
,
SQLEditorMessages
.
editors_sql_output
,
SQLEditorMessages
.
editors_sql_output_tip
,
IMG_OUTPUT
,
outputViewer
);
showExtraView
(
SQLEditorCommands
.
CMD_SQL_SHOW_OUTPUT
,
SQLEditorMessages
.
editors_sql_output
,
SQLEditorMessages
.
editors_sql_output_tip
,
IMG_OUTPUT
,
outputViewer
.
getControl
()
);
}
public
void
showExecutionLogPanel
()
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorOutputConsoleViewer.java
0 → 100644
浏览文件 @
d63b0345
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.PrintWriter
;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.MenuManager
;
import
org.eclipse.jface.action.Separator
;
import
org.eclipse.swt.custom.CTabFolder
;
import
org.eclipse.swt.custom.StyledText
;
import
org.eclipse.swt.graphics.Font
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.console.MessageConsole
;
import
org.eclipse.ui.console.TextConsoleViewer
;
import
org.eclipse.ui.themes.ITheme
;
import
org.jkiss.dbeaver.model.sql.SQLConstants
;
import
org.jkiss.dbeaver.ui.controls.StyledTextUtils
;
public
class
SQLEditorOutputConsoleViewer
extends
TextConsoleViewer
{
private
MessageConsole
console
;
private
boolean
hasNewOutput
;
private
SQLEditorOutputConsoleViewer
(
IWorkbenchPartSite
site
,
CTabFolder
resultTabs
,
int
styles
,
MessageConsole
console
)
{
super
(
resultTabs
,
console
);
this
.
console
=
console
;
this
.
getText
().
setMargins
(
5
,
5
,
5
,
5
);
setEditable
(
false
);
createContextMenu
(
site
);
refreshStyles
();
OutputStream
consoleOutputStream
=
console
.
newOutputStream
();
OutputStream
out
=
new
OutputStream
()
{
@Override
public
void
write
(
final
byte
[]
buf
,
final
int
off
,
final
int
len
)
throws
IOException
{
consoleOutputStream
.
write
(
buf
,
off
,
len
);
hasNewOutput
=
true
;
}
@Override
public
void
flush
()
throws
IOException
{
consoleOutputStream
.
flush
();
}
@Override
public
void
close
()
throws
IOException
{
consoleOutputStream
.
flush
();
}
@Override
public
void
write
(
int
b
)
throws
IOException
{
consoleOutputStream
.
write
(
b
);
}
};
writer
=
new
PrintWriter
(
out
,
true
);
}
public
SQLEditorOutputConsoleViewer
(
IWorkbenchPartSite
site
,
CTabFolder
resultTabs
,
int
styles
)
{
this
(
site
,
resultTabs
,
styles
,
new
MessageConsole
(
"sql-output"
,
null
));
}
public
boolean
isDisposed
()
{
return
this
.
getControl
().
isDisposed
();
}
private
PrintWriter
writer
;
public
PrintWriter
getOutputWriter
()
{
return
writer
;
}
public
void
scrollToEnd
()
{
revealEndOfDocument
();
}
public
boolean
isVisible
()
{
return
getControl
().
getVisible
();
}
public
void
resetNewOutput
()
{
hasNewOutput
=
false
;
}
public
void
clearOutput
()
{
console
.
clearConsole
();
}
public
void
refreshStyles
()
{
ITheme
currentTheme
=
PlatformUI
.
getWorkbench
().
getThemeManager
().
getCurrentTheme
();
Font
outputFont
=
currentTheme
.
getFontRegistry
().
get
(
SQLConstants
.
CONFIG_FONT_OUTPUT
);
if
(
outputFont
!=
null
)
{
getTextWidget
().
setFont
(
outputFont
);
}
getTextWidget
().
setForeground
(
currentTheme
.
getColorRegistry
().
get
(
SQLConstants
.
CONFIG_COLOR_TEXT
));
getTextWidget
().
setBackground
(
currentTheme
.
getColorRegistry
().
get
(
SQLConstants
.
CONFIG_COLOR_BACKGROUND
));
}
public
StyledText
getText
()
{
return
getTextWidget
();
}
public
boolean
isHasNewOutput
()
{
return
hasNewOutput
;
}
private
void
createContextMenu
(
IWorkbenchPartSite
site
)
{
MenuManager
menuMgr
=
new
MenuManager
();
menuMgr
.
addMenuListener
(
manager
->
{
StyledTextUtils
.
fillDefaultStyledTextContextMenu
(
manager
,
getTextWidget
());
manager
.
add
(
new
Separator
());
manager
.
add
(
new
Action
(
"Clear"
)
{
@Override
public
void
run
()
{
clearOutput
();
}
});
});
menuMgr
.
setRemoveAllWhenShown
(
true
);
getTextWidget
().
setMenu
(
menuMgr
.
createContextMenu
(
getTextWidget
()));
getTextWidget
().
addDisposeListener
(
e
->
menuMgr
.
dispose
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录