Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
cc030581
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,发现更多精彩内容 >>
提交
cc030581
编写于
5月 07, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
QM event browser model
上级
e0a679b1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
25 deletion
+47
-25
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/qm/QMControllerImpl.java
...re/src/org/jkiss/dbeaver/runtime/qm/QMControllerImpl.java
+39
-21
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/querylog/QueryLogViewer.java
...rg/jkiss/dbeaver/ui/controls/querylog/QueryLogViewer.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMController.java
...er.model/src/org/jkiss/dbeaver/model/qm/QMController.java
+3
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMEventBrowser.java
....model/src/org/jkiss/dbeaver/model/qm/QMEventBrowser.java
+3
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMUtils.java
...dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMUtils.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/qm/QMControllerImpl.java
浏览文件 @
cc030581
...
...
@@ -16,8 +16,10 @@
*/
package
org.jkiss.dbeaver.runtime.qm
;
import
org.eclipse.core.runtime.Adapters
;
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.qm.*
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
...
...
@@ -40,6 +42,7 @@ public class QMControllerImpl implements QMController {
private
QMExecutionHandler
defaultHandler
;
private
QMMCollectorImpl
metaHandler
;
private
final
List
<
QMExecutionHandler
>
handlers
=
new
ArrayList
<>();
private
QMEventBrowser
eventBrowser
;
public
QMControllerImpl
()
{
defaultHandler
=
(
QMExecutionHandler
)
Proxy
.
newProxyInstance
(
...
...
@@ -79,6 +82,19 @@ public class QMControllerImpl implements QMController {
return
defaultHandler
;
}
@Override
public
synchronized
QMEventBrowser
getEventBrowser
()
{
if
(
eventBrowser
==
null
)
{
eventBrowser
=
Adapters
.
adapt
(
this
,
QMEventBrowser
.
class
);
if
(
eventBrowser
==
null
)
{
// Default browser
eventBrowser
=
new
DefaultEventBrowser
();
}
}
return
eventBrowser
;
}
@Override
public
void
registerHandler
(
QMExecutionHandler
handler
)
{
synchronized
(
handlers
)
{
...
...
@@ -107,27 +123,6 @@ public class QMControllerImpl implements QMController {
metaHandler
.
removeListener
(
metaListener
);
}
@Override
public
QMEventCursor
getQueryHistoryCursor
(
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
String
containerId
,
@Nullable
String
sessionId
,
@Nullable
String
searchString
)
{
if
(
CommonUtils
.
isEmpty
(
searchString
))
{
return
new
QMUtils
.
ListCursorImpl
(
metaHandler
.
getPastEvents
());
}
else
{
searchString
=
searchString
.
toLowerCase
();
List
<
QMMetaEvent
>
filtered
=
new
ArrayList
<>();
for
(
QMMetaEvent
event
:
metaHandler
.
getPastEvents
())
{
if
(
event
.
getObject
().
getText
().
toLowerCase
().
contains
(
searchString
))
{
filtered
.
add
(
event
);
}
}
return
new
QMUtils
.
ListCursorImpl
(
filtered
);
}
}
List
<
QMExecutionHandler
>
getHandlers
()
{
synchronized
(
handlers
)
{
...
...
@@ -169,4 +164,27 @@ public class QMControllerImpl implements QMController {
}
private
class
DefaultEventBrowser
implements
QMEventBrowser
{
@Override
public
QMEventCursor
getQueryHistoryCursor
(
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
String
containerId
,
@Nullable
String
sessionId
,
@Nullable
String
searchString
)
throws
DBException
{
if
(
CommonUtils
.
isEmpty
(
searchString
))
{
return
new
QMUtils
.
ListCursorImpl
(
metaHandler
.
getPastEvents
());
}
else
{
searchString
=
searchString
.
toLowerCase
();
List
<
QMMetaEvent
>
filtered
=
new
ArrayList
<>();
for
(
QMMetaEvent
event
:
metaHandler
.
getPastEvents
())
{
if
(
event
.
getObject
().
getText
().
toLowerCase
().
contains
(
searchString
))
{
filtered
.
add
(
event
);
}
}
return
new
QMUtils
.
ListCursorImpl
(
filtered
);
}
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/querylog/QueryLogViewer.java
浏览文件 @
cc030581
...
...
@@ -164,7 +164,7 @@ public class QueryLogViewer extends Viewer implements QMMetaListener, DBPPrefere
return
CoreMessages
.
controls_querylog_rollback
;
}
}
else
if
(
object
instanceof
QMMSessionInfo
)
{
String
containerName
=
((
QMMSessionInfo
)
object
).
getContainerName
()
+
" <"
+
((
QMMSessionInfo
)
object
).
getContextName
()
+
">"
;
String
containerName
=
((
QMMSessionInfo
)
object
).
getContainerName
();
switch
(
event
.
getAction
())
{
case
BEGIN:
return
CoreMessages
.
controls_querylog_connected_to
+
containerName
+
"\""
;
case
END:
return
CoreMessages
.
controls_querylog_disconnected_from
+
containerName
+
"\""
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMController.java
浏览文件 @
cc030581
...
...
@@ -20,12 +20,14 @@ package org.jkiss.dbeaver.model.qm;
/**
* Query manager controller
*/
public
interface
QMController
extends
QMEventBrowser
{
public
interface
QMController
{
QMMCollector
getMetaCollector
();
QMExecutionHandler
getDefaultHandler
();
QMEventBrowser
getEventBrowser
();
void
registerHandler
(
QMExecutionHandler
handler
);
void
unregisterHandler
(
QMExecutionHandler
handler
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMEventBrowser.java
浏览文件 @
cc030581
...
...
@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.model.qm;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
/**
...
...
@@ -30,6 +31,7 @@ public interface QMEventBrowser {
@NotNull
DBRProgressMonitor
monitor
,
@Nullable
String
containerId
,
@Nullable
String
sessionId
,
@Nullable
String
searchString
);
@Nullable
String
searchString
)
throws
DBException
;
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMUtils.java
浏览文件 @
cc030581
...
...
@@ -71,7 +71,7 @@ public class QMUtils {
if
(
application
==
null
)
{
return
null
;
}
return
application
.
getQueryManager
();
return
application
.
getQueryManager
()
.
getEventBrowser
()
;
}
public
static
boolean
isTransactionActive
(
DBCExecutionContext
executionContext
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录