Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
9ce856d8
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,发现更多精彩内容 >>
提交
9ce856d8
编写于
4月 07, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3278 Model refactoring (move to headles bundle). Reconnect notification config.
上级
a0c9fcc5
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
136 addition
and
39 deletion
+136
-39
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+0
-26
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/DataSourceCommitHandler.java
...beaver/ui/actions/datasource/DataSourceCommitHandler.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/DataSourceInvalidateHandler.java
...er/ui/actions/datasource/DataSourceInvalidateHandler.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/DataSourceRollbackHandler.java
...aver/ui/actions/datasource/DataSourceRollbackHandler.java
+1
-3
plugins/org.jkiss.dbeaver.model/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.model/META-INF/MANIFEST.MF
+1
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/DBeaverNotifications.java
...l/src/org/jkiss/dbeaver/runtime/DBeaverNotifications.java
+25
-5
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/jobs/InvalidateJob.java
...del/src/org/jkiss/dbeaver/runtime/jobs/InvalidateJob.java
+21
-3
plugins/org.jkiss.dbeaver.ui/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.ui/META-INF/MANIFEST.MF
+3
-0
plugins/org.jkiss.dbeaver.ui/plugin.xml
plugins/org.jkiss.dbeaver.ui/plugin.xml
+26
-0
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java
....dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java
+57
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
9ce856d8
...
...
@@ -3758,32 +3758,6 @@
</perspective>
</extension>
<!-- Notifications -->
<extension
point=
"org.eclipse.mylyn.commons.notifications.ui.notifications"
>
<category
id=
"org.jkiss.dbeaver.notifications.database.category"
label=
"Database"
/>
<sink
id=
"org.jkiss.dbeaver.notifications.sink.Popup"
class=
"org.jkiss.dbeaver.ui.notifications.DatabaseNotificationSink"
label=
"Notify Popup"
/>
<event
categoryId=
"org.jkiss.dbeaver.notifications.database.category"
id=
"org.jkiss.dbeaver.notifications.event.commit"
label=
"Commit"
>
<defaultHandler
sinkId=
"org.jkiss.dbeaver.notifications.sink.Popup"
/>
<description>
This event is triggered when transaction was committed.
</description>
</event>
<event
categoryId=
"org.jkiss.dbeaver.notifications.database.category"
id=
"org.jkiss.dbeaver.notifications.event.rollback"
label=
"Rollback"
>
<defaultHandler
sinkId=
"org.jkiss.dbeaver.notifications.sink.Popup"
/>
<description>
This event is triggered when transaction was rolled back.
</description>
</event>
<event
categoryId=
"org.jkiss.dbeaver.notifications.database.category"
id=
"org.jkiss.dbeaver.notifications.event.reconnect"
label=
"Reconnect"
>
<defaultHandler
sinkId=
"org.jkiss.dbeaver.notifications.sink.Popup"
/>
<description>
This event is triggered when connection was automatically reconnected.
</description>
</event>
</extension>
<!-- FIXME: Disabled because it breaks dark theme. -->
<!--
<extension point="org.eclipse.e4.ui.css.core.propertyHandler">
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/DataSourceCommitHandler.java
浏览文件 @
9ce856d8
...
...
@@ -24,7 +24,7 @@ import org.jkiss.dbeaver.model.exec.*;
import
org.jkiss.dbeaver.model.qm.QMTransactionState
;
import
org.jkiss.dbeaver.model.qm.QMUtils
;
import
org.jkiss.dbeaver.runtime.TasksJob
;
import
org.jkiss.dbeaver.
ui
.DBeaverNotifications
;
import
org.jkiss.dbeaver.
runtime
.DBeaverNotifications
;
import
org.jkiss.dbeaver.ui.actions.AbstractDataSourceHandler
;
import
org.jkiss.dbeaver.ui.controls.txn.TransactionLogDialog
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/DataSourceInvalidateHandler.java
浏览文件 @
9ce856d8
...
...
@@ -130,7 +130,7 @@ public class DataSourceInvalidateHandler extends AbstractDataSourceHandler
invalidateDataSource
(
dataSource
);
}
}
else
{
log
.
info
(
message
);
log
.
debug
(
message
);
}
}
});
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/DataSourceRollbackHandler.java
浏览文件 @
9ce856d8
...
...
@@ -23,10 +23,8 @@ import org.jkiss.dbeaver.model.DBUtils;
import
org.jkiss.dbeaver.model.exec.*
;
import
org.jkiss.dbeaver.model.qm.QMTransactionState
;
import
org.jkiss.dbeaver.model.qm.QMUtils
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.runtime.TasksJob
;
import
org.jkiss.dbeaver.
ui
.DBeaverNotifications
;
import
org.jkiss.dbeaver.
runtime
.DBeaverNotifications
;
import
org.jkiss.dbeaver.ui.actions.AbstractDataSourceHandler
;
import
org.jkiss.dbeaver.ui.controls.txn.TransactionLogDialog
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
...
...
plugins/org.jkiss.dbeaver.model/META-INF/MANIFEST.MF
浏览文件 @
9ce856d8
...
...
@@ -65,6 +65,7 @@ Export-Package: org.jkiss.dbeaver,
org.jkiss.dbeaver.model.struct,
org.jkiss.dbeaver.model.struct.rdb,
org.jkiss.dbeaver.model.virtual,
org.jkiss.dbeaver.runtime,
org.jkiss.dbeaver.runtime.jobs,
org.jkiss.dbeaver.runtime.net,
org.jkiss.dbeaver.runtime.ui,
...
...
plugins/org.jkiss.dbeaver.
core/src/org/jkiss/dbeaver/ui
/DBeaverNotifications.java
→
plugins/org.jkiss.dbeaver.
model/src/org/jkiss/dbeaver/runtime
/DBeaverNotifications.java
浏览文件 @
9ce856d8
...
...
@@ -15,11 +15,11 @@
* limitations under the License.
*/
package
org.jkiss.dbeaver.
ui
;
package
org.jkiss.dbeaver.
runtime
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPMessageType
;
import
org.jkiss.dbeaver.ui.notifications.NotificationUtils
;
/**
* Notifications utilities
...
...
@@ -31,16 +31,36 @@ public class DBeaverNotifications
public
static
final
String
NT_ROLLBACK
=
"rollback"
;
public
static
final
String
NT_RECONNECT
=
"reconnect"
;
@NotNull
private
static
NotificationHandler
notificationHandler
=
new
ConsoleHandler
();
public
static
void
showNotification
(
DBPDataSource
dataSource
,
String
id
,
String
text
)
{
NotificationUtils
.
send
Notification
(
dataSource
,
id
,
text
,
null
,
null
);
show
Notification
(
dataSource
,
id
,
text
,
null
,
null
);
}
public
static
void
showNotification
(
DBPDataSource
dataSource
,
String
id
,
String
text
,
DBPMessageType
messageType
)
{
NotificationUtils
.
send
Notification
(
dataSource
,
id
,
text
,
messageType
,
null
);
show
Notification
(
dataSource
,
id
,
text
,
messageType
,
null
);
}
public
static
void
showNotification
(
DBPDataSource
dataSource
,
String
id
,
String
text
,
DBPMessageType
messageType
,
Runnable
feedback
)
{
NotificationUtils
.
sendNotification
(
dataSource
,
id
,
text
,
messageType
,
feedback
);
notificationHandler
.
sendNotification
(
dataSource
,
id
,
text
,
messageType
,
feedback
);
}
public
static
void
setHandler
(
@NotNull
NotificationHandler
handler
)
{
notificationHandler
=
handler
;
}
public
interface
NotificationHandler
{
void
sendNotification
(
DBPDataSource
dataSource
,
String
id
,
String
text
,
DBPMessageType
messageType
,
Runnable
feedback
);
}
private
static
class
ConsoleHandler
implements
NotificationHandler
{
@Override
public
void
sendNotification
(
DBPDataSource
dataSource
,
String
id
,
String
text
,
DBPMessageType
messageType
,
Runnable
feedback
)
{
System
.
out
.
println
(
text
);
}
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/jobs/InvalidateJob.java
浏览文件 @
9ce856d8
...
...
@@ -21,10 +21,13 @@ import org.eclipse.core.runtime.Status;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBPMessageType
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.net.DBWNetworkHandler
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.runtime.DBeaverNotifications
;
import
org.jkiss.dbeaver.runtime.ui.DBUserInterface
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -86,7 +89,7 @@ public class InvalidateJob extends DataSourceJob
DBPDataSourceContainer
container
=
dataSource
.
getContainer
();
DBWNetworkHandler
[]
activeHandlers
=
container
.
getActiveNetworkHandlers
();
boolean
networkOK
=
true
;
boolean
hasGoodContexts
=
false
;
int
goodContextsNumber
=
0
;
if
(
activeHandlers
!=
null
&&
activeHandlers
.
length
>
0
)
{
for
(
DBWNetworkHandler
nh
:
activeHandlers
)
{
monitor
.
subTask
(
"Invalidate network ["
+
container
.
getName
()
+
"]"
);
...
...
@@ -108,7 +111,7 @@ public class InvalidateJob extends DataSourceJob
try
{
final
DBCExecutionContext
.
InvalidateResult
result
=
context
.
invalidateContext
(
monitor
,
disconnectOnFailure
);
if
(
result
!=
DBCExecutionContext
.
InvalidateResult
.
ERROR
)
{
hasGoodContexts
=
true
;
goodContextsNumber
++
;
}
invalidateResults
.
add
(
new
ContextInvalidateResult
(
result
,
null
));
}
catch
(
Exception
e
)
{
...
...
@@ -118,7 +121,7 @@ public class InvalidateJob extends DataSourceJob
}
}
}
if
(
!
hasGoodContexts
&&
disconnectOnFailure
)
{
if
(
goodContextsNumber
==
0
&&
disconnectOnFailure
)
{
// Close whole datasource. Target host seems to be unavailable
try
{
container
.
disconnect
(
monitor
);
...
...
@@ -135,6 +138,21 @@ public class InvalidateJob extends DataSourceJob
DBUserInterface
.
getInstance
().
showError
(
"Forced disconnect"
,
"Datasource '"
+
container
.
getName
()
+
"' was disconnected: destination database unreachable.\n"
+
msg
);
}
if
(
goodContextsNumber
==
0
)
{
DBeaverNotifications
.
showNotification
(
dataSource
,
DBeaverNotifications
.
NT_RECONNECT
,
"Datasource invalidate failed"
,
DBPMessageType
.
ERROR
);
}
else
{
DBeaverNotifications
.
showNotification
(
dataSource
,
DBeaverNotifications
.
NT_RECONNECT
,
"Datasource was invalidated\n\n"
+
"Live connection count: "
+
goodContextsNumber
+
"/"
+
dataSource
.
getAllContexts
().
length
,
DBPMessageType
.
INFORMATION
);
}
return
invalidateResults
;
}
...
...
plugins/org.jkiss.dbeaver.ui/META-INF/MANIFEST.MF
浏览文件 @
9ce856d8
...
...
@@ -6,6 +6,8 @@ Bundle-SymbolicName: org.jkiss.dbeaver.ui;singleton:=true
Bundle-Version: 4.2.15
Bundle-Release-Date: 20180416
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: org.jkiss.dbeaver.bundle.UIActivator
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.expressions,
org.eclipse.swt,
...
...
@@ -18,6 +20,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.commons.ui,
org.eclipse.mylyn.commons.notifications.core,
org.eclipse.mylyn.commons.notifications.ui,
org.eclipse.mylyn.commons.workbench,
org.jkiss.dbeaver.model
Export-Package: org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ui.notifications
plugins/org.jkiss.dbeaver.ui/plugin.xml
浏览文件 @
9ce856d8
...
...
@@ -10,4 +10,30 @@
</definition>
</extension>
<!-- Notifications -->
<extension
point=
"org.eclipse.mylyn.commons.notifications.ui.notifications"
>
<category
id=
"org.jkiss.dbeaver.notifications.database.category"
label=
"Database"
/>
<sink
id=
"org.jkiss.dbeaver.notifications.sink.Popup"
class=
"org.jkiss.dbeaver.ui.notifications.DatabaseNotificationSink"
label=
"Notify Popup"
/>
<event
categoryId=
"org.jkiss.dbeaver.notifications.database.category"
id=
"org.jkiss.dbeaver.notifications.event.commit"
label=
"Commit"
>
<defaultHandler
sinkId=
"org.jkiss.dbeaver.notifications.sink.Popup"
/>
<description>
This event is triggered when transaction was committed.
</description>
</event>
<event
categoryId=
"org.jkiss.dbeaver.notifications.database.category"
id=
"org.jkiss.dbeaver.notifications.event.rollback"
label=
"Rollback"
>
<defaultHandler
sinkId=
"org.jkiss.dbeaver.notifications.sink.Popup"
/>
<description>
This event is triggered when transaction was rolled back.
</description>
</event>
<event
categoryId=
"org.jkiss.dbeaver.notifications.database.category"
id=
"org.jkiss.dbeaver.notifications.event.reconnect"
label=
"Reconnect"
>
<defaultHandler
sinkId=
"org.jkiss.dbeaver.notifications.sink.Popup"
/>
<description>
This event is triggered when connection was automatically reconnected.
</description>
</event>
</extension>
</plugin>
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/bundle/UIActivator.java
0 → 100644
浏览文件 @
9ce856d8
/*
* 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.bundle
;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.eclipse.ui.plugin.AbstractUIPlugin
;
import
org.jkiss.dbeaver.runtime.DBeaverNotifications
;
import
org.jkiss.dbeaver.ui.notifications.NotificationUtils
;
import
org.osgi.framework.BundleContext
;
public
class
UIActivator
extends
AbstractUIPlugin
{
// The plug-in ID
public
static
final
String
PLUGIN_ID
=
"org.jkiss.dbeaver.ui"
;
// The shared instance
private
static
UIActivator
plugin
;
public
UIActivator
()
{
}
@Override
public
void
start
(
BundleContext
context
)
throws
Exception
{
super
.
start
(
context
);
// Set notifications handler
DBeaverNotifications
.
setHandler
(
NotificationUtils:
:
sendNotification
);
plugin
=
this
;
}
@Override
public
void
stop
(
BundleContext
context
)
throws
Exception
{
plugin
=
null
;
super
.
stop
(
context
);
}
public
static
UIActivator
getDefault
()
{
return
plugin
;
}
public
static
ImageDescriptor
getImageDescriptor
(
String
path
)
{
return
imageDescriptorFromPlugin
(
PLUGIN_ID
,
path
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录