Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
26b08ebd
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,发现更多精彩内容 >>
提交
26b08ebd
编写于
9月 21, 2020
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/devel' into devel
上级
43e8ccec
cb4ba5aa
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
646 addition
and
112 deletion
+646
-112
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/UIServiceConnectionsImpl.java
...eaver/ui/actions/datasource/UIServiceConnectionsImpl.java
+7
-6
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/ConnectionPageSettings.java
...dbeaver/ui/dialogs/connection/ConnectionPageSettings.java
+11
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/ConnectionWizard.java
...jkiss/dbeaver/ui/dialogs/connection/ConnectionWizard.java
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/EditConnectionDialog.java
...s/dbeaver/ui/dialogs/connection/EditConnectionDialog.java
+15
-3
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/ManageCRSDialog.java
...w/src/org/jkiss/dbeaver/ui/gis/panel/ManageCRSDialog.java
+2
-3
plugins/org.jkiss.dbeaver.ext.postgresql.ui/src/org/jkiss/dbeaver/ext/postgresql/ui/PostgreSSLConfigurator.java
...iss/dbeaver/ext/postgresql/ui/PostgreSSLConfigurator.java
+30
-25
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNProjectDatabases.java
...rg/jkiss/dbeaver/model/navigator/DBNProjectDatabases.java
+6
-4
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/ui/UIServiceConnections.java
...rc/org/jkiss/dbeaver/runtime/ui/UIServiceConnections.java
+7
-5
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
...eaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
+5
-0
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/view/DatabaseTasksTree.java
...rc/org/jkiss/dbeaver/tasks/ui/view/DatabaseTasksTree.java
+4
-6
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/view/DatabaseTasksView.java
...rc/org/jkiss/dbeaver/tasks/ui/view/DatabaseTasksView.java
+2
-4
plugins/org.jkiss.dbeaver.ui.app.standalone/META-INF/MANIFEST.MF
.../org.jkiss.dbeaver.ui.app.standalone/META-INF/MANIFEST.MF
+2
-1
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardDatabaseSelectDialog.java
...aver/ui/dashboard/view/DashboardDatabaseSelectDialog.java
+2
-2
plugins/org.jkiss.dbeaver.ui.editors.data/META-INF/MANIFEST.MF
...ns/org.jkiss.dbeaver.ui.editors.data/META-INF/MANIFEST.MF
+1
-0
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/registry/StreamValueManagerDescriptor.java
...beaver/ui/data/registry/StreamValueManagerDescriptor.java
+16
-2
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/registry/ValueManagerRegistry.java
.../jkiss/dbeaver/ui/data/registry/ValueManagerRegistry.java
+6
-0
plugins/org.jkiss.dbeaver.ui.editors.json/src/org/jkiss/dbeaver/ui/data/managers/stream/JSONPanelEditor.java
...kiss/dbeaver/ui/data/managers/stream/JSONPanelEditor.java
+16
-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
+1
-0
plugins/org.jkiss.dbeaver.ui.editors.xml/src/org/jkiss/dbeaver/ui/data/managers/stream/XMLPanelEditor.java
...jkiss/dbeaver/ui/data/managers/stream/XMLPanelEditor.java
+16
-1
plugins/org.jkiss.dbeaver.ui.navigator/OSGI-INF/l10n/bundle.properties
...kiss.dbeaver.ui.navigator/OSGI-INF/l10n/bundle.properties
+4
-0
plugins/org.jkiss.dbeaver.ui.navigator/plugin.xml
plugins/org.jkiss.dbeaver.ui.navigator/plugin.xml
+24
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/INavigatorItemRenderer.java
...rg/jkiss/dbeaver/ui/navigator/INavigatorItemRenderer.java
+2
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/INavigatorNodeActionHandler.java
...iss/dbeaver/ui/navigator/INavigatorNodeActionHandler.java
+1
-1
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorCommands.java
...src/org/jkiss/dbeaver/ui/navigator/NavigatorCommands.java
+2
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerConnectionFilter.java
...i/navigator/actions/NavigatorHandlerConnectionFilter.java
+71
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerFilterObjectType.java
...i/navigator/actions/NavigatorHandlerFilterObjectType.java
+99
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerObjectOpen.java
...aver/ui/navigator/actions/NavigatorHandlerObjectOpen.java
+1
-2
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/node/NNAHDataSourceConfiguration.java
...i/navigator/actions/node/NNAHDataSourceConfiguration.java
+1
-1
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/node/NNAHDataSourceReadOnly.java
...ver/ui/navigator/actions/node/NNAHDataSourceReadOnly.java
+1
-1
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/node/NNAHDataSourceTunnel.java
...eaver/ui/navigator/actions/node/NNAHDataSourceTunnel.java
+13
-2
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DatabaseNavigatorTree.java
.../dbeaver/ui/navigator/database/DatabaseNavigatorTree.java
+111
-12
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DatabaseNavigatorTreeFilter.java
...er/ui/navigator/database/DatabaseNavigatorTreeFilter.java
+33
-14
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DatabaseNavigatorTreeFilterObjectType.java
...gator/database/DatabaseNavigatorTreeFilterObjectType.java
+23
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DefaultNavigatorNodeRenderer.java
...r/ui/navigator/database/DefaultNavigatorNodeRenderer.java
+5
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/NavigatorViewBase.java
...kiss/dbeaver/ui/navigator/database/NavigatorViewBase.java
+1
-1
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/StatisticsNavigatorNodeRenderer.java
...i/navigator/database/StatisticsNavigatorNodeRenderer.java
+29
-1
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ICompositeDialogPageContainer.java
...c/org/jkiss/dbeaver/ui/ICompositeDialogPageContainer.java
+29
-0
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/dialogs/DialogUtils.java
...aver.ui/src/org/jkiss/dbeaver/ui/dialogs/DialogUtils.java
+19
-0
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/dialogs/MultiPageWizardDialog.java
...c/org/jkiss/dbeaver/ui/dialogs/MultiPageWizardDialog.java
+27
-13
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/actions/datasource/UIServiceConnectionsImpl.java
浏览文件 @
26b08ebd
...
...
@@ -17,6 +17,7 @@
package
org.jkiss.dbeaver.ui.actions.datasource
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
...
...
@@ -35,27 +36,27 @@ public class UIServiceConnectionsImpl implements DBServiceConnections, UIService
private
static
final
Log
log
=
Log
.
getLog
(
UIServiceConnectionsImpl
.
class
);
@Override
public
void
openConnectionEditor
(
DBPDataSourceContainer
dataSourceContainer
)
{
EditConnectionDialog
.
openEditConnectionDialog
(
UIUtils
.
getActiveWorkbenchWindow
(),
dataSourceContainer
);
public
void
openConnectionEditor
(
@NotNull
DBPDataSourceContainer
dataSourceContainer
,
String
defaultPageName
)
{
EditConnectionDialog
.
openEditConnectionDialog
(
UIUtils
.
getActiveWorkbenchWindow
(),
dataSourceContainer
,
defaultPageName
);
}
@Override
public
void
connectDataSource
(
DBPDataSourceContainer
dataSourceContainer
,
DBRProgressListener
onFinish
)
{
public
void
connectDataSource
(
@NotNull
DBPDataSourceContainer
dataSourceContainer
,
DBRProgressListener
onFinish
)
{
DataSourceHandler
.
connectToDataSource
(
null
,
dataSourceContainer
,
onFinish
);
}
@Override
public
void
disconnectDataSource
(
DBPDataSourceContainer
dataSourceContainer
)
{
public
void
disconnectDataSource
(
@NotNull
DBPDataSourceContainer
dataSourceContainer
)
{
DataSourceHandler
.
disconnectDataSource
(
dataSourceContainer
,
null
);
}
@Override
public
void
closeActiveTransaction
(
DBRProgressMonitor
monitor
,
DBCExecutionContext
context
,
boolean
commitTxn
)
{
public
void
closeActiveTransaction
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBCExecutionContext
context
,
boolean
commitTxn
)
{
DataSourceHandler
.
closeActiveTransaction
(
monitor
,
context
,
commitTxn
);
}
@Override
public
boolean
checkAndCloseActiveTransaction
(
DBCExecutionContext
[]
contexts
)
{
public
boolean
checkAndCloseActiveTransaction
(
@NotNull
DBCExecutionContext
[]
contexts
)
{
return
DataSourceHandler
.
checkAndCloseActiveTransaction
(
contexts
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/ConnectionPageSettings.java
浏览文件 @
26b08ebd
...
...
@@ -56,7 +56,7 @@ import java.util.*;
/**
* Settings connection page. Hosts particular drivers' connection pages
*/
class
ConnectionPageSettings
extends
ActiveWizardPage
<
ConnectionWizard
>
implements
IDataSourceConnectionEditorSite
,
ICompositeDialogPage
,
IDataSourceConnectionTester
{
class
ConnectionPageSettings
extends
ActiveWizardPage
<
ConnectionWizard
>
implements
IDataSourceConnectionEditorSite
,
ICompositeDialogPage
,
I
CompositeDialogPageContainer
,
I
DataSourceConnectionTester
{
private
static
final
Log
log
=
Log
.
getLog
(
DriverDescriptor
.
class
);
public
static
final
String
PAGE_NAME
=
ConnectionPageSettings
.
class
.
getSimpleName
();
...
...
@@ -410,4 +410,14 @@ class ConnectionPageSettings extends ActiveWizardPage<ConnectionWizard> implemen
public
String
toString
()
{
return
getName
();
}
@Override
public
void
showSubPage
(
IDialogPage
subPage
)
{
for
(
TabItem
pageTab
:
tabFolder
.
getItems
())
{
if
(
pageTab
.
getData
()
==
subPage
)
{
tabFolder
.
setSelection
(
pageTab
);
break
;
}
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/ConnectionWizard.java
浏览文件 @
26b08ebd
...
...
@@ -235,6 +235,7 @@ public abstract class ConnectionWizard extends ActiveWizard implements INewWizar
final
IWizardPage
page
=
getPage
(
pageId
);
if
(
page
!=
null
)
{
getContainer
().
showPage
(
page
);
return
true
;
}
return
false
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/connection/EditConnectionDialog.java
浏览文件 @
26b08ebd
...
...
@@ -50,6 +50,7 @@ public class EditConnectionDialog extends MultiPageWizardDialog {
private
static
String
lastActivePage
;
private
Button
testButton
;
private
String
defaultPageName
;
private
EditConnectionDialog
(
IWorkbenchWindow
window
,
ConnectionWizard
wizard
)
{
super
(
window
,
wizard
);
...
...
@@ -74,8 +75,15 @@ public class EditConnectionDialog extends MultiPageWizardDialog {
protected
Control
createContents
(
Composite
parent
)
{
Control
contents
=
super
.
createContents
(
parent
);
if
(!
CommonUtils
.
isEmpty
(
lastActivePage
))
{
getWizard
().
openSettingsPage
(
lastActivePage
);
String
activePage
=
defaultPageName
;
if
(
CommonUtils
.
isEmpty
(
activePage
))
{
activePage
=
lastActivePage
;
}
if
(!
CommonUtils
.
isEmpty
(
activePage
))
{
String
finalActivePage
=
activePage
;
UIUtils
.
asyncExec
(()
->
{
getWizard
().
openSettingsPage
(
finalActivePage
);
});
}
return
contents
;
...
...
@@ -132,15 +140,19 @@ public class EditConnectionDialog extends MultiPageWizardDialog {
getWizard
().
testConnection
();
}
public
static
boolean
openEditConnectionDialog
(
IWorkbenchWindow
window
,
DBPDataSourceContainer
dataSource
)
{
public
static
boolean
openEditConnectionDialog
(
IWorkbenchWindow
window
,
DBPDataSourceContainer
dataSource
,
String
defaultPageName
)
{
EditConnectionDialog
dialog
=
openDialogs
.
get
(
dataSource
);
if
(
dialog
!=
null
)
{
if
(
defaultPageName
!=
null
)
{
dialog
.
showPage
(
defaultPageName
);
}
dialog
.
getShell
().
forceActive
();
return
true
;
}
EditConnectionWizard
wizard
=
new
EditConnectionWizard
((
DataSourceDescriptor
)
dataSource
);
dialog
=
new
EditConnectionDialog
(
window
,
wizard
);
dialog
.
defaultPageName
=
defaultPageName
;
openDialogs
.
put
(
dataSource
,
dialog
);
try
{
return
dialog
.
open
()
==
IDialogConstants
.
OK_ID
;
...
...
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/ManageCRSDialog.java
浏览文件 @
26b08ebd
...
...
@@ -28,7 +28,6 @@ import org.eclipse.swt.widgets.Composite;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.ui.dialogs.FilteredTree
;
import
org.eclipse.ui.dialogs.PatternFilter
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.gis.GisConstants
;
...
...
@@ -37,6 +36,7 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.BaseDialog
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.ui.gis.internal.GISMessages
;
import
org.jkiss.dbeaver.ui.internal.UIActivator
;
...
...
@@ -101,8 +101,7 @@ public class ManageCRSDialog extends BaseDialog {
return
super
.
isLeafMatch
(
viewer
,
element
);
}
};
FilteredTree
filteredTree
=
new
FilteredTree
(
dialogArea
,
SWT
.
BORDER
|
SWT
.
FULL_SELECTION
,
patternFilter
,
true
);
TreeViewer
treeViewer
=
filteredTree
.
getViewer
();
TreeViewer
treeViewer
=
DialogUtils
.
createFilteredTree
(
dialogArea
,
SWT
.
BORDER
|
SWT
.
FULL_SELECTION
,
patternFilter
,
null
);
Tree
crsTree
=
treeViewer
.
getTree
();
crsTree
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
crsTree
.
setHeaderVisible
(
true
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.ui/src/org/jkiss/dbeaver/ext/postgresql/ui/PostgreSSLConfigurator.java
浏览文件 @
26b08ebd
...
...
@@ -56,6 +56,7 @@ public class PostgreSSLConfigurator extends SSLConfiguratorAbstractUI
private
Combo
sslModeCombo
;
private
Combo
sslFactoryCombo
;
private
Button
useProxyService
;
private
boolean
sslClassesResolved
;
@Override
public
void
createControl
(
Composite
parent
,
Runnable
propertyChangeListener
)
{
...
...
@@ -117,31 +118,35 @@ public class PostgreSSLConfigurator extends SSLConfiguratorAbstractUI
useProxyService
.
setSelection
(
configuration
.
getBooleanProperty
(
PostgreConstants
.
PROP_SSL_PROXY
));
}
final
Job
resolveJob
=
new
Job
(
"Find factories"
)
{
{
setUser
(
true
);
}
@Override
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
final
DriverClassFindJob
finder
=
new
DriverClassFindJob
(
configuration
.
getDriver
(),
SSLSocketFactory
.
class
.
getName
(),
false
);
finder
.
run
(
new
DefaultProgressMonitor
(
monitor
));
UIUtils
.
syncExec
(()
->
{
sslFactoryCombo
.
removeAll
();
for
(
String
cn
:
finder
.
getDriverClassNames
())
{
sslFactoryCombo
.
add
(
cn
);
}
final
String
factoryValue
=
configuration
.
getStringProperty
(
PostgreConstants
.
PROP_SSL_FACTORY
);
if
(!
CommonUtils
.
isEmpty
(
factoryValue
))
{
sslFactoryCombo
.
setText
(
factoryValue
);
}
});
return
Status
.
OK_STATUS
;
}
};
resolveJob
.
schedule
();
if
(!
sslClassesResolved
)
{
sslClassesResolved
=
true
;
final
Job
resolveJob
=
new
Job
(
"Find factories"
)
{
{
setUser
(
true
);
}
@Override
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
final
DriverClassFindJob
finder
=
new
DriverClassFindJob
(
configuration
.
getDriver
(),
SSLSocketFactory
.
class
.
getName
(),
false
);
finder
.
run
(
new
DefaultProgressMonitor
(
monitor
));
UIUtils
.
syncExec
(()
->
{
sslFactoryCombo
.
removeAll
();
for
(
String
cn
:
finder
.
getDriverClassNames
())
{
sslFactoryCombo
.
add
(
cn
);
}
final
String
factoryValue
=
configuration
.
getStringProperty
(
PostgreConstants
.
PROP_SSL_FACTORY
);
if
(!
CommonUtils
.
isEmpty
(
factoryValue
))
{
sslFactoryCombo
.
setText
(
factoryValue
);
}
});
return
Status
.
OK_STATUS
;
}
};
resolveJob
.
schedule
();
}
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNProjectDatabases.java
浏览文件 @
26b08ebd
...
...
@@ -401,12 +401,14 @@ public class DBNProjectDatabases extends DBNNode implements DBNContainer, DBPEve
nodeChange
);
if
(
event
.
getObject
()
instanceof
DBPDataSourceContainer
)
{
if
(
enabled
!=
null
&&
!
enabled
)
{
// Clear disabled node
dbmNode
.
clearNode
(
false
);
if
(
enabled
!=
null
)
{
if
(!
enabled
)
{
// Clear disabled node
dbmNode
.
clearNode
(
false
);
}
}
else
{
if
(
event
.
getAction
()
==
DBPEvent
.
Action
.
OBJECT_UPDATE
)
{
// Force reorder
// Force reorder
.
children
=
null
;
getModel
().
fireNodeEvent
(
new
DBNEvent
(
this
,
DBNEvent
.
Action
.
UPDATE
,
this
));
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/ui/UIServiceConnections.java
浏览文件 @
26b08ebd
...
...
@@ -17,6 +17,8 @@
package
org.jkiss.dbeaver.runtime.ui
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressListener
;
...
...
@@ -27,14 +29,14 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
*/
public
interface
UIServiceConnections
{
void
openConnectionEditor
(
DBPDataSourceContainer
dataSourceContainer
);
void
openConnectionEditor
(
@NotNull
DBPDataSourceContainer
dataSourceContainer
,
@Nullable
String
defaultPageName
);
void
connectDataSource
(
DBPDataSourceContainer
dataSourceContainer
,
DBRProgressListener
onFinish
);
void
connectDataSource
(
@NotNull
DBPDataSourceContainer
dataSourceContainer
,
DBRProgressListener
onFinish
);
void
disconnectDataSource
(
DBPDataSourceContainer
dataSourceContainer
);
void
disconnectDataSource
(
@NotNull
DBPDataSourceContainer
dataSourceContainer
);
void
closeActiveTransaction
(
DBRProgressMonitor
monitor
,
DBCExecutionContext
context
,
boolean
commitTxn
);
void
closeActiveTransaction
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBCExecutionContext
context
,
boolean
commitTxn
);
boolean
checkAndCloseActiveTransaction
(
DBCExecutionContext
[]
contexts
);
boolean
checkAndCloseActiveTransaction
(
@NotNull
DBCExecutionContext
[]
contexts
);
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
浏览文件 @
26b08ebd
...
...
@@ -368,6 +368,11 @@ public class ContentUtils {
return
contentType
!=
null
&&
contentType
.
toLowerCase
(
Locale
.
ENGLISH
).
startsWith
(
"text"
);
}
public
static
boolean
isTextMime
(
String
mimeType
)
{
return
mimeType
!=
null
&&
mimeType
.
toLowerCase
(
Locale
.
ENGLISH
).
startsWith
(
"text"
);
}
public
static
boolean
isTextValue
(
Object
value
)
{
if
(
value
==
null
)
{
...
...
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/view/DatabaseTasksTree.java
浏览文件 @
26b08ebd
...
...
@@ -25,7 +25,6 @@ import org.eclipse.swt.layout.GridData;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.swt.widgets.TreeItem
;
import
org.eclipse.ui.dialogs.FilteredTree
;
import
org.eclipse.ui.dialogs.PatternFilter
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
...
...
@@ -41,6 +40,7 @@ import org.jkiss.dbeaver.tasks.ui.internal.TaskUIMessages;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.ViewerColumnController
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -71,16 +71,14 @@ public class DatabaseTasksTree {
colorErrorForeground
=
UIUtils
.
getContrastColor
(
colorError
);
composite
.
addDisposeListener
(
e
->
colorErrorForeground
.
dispose
());
FilteredTree
filteredTree
=
new
FilteredTree
(
composite
,
taskViewer
=
DialogUtils
.
create
FilteredTree
(
composite
,
SWT
.
MULTI
|
SWT
.
FULL_SELECTION
|
(
selector
?
SWT
.
BORDER
|
SWT
.
CHECK
:
SWT
.
NONE
),
new
NamedObjectPatternFilter
(),
true
);
filteredTree
.
setInitialText
(
TaskUIMessages
.
db_tasks_tree_text_tasks_type
);
taskViewer
=
filteredTree
.
getViewer
();
new
NamedObjectPatternFilter
(),
TaskUIMessages
.
db_tasks_tree_text_tasks_type
);
Tree
taskTree
=
taskViewer
.
getTree
();
taskTree
.
setHeaderVisible
(
true
);
taskTree
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
taskColumnController
=
new
ViewerColumnController
(
TaskUIMessages
.
db_tasks_tree_column_controller_tasks
,
filteredTree
.
getViewer
()
);
taskColumnController
=
new
ViewerColumnController
(
TaskUIMessages
.
db_tasks_tree_column_controller_tasks
,
taskViewer
);
taskColumnController
.
addColumn
(
TaskUIMessages
.
db_tasks_tree_column_controller_add_name
,
TaskUIMessages
.
db_tasks_tree_column_controller_add_descr_name
,
SWT
.
LEFT
,
true
,
true
,
new
TaskLabelProvider
()
{
@Override
protected
String
getCellText
(
Object
element
)
{
...
...
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/view/DatabaseTasksView.java
浏览文件 @
26b08ebd
...
...
@@ -28,7 +28,6 @@ import org.eclipse.swt.widgets.Composite;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.dialogs.FilteredTree
;
import
org.eclipse.ui.dialogs.PatternFilter
;
import
org.eclipse.ui.editors.text.TextFileDocumentProvider
;
import
org.eclipse.ui.menus.CommandContributionItem
;
...
...
@@ -46,6 +45,7 @@ import org.jkiss.dbeaver.runtime.DBWorkbench;
import
org.jkiss.dbeaver.tasks.ui.internal.TaskUIMessages
;
import
org.jkiss.dbeaver.ui.*
;
import
org.jkiss.dbeaver.ui.controls.ViewerColumnController
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
org.jkiss.utils.ArrayUtils
;
...
...
@@ -112,9 +112,7 @@ public class DatabaseTasksView extends ViewPart implements DBTTaskListener {
}
private
void
createTaskRunTable
(
Composite
parent
)
{
FilteredTree
filteredTree
=
new
FilteredTree
(
parent
,
SWT
.
SINGLE
|
SWT
.
FULL_SELECTION
,
new
NamedObjectPatternFilter
(),
true
);
filteredTree
.
setInitialText
(
TaskUIMessages
.
db_tasks_view_filtered_tree_text_error_message
);
taskRunViewer
=
filteredTree
.
getViewer
();
taskRunViewer
=
DialogUtils
.
createFilteredTree
(
parent
,
SWT
.
SINGLE
|
SWT
.
FULL_SELECTION
,
new
NamedObjectPatternFilter
(),
TaskUIMessages
.
db_tasks_view_filtered_tree_text_error_message
);
Tree
taskrunTree
=
taskRunViewer
.
getTree
();
taskrunTree
.
setHeaderVisible
(
true
);
taskrunTree
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
...
...
plugins/org.jkiss.dbeaver.ui.app.standalone/META-INF/MANIFEST.MF
浏览文件 @
26b08ebd
...
...
@@ -32,5 +32,6 @@ Require-Bundle: org.eclipse.osgi,
org.w3c.css.sac,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.core,
org.jkiss.dbeaver.ui
org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ui.editors.data
Automatic-Module-Name: org.jkiss.dbeaver.ui.app.standalone
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardDatabaseSelectDialog.java
浏览文件 @
26b08ebd
...
...
@@ -24,7 +24,6 @@ import org.eclipse.swt.layout.GridData;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.ui.dialogs.FilteredTree
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.DBPNamedObject
;
import
org.jkiss.dbeaver.model.DBUtils
;
...
...
@@ -38,6 +37,7 @@ import org.jkiss.dbeaver.ui.controls.TreeContentProvider;
import
org.jkiss.dbeaver.ui.dashboard.internal.UIDashboardActivator
;
import
org.jkiss.dbeaver.ui.dashboard.internal.UIDashboardMessages
;
import
org.jkiss.dbeaver.ui.dialogs.BaseDialog
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.List
;
...
...
@@ -66,7 +66,7 @@ public class DashboardDatabaseSelectDialog extends BaseDialog {
Composite
dialogArea
=
super
.
createDialogArea
(
parent
);
{
treeViewer
=
new
FilteredTree
(
dialogArea
,
SWT
.
BORDER
,
new
NamedObjectPatternFilter
(),
true
).
getViewer
(
);
treeViewer
=
DialogUtils
.
createFilteredTree
(
dialogArea
,
SWT
.
BORDER
,
new
NamedObjectPatternFilter
(),
null
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_BOTH
);
gd
.
heightHint
=
300
;
gd
.
widthHint
=
300
;
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/META-INF/MANIFEST.MF
浏览文件 @
26b08ebd
...
...
@@ -41,6 +41,7 @@ Export-Package: org.jkiss.dbeaver.registry.functions,
org.jkiss.dbeaver.ui.data.managers,
org.jkiss.dbeaver.ui.data.managers.stream,
org.jkiss.dbeaver.ui.data.registry,
org.jkiss.dbeaver.ui.editors.content,
org.jkiss.dbeaver.ui.editors.data,
org.jkiss.dbeaver.ui.editors.data.preferences
Automatic-Module-Name: org.jkiss.dbeaver.ui.editors.data
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/registry/StreamValueManagerDescriptor.java
浏览文件 @
26b08ebd
...
...
@@ -21,6 +21,7 @@ import org.jkiss.code.NotNull;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.impl.AbstractDescriptor
;
import
org.jkiss.dbeaver.ui.data.IStreamValueManager
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -29,7 +30,8 @@ import org.jkiss.utils.CommonUtils;
*/
public
class
StreamValueManagerDescriptor
extends
AbstractDescriptor
{
public
static
final
String
TAG_STREAM_MANAGER
=
"streamManager"
;
//$NON-NLS-1$
static
final
String
TAG_STREAM_MANAGER
=
"streamManager"
;
//$NON-NLS-1$
private
static
final
String
ATTR_PRIMARY_MIME
=
"primaryMime"
;
private
static
final
String
ATTR_SUPPORTED_MIME
=
"supportedMime"
;
...
...
@@ -40,10 +42,11 @@ public class StreamValueManagerDescriptor extends AbstractDescriptor
private
final
DBPImage
icon
;
private
final
String
primaryMime
;
private
final
String
[]
supportedMime
;
private
boolean
supportsText
;
private
IStreamValueManager
instance
;
public
StreamValueManagerDescriptor
(
IConfigurationElement
config
)
StreamValueManagerDescriptor
(
IConfigurationElement
config
)
{
super
(
config
);
...
...
@@ -64,6 +67,12 @@ public class StreamValueManagerDescriptor extends AbstractDescriptor
}
this
.
supportedMime
=
mimeList
;
}
for
(
String
mime
:
supportedMime
)
{
if
(
ContentUtils
.
isTextMime
(
mime
))
{
supportsText
=
true
;
break
;
}
}
}
public
String
getId
()
...
...
@@ -91,6 +100,10 @@ public class StreamValueManagerDescriptor extends AbstractDescriptor
return
primaryMime
;
}
public
boolean
supportsText
()
{
return
supportsText
;
}
@NotNull
public
IStreamValueManager
getInstance
()
{
...
...
@@ -109,4 +122,5 @@ public class StreamValueManagerDescriptor extends AbstractDescriptor
public
String
toString
()
{
return
id
+
" ("
+
label
+
")"
;
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/registry/ValueManagerRegistry.java
浏览文件 @
26b08ebd
...
...
@@ -29,6 +29,7 @@ import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import
org.jkiss.dbeaver.ui.data.IStreamValueManager
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.dbeaver.ui.data.managers.DefaultValueManager
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.MimeType
;
...
...
@@ -100,8 +101,13 @@ public class ValueManagerRegistry {
}
public
Map
<
StreamValueManagerDescriptor
,
IStreamValueManager
.
MatchType
>
getApplicableStreamManagers
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSTypedObject
attribute
,
@Nullable
DBDContent
value
)
{
boolean
isTextContent
=
ContentUtils
.
isTextContent
(
value
);
Map
<
StreamValueManagerDescriptor
,
IStreamValueManager
.
MatchType
>
result
=
new
LinkedHashMap
<>();
for
(
StreamValueManagerDescriptor
contentManager
:
streamManagers
)
{
if
(
isTextContent
!=
contentManager
.
supportsText
())
{
// Skip different kind of manager
continue
;
}
IStreamValueManager
.
MatchType
matchType
=
contentManager
.
getInstance
().
matchesTo
(
monitor
,
attribute
,
value
);
switch
(
matchType
)
{
case
NONE:
...
...
plugins/org.jkiss.dbeaver.ui.editors.json/src/org/jkiss/dbeaver/ui/data/managers/stream/JSONPanelEditor.java
浏览文件 @
26b08ebd
...
...
@@ -16,6 +16,10 @@
*/
package
org.jkiss.dbeaver.ui.data.managers.stream
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.ui.IEditorInput
;
import
org.eclipse.ui.IEditorSite
;
import
org.eclipse.ui.PartInitException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.managers.AbstractTextPanelEditor
;
import
org.jkiss.dbeaver.ui.editors.json.JSONTextEditor
;
...
...
@@ -27,7 +31,18 @@ public class JSONPanelEditor extends AbstractTextPanelEditor<JSONTextEditor> {
@Override
protected
JSONTextEditor
createEditorParty
(
IValueController
valueController
)
{
return
new
JSONTextEditor
();
// Override init function because standard is VEEERY slow
return
new
JSONTextEditor
()
{
@Override
public
void
init
(
IEditorSite
site
,
IEditorInput
input
)
throws
PartInitException
{
setSite
(
site
);
try
{
doSetInput
(
input
);
}
catch
(
CoreException
e
)
{
throw
new
PartInitException
(
"Error initializing panel JSON editor"
,
e
);
}
}
};
}
}
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
26b08ebd
...
...
@@ -830,6 +830,7 @@ public class SQLEditor extends SQLEditorBase implements
private
void
createControlsBar
(
Composite
sqlEditorPanel
)
{
sideToolBar
=
new
VerticalFolder
(
sqlEditorPanel
,
SWT
.
LEFT
);
sideToolBar
.
setCheckCommandEnablement
(
true
);
((
GridLayout
)
sideToolBar
.
getLayout
()).
marginTop
=
3
;
((
GridLayout
)
sideToolBar
.
getLayout
()).
marginBottom
=
10
;
((
GridLayout
)
sideToolBar
.
getLayout
()).
verticalSpacing
=
3
;
...
...
plugins/org.jkiss.dbeaver.ui.editors.xml/src/org/jkiss/dbeaver/ui/data/managers/stream/XMLPanelEditor.java
浏览文件 @
26b08ebd
...
...
@@ -16,6 +16,10 @@
*/
package
org.jkiss.dbeaver.ui.data.managers.stream
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.ui.IEditorInput
;
import
org.eclipse.ui.IEditorSite
;
import
org.eclipse.ui.PartInitException
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.managers.AbstractTextPanelEditor
;
import
org.jkiss.dbeaver.ui.editors.xml.XMLEditor
;
...
...
@@ -27,6 +31,17 @@ public class XMLPanelEditor extends AbstractTextPanelEditor<XMLEditor> {
@Override
protected
XMLEditor
createEditorParty
(
IValueController
valueController
)
{
return
new
XMLEditor
();
// Override init function because standard is VEEERY slow
return
new
XMLEditor
()
{
@Override
public
void
init
(
IEditorSite
site
,
IEditorInput
input
)
throws
PartInitException
{
setSite
(
site
);
try
{
doSetInput
(
input
);
}
catch
(
CoreException
e
)
{
throw
new
PartInitException
(
"Error initializing panel XML editor"
,
e
);
}
}
};
}
}
plugins/org.jkiss.dbeaver.ui.navigator/OSGI-INF/l10n/bundle.properties
浏览文件 @
26b08ebd
...
...
@@ -72,6 +72,10 @@ command.org.jkiss.dbeaver.core.object.create.name=Create Object
command.org.jkiss.dbeaver.core.object.create.description
=
Create new database object
command.org.jkiss.dbeaver.core.object.delete.name
=
Delete Object
command.org.jkiss.dbeaver.core.object.delete.description
=
Delete database object
command.org.jkiss.dbeaver.navigator.filter.connected.name
=
Show connected
command.org.jkiss.dbeaver.navigator.filter.connected.description
=
View all/connected data sources
command.org.jkiss.dbeaver.navigator.filter.object.type.name
=
Navigator filter object type
command.org.jkiss.dbeaver.navigator.filter.object.type.description
=
Navigator filter object type (connection, container, table)
command.org.jkiss.dbeaver.core.object.filter.config.name
=
Configure filter
command.org.jkiss.dbeaver.core.object.filter.config.description
=
Configure objects filter
command.org.jkiss.dbeaver.core.object.filter.clear.name
=
Clear filter
...
...
plugins/org.jkiss.dbeaver.ui.navigator/plugin.xml
浏览文件 @
26b08ebd
...
...
@@ -228,6 +228,10 @@
<command
id=
"org.jkiss.dbeaver.core.object.move.down"
name=
"%command.org.jkiss.dbeaver.core.object.move.down.name"
description=
"%command.org.jkiss.dbeaver.core.object.move.down.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
<command
id=
"org.jkiss.dbeaver.core.object.goto"
name=
"%command.org.jkiss.dbeaver.core.object.goto.name"
description=
"%command.org.jkiss.dbeaver.core.object.goto.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
<command
id=
"org.jkiss.dbeaver.navigator.filter.connected"
name=
"%command.org.jkiss.dbeaver.navigator.filter.connected.name"
description=
"%command.org.jkiss.dbeaver.navigator.filter.connected.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
<command
id=
"org.jkiss.dbeaver.navigator.filter.object.type"
name=
"%command.org.jkiss.dbeaver.navigator.filter.object.type.name"
description=
"%command.org.jkiss.dbeaver.navigator.filter.object.type.description"
categoryId=
"org.jkiss.dbeaver.core.database"
>
<commandParameter
id=
"type"
name=
"Object type"
optional=
"false"
/>
</command>
<command
id=
"org.jkiss.dbeaver.core.object.filter.config"
name=
"%command.org.jkiss.dbeaver.core.object.filter.config.name"
description=
"%command.org.jkiss.dbeaver.core.object.filter.config.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
<command
id=
"org.jkiss.dbeaver.core.object.filter.add.exclude"
name=
"%command.org.jkiss.dbeaver.core.object.filter.add.exclude.name"
description=
"%command.org.jkiss.dbeaver.core.object.filter.add.exclude.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
<command
id=
"org.jkiss.dbeaver.core.object.filter.add.include"
name=
"%command.org.jkiss.dbeaver.core.object.filter.add.include.name"
description=
"%command.org.jkiss.dbeaver.core.object.filter.add.include.description"
categoryId=
"org.jkiss.dbeaver.core.database"
/>
...
...
@@ -277,6 +281,7 @@
<image
commandId=
"org.jkiss.dbeaver.core.object.move.up"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/misc/arrow_up.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.object.move.down"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/misc/arrow_down.png"
/>
<image
commandId=
"org.jkiss.dbeaver.navigator.filter.connected"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/misc/filter_apply.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.object.filter.config"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/misc/filter.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.object.filter.add.exclude"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/misc/filter_add.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.object.filter.add.include"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/misc/filter_add.png"
/>
...
...
@@ -329,6 +334,10 @@
-->
</handler>
<handler
commandId=
"org.jkiss.dbeaver.navigator.filter.connected"
class=
"org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerConnectionFilter"
>
</handler>
<handler
commandId=
"org.jkiss.dbeaver.navigator.filter.object.type"
class=
"org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerFilterObjectType"
>
</handler>
<handler
commandId=
"org.jkiss.dbeaver.core.object.filter.config"
class=
"org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerFilterConfig"
>
<enabledWhen>
<with
variable=
"selection"
>
...
...
@@ -745,6 +754,21 @@
</extension>
<extension
point=
"org.eclipse.ui.menus"
>
<!-- Database navigator filter toolbar -->
<menuContribution
allPopups=
"false"
locationURI=
"toolbar:org.jkiss.dbeaver.navigator.filter.toolbar?after=additions"
>
<command
commandId=
"org.jkiss.dbeaver.navigator.filter.connected"
id=
"org.jkiss.dbeaver.navigator.connectionFilterMenu"
style=
"pulldown"
/>
</menuContribution>
<!-- Connection filter menu -->
<menuContribution
allPopups=
"false"
locationURI=
"menu:org.jkiss.dbeaver.navigator.connectionFilterMenu"
>
<command
commandId=
"org.jkiss.dbeaver.navigator.filter.object.type"
style=
"radio"
><parameter
name=
"type"
value=
"connection"
/></command>
<command
commandId=
"org.jkiss.dbeaver.navigator.filter.object.type"
style=
"radio"
><parameter
name=
"type"
value=
"container"
/></command>
<command
commandId=
"org.jkiss.dbeaver.navigator.filter.object.type"
style=
"radio"
><parameter
name=
"type"
value=
"table"
/></command>
<separator
name=
"connected_toggle"
visible=
"true"
/>
<command
commandId=
"org.jkiss.dbeaver.navigator.filter.connected"
/>
</menuContribution>
<!-- Tools toolbar -->
<menuContribution
allPopups=
"false"
locationURI=
"toolbar:org.eclipse.ui.main.toolbar?after=additions"
>
<toolbar
id=
"dbeaver-tools"
label=
"Database Tools Toolbar"
>
<separator
name=
"additions"
visible=
"false"
/>
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/INavigatorItemRenderer.java
浏览文件 @
26b08ebd
...
...
@@ -32,4 +32,6 @@ public interface INavigatorItemRenderer {
void
paintNodeDetails
(
DBNNode
node
,
Tree
tree
,
GC
gc
,
Event
event
);
void
showDetailsToolTip
(
DBNNode
node
,
Tree
tree
,
Event
event
);
void
performAction
(
DBNNode
node
,
Tree
tree
,
Event
event
,
boolean
defaultAction
);
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/INavigatorNodeActionHandler.java
浏览文件 @
26b08ebd
...
...
@@ -34,6 +34,6 @@ public interface INavigatorNodeActionHandler {
String
getNodeActionToolTip
(
INavigatorModelView
view
,
DBNNode
node
);
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
);
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
,
boolean
defaultAction
);
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorCommands.java
浏览文件 @
26b08ebd
...
...
@@ -39,6 +39,8 @@ public class NavigatorCommands {
public
static
final
String
CMD_CREATE_FOLDER_LINK
=
"org.jkiss.dbeaver.core.resource.link.folder"
;
public
static
final
String
CMD_CREATE_PROJECT
=
"org.jkiss.dbeaver.core.project.create"
;
public
static
final
String
CMD_FILTER_CONNECTIONS
=
"org.jkiss.dbeaver.navigator.filter.connected"
;
public
static
final
String
PARAM_OBJECT_TYPE
=
"org.jkiss.dbeaver.core.object.type"
;
public
static
final
String
PARAM_OBJECT_TYPE_NAME
=
"org.jkiss.dbeaver.core.object.typeName"
;
public
static
final
String
PARAM_OBJECT_TYPE_ICON
=
"org.jkiss.dbeaver.core.object.typeIcon"
;
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerConnectionFilter.java
0 → 100644
浏览文件 @
26b08ebd
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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.navigator.actions
;
import
org.eclipse.core.commands.AbstractHandler
;
import
org.eclipse.core.commands.ExecutionEvent
;
import
org.eclipse.core.commands.ExecutionException
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.eclipse.ui.commands.IElementUpdater
;
import
org.eclipse.ui.handlers.HandlerUtil
;
import
org.eclipse.ui.menus.UIElement
;
import
org.jkiss.dbeaver.ui.ActionUtils
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorCommands
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTree
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView
;
import
java.util.Map
;
public
class
NavigatorHandlerConnectionFilter
extends
AbstractHandler
implements
IElementUpdater
{
@Override
public
Object
execute
(
ExecutionEvent
event
)
throws
ExecutionException
{
IWorkbenchPart
activePart
=
HandlerUtil
.
getActivePart
(
event
);
if
(
activePart
instanceof
DatabaseNavigatorView
)
{
DatabaseNavigatorTree
navigatorTree
=
((
DatabaseNavigatorView
)
activePart
).
getNavigatorTree
();
navigatorTree
.
setFilterShowConnected
(!
navigatorTree
.
isFilterShowConnected
());
navigatorTree
.
getViewer
().
getControl
().
setRedraw
(
false
);
try
{
navigatorTree
.
getViewer
().
refresh
();
}
finally
{
navigatorTree
.
getViewer
().
getControl
().
setRedraw
(
true
);
}
}
ActionUtils
.
fireCommandRefresh
(
NavigatorCommands
.
CMD_FILTER_CONNECTIONS
);
return
null
;
}
@Override
public
void
updateElement
(
UIElement
element
,
Map
parameters
)
{
IWorkbenchPartSite
partSite
=
UIUtils
.
getWorkbenchPartSite
(
element
.
getServiceLocator
());
if
(
partSite
!=
null
&&
partSite
.
getPart
()
instanceof
DatabaseNavigatorView
)
{
DatabaseNavigatorTree
navigatorTree
=
((
DatabaseNavigatorView
)
partSite
.
getPart
()).
getNavigatorTree
();
element
.
setIcon
(
DBeaverIcons
.
getImageDescriptor
(
navigatorTree
.
isFilterShowConnected
()
?
UIIcon
.
FILTER_RESET
:
UIIcon
.
FILTER_APPLY
));
String
actionName
=
navigatorTree
.
isFilterShowConnected
()
?
"Show all"
:
"Show connected only"
;
element
.
setText
(
actionName
);
element
.
setTooltip
(
actionName
);
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerFilterObjectType.java
0 → 100644
浏览文件 @
26b08ebd
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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.navigator.actions
;
import
org.eclipse.core.commands.AbstractHandler
;
import
org.eclipse.core.commands.ExecutionEvent
;
import
org.eclipse.core.commands.ExecutionException
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.eclipse.ui.commands.IElementUpdater
;
import
org.eclipse.ui.handlers.HandlerUtil
;
import
org.eclipse.ui.menus.UIElement
;
import
org.jkiss.dbeaver.ui.ActionUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorCommands
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTree
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTreeFilterObjectType
;
import
org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Map
;
public
class
NavigatorHandlerFilterObjectType
extends
AbstractHandler
implements
IElementUpdater
{
@Override
public
Object
execute
(
ExecutionEvent
event
)
throws
ExecutionException
{
IWorkbenchPart
activePart
=
HandlerUtil
.
getActivePart
(
event
);
if
(
activePart
instanceof
DatabaseNavigatorView
)
{
DatabaseNavigatorTree
navigatorTree
=
((
DatabaseNavigatorView
)
activePart
).
getNavigatorTree
();
DatabaseNavigatorTreeFilterObjectType
objectType
=
CommonUtils
.
valueOf
(
DatabaseNavigatorTreeFilterObjectType
.
class
,
event
.
getParameter
(
"type"
),
DatabaseNavigatorTreeFilterObjectType
.
table
);
if
(
objectType
==
navigatorTree
.
getFilterObjectType
())
{
return
null
;
}
navigatorTree
.
setFilterObjectType
(
objectType
);
navigatorTree
.
getViewer
().
getControl
().
setRedraw
(
false
);
try
{
navigatorTree
.
getViewer
().
refresh
();
}
finally
{
navigatorTree
.
getViewer
().
getControl
().
setRedraw
(
true
);
}
}
ActionUtils
.
fireCommandRefresh
(
NavigatorCommands
.
CMD_FILTER_CONNECTIONS
);
return
null
;
}
@Override
public
void
updateElement
(
UIElement
element
,
Map
parameters
)
{
DatabaseNavigatorTreeFilterObjectType
objectType
=
CommonUtils
.
valueOf
(
DatabaseNavigatorTreeFilterObjectType
.
class
,
CommonUtils
.
toString
(
parameters
.
get
(
"type"
)),
DatabaseNavigatorTreeFilterObjectType
.
table
);
DatabaseNavigatorTreeFilterObjectType
curObjectType
=
DatabaseNavigatorTreeFilterObjectType
.
table
;
IWorkbenchPartSite
partSite
=
UIUtils
.
getWorkbenchPartSite
(
element
.
getServiceLocator
());
if
(
partSite
!=
null
&&
partSite
.
getPart
()
instanceof
DatabaseNavigatorView
)
{
curObjectType
=
((
DatabaseNavigatorView
)
partSite
.
getPart
()).
getNavigatorTree
().
getFilterObjectType
();
}
String
text
,
toolTip
;
switch
(
objectType
)
{
case
connection:
text
=
"Filter connections"
;
toolTip
=
"Filter connections by name"
;
break
;
case
container:
text
=
"Filter databases or schemas"
;
toolTip
=
"Filter containers (databases or schemas) by name"
;
break
;
case
table:
text
=
"Filter tables, procedures"
;
toolTip
=
"Filter objects (tables, procedures, users, etc) by name"
;
break
;
default
:
return
;
}
element
.
setText
(
text
);
element
.
setTooltip
(
toolTip
);
element
.
setChecked
(
objectType
==
curObjectType
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerObjectOpen.java
浏览文件 @
26b08ebd
...
...
@@ -39,7 +39,6 @@ import org.jkiss.dbeaver.model.DBUtils;
import
org.jkiss.dbeaver.model.edit.DBEObjectEditor
;
import
org.jkiss.dbeaver.model.navigator.*
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceConnections
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceSQL
;
...
...
@@ -271,7 +270,7 @@ public class NavigatorHandlerObjectOpen extends NavigatorHandlerObjectBase imple
public
static
void
openConnectionEditor
(
IWorkbenchWindow
workbenchWindow
,
DBPDataSourceContainer
dataSourceContainer
)
{
UIServiceConnections
serviceConnections
=
DBWorkbench
.
getService
(
UIServiceConnections
.
class
);
if
(
serviceConnections
!=
null
)
{
serviceConnections
.
openConnectionEditor
(
dataSourceContainer
);
serviceConnections
.
openConnectionEditor
(
dataSourceContainer
,
null
);
}
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/node/NNAHDataSourceConfiguration.java
浏览文件 @
26b08ebd
...
...
@@ -45,7 +45,7 @@ public class NNAHDataSourceConfiguration extends NavigatorNodeActionHandlerAbstr
}
@Override
public
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
)
{
public
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
,
boolean
defaultAction
)
{
}
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/node/NNAHDataSourceReadOnly.java
浏览文件 @
26b08ebd
...
...
@@ -49,7 +49,7 @@ public class NNAHDataSourceReadOnly extends NavigatorNodeActionHandlerAbstract {
}
@Override
public
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
)
{
public
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
,
boolean
defaultAction
)
{
}
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/node/NNAHDataSourceTunnel.java
浏览文件 @
26b08ebd
...
...
@@ -18,10 +18,14 @@
package
org.jkiss.dbeaver.ui.navigator.actions.node
;
import
org.eclipse.swt.widgets.Event
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.navigator.DBNDataSource
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabaseNode
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.ui.UIServiceConnections
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.navigator.INavigatorModelView
;
import
org.jkiss.dbeaver.ui.navigator.actions.NavigatorNodeActionHandlerAbstract
;
...
...
@@ -61,7 +65,14 @@ public class NNAHDataSourceTunnel extends NavigatorNodeActionHandlerAbstract {
}
@Override
public
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
)
{
public
void
handleNodeAction
(
INavigatorModelView
view
,
DBNNode
node
,
Event
event
,
boolean
defaultAction
)
{
if
(
node
instanceof
DBNDatabaseNode
)
{
DBPDataSourceContainer
dataSourceContainer
=
((
DBNDatabaseNode
)
node
).
getDataSourceContainer
();
UIServiceConnections
serviceConnections
=
DBWorkbench
.
getService
(
UIServiceConnections
.
class
);
if
(
serviceConnections
!=
null
)
{
serviceConnections
.
openConnectionEditor
(
dataSourceContainer
,
"ConnectionPageNetworkHandler.ssh_tunnel"
);
}
}
}
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DatabaseNavigatorTree.java
浏览文件 @
26b08ebd
...
...
@@ -19,6 +19,8 @@ package org.jkiss.dbeaver.ui.navigator.database;
import
org.eclipse.core.runtime.IProgressMonitor
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.core.runtime.Status
;
import
org.eclipse.jface.action.Separator
;
import
org.eclipse.jface.action.ToolBarManager
;
import
org.eclipse.jface.viewers.*
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.custom.TreeEditor
;
...
...
@@ -30,10 +32,13 @@ import org.eclipse.swt.graphics.Rectangle;
import
org.eclipse.swt.layout.FillLayout
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.IWorkbenchActionConstants
;
import
org.eclipse.ui.IWorkbenchCommandConstants
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.eclipse.ui.dialogs.FilteredTree
;
import
org.eclipse.ui.dialogs.PatternFilter
;
import
org.eclipse.ui.menus.IMenuService
;
import
org.eclipse.ui.progress.WorkbenchJob
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
...
...
@@ -60,9 +65,11 @@ import java.util.ArrayList;
public
class
DatabaseNavigatorTree
extends
Composite
implements
INavigatorListener
{
private
static
final
Log
log
=
Log
.
getLog
(
DatabaseNavigatorTree
.
class
);
static
final
String
TREE_DATA_STAT_MAX_SIZE
=
"nav.stat.maxSize"
;
private
static
final
String
FILTER_TOOLBAR_CONTRIBUTION_ID
=
"toolbar:org.jkiss.dbeaver.navigator.filter.toolbar"
;
//$NON-NLS-1$
private
TreeViewer
treeViewer
;
private
DBNModel
model
;
...
...
@@ -73,8 +80,9 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
private
boolean
inlineRenameEnabled
=
false
;
private
INavigatorItemRenderer
itemRenderer
;
public
DatabaseNavigatorTree
(
Composite
parent
,
DBNNode
rootNode
,
int
style
)
{
private
boolean
filterShowConnected
=
false
;
public
DatabaseNavigatorTree
(
Composite
parent
,
DBNNode
rootNode
,
int
style
)
{
this
(
parent
,
rootNode
,
style
,
false
);
}
...
...
@@ -128,8 +136,47 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
this
.
setItemRenderer
(
new
DefaultNavigatorNodeRenderer
());
{
//tree.addListener(SWT.EraseItem, event -> eraseItem(tree, event));
tree
.
addListener
(
SWT
.
PaintItem
,
event
->
paintItem
(
tree
,
event
));
//tree.addListener(SWT.EraseItem, event -> onEraseItem(tree, event));
tree
.
addListener
(
SWT
.
PaintItem
,
event
->
onPaintItem
(
tree
,
event
));
if
(
false
)
{
// See comments for StatisticsNavigatorNodeRenderer.PAINT_ACTION_HOVER
Listener
mouseListener
=
e
->
{
TreeItem
item
=
tree
.
getItem
(
new
Point
(
e
.
x
,
e
.
y
));
if
(
item
!=
null
)
{
Rectangle
itemBounds
=
item
.
getBounds
();
Point
treeSize
=
tree
.
getSize
();
tree
.
redraw
(
itemBounds
.
x
,
itemBounds
.
y
,
treeSize
.
x
,
treeSize
.
y
,
false
);
}
};
tree
.
addListener
(
SWT
.
MouseMove
,
mouseListener
);
//tree.addListener(SWT.MouseHover, mouseListener);
tree
.
addListener
(
SWT
.
MouseEnter
,
mouseListener
);
tree
.
addListener
(
SWT
.
MouseExit
,
mouseListener
);
}
tree
.
addListener
(
SWT
.
MouseDown
,
event
->
onItemMouseDown
(
tree
,
event
,
false
));
tree
.
addListener
(
SWT
.
MouseDoubleClick
,
event
->
onItemMouseDown
(
tree
,
event
,
true
));
}
}
public
boolean
isFilterShowConnected
()
{
return
filterShowConnected
;
}
public
void
setFilterShowConnected
(
boolean
filterShowConnected
)
{
this
.
filterShowConnected
=
filterShowConnected
;
}
public
DatabaseNavigatorTreeFilterObjectType
getFilterObjectType
()
{
if
(
navigatorFilter
instanceof
DatabaseNavigatorTreeFilter
)
{
return
((
DatabaseNavigatorTreeFilter
)
navigatorFilter
).
getFilterObjectType
();
}
return
DatabaseNavigatorTreeFilterObjectType
.
table
;
}
public
void
setFilterObjectType
(
DatabaseNavigatorTreeFilterObjectType
filterObjectType
)
{
if
(
navigatorFilter
instanceof
DatabaseNavigatorTreeFilter
)
{
((
DatabaseNavigatorTreeFilter
)
navigatorFilter
).
setFilterObjectType
(
filterObjectType
);
}
}
...
...
@@ -149,7 +196,7 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
this
.
itemRenderer
=
itemRenderer
;
}
private
void
e
raseItem
(
Tree
tree
,
Event
event
)
{
private
void
onE
raseItem
(
Tree
tree
,
Event
event
)
{
if
(
itemRenderer
!=
null
)
{
Object
element
=
event
.
item
.
getData
();
if
(
element
instanceof
DBNNode
)
{
...
...
@@ -158,7 +205,7 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
}
}
private
void
p
aintItem
(
Tree
tree
,
Event
event
)
{
private
void
onP
aintItem
(
Tree
tree
,
Event
event
)
{
if
(
itemRenderer
!=
null
)
{
Object
element
=
event
.
item
.
getData
();
if
(
element
instanceof
DBNNode
)
{
...
...
@@ -167,6 +214,18 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
}
}
private
void
onItemMouseDown
(
Tree
tree
,
Event
event
,
boolean
defaultAction
)
{
if
(
itemRenderer
!=
null
)
{
TreeItem
item
=
tree
.
getItem
(
new
Point
(
event
.
x
,
event
.
y
));
if
(
item
!=
null
)
{
Object
element
=
item
.
getData
();
if
(
element
instanceof
DBNNode
)
{
itemRenderer
.
performAction
((
DBNNode
)
element
,
tree
,
event
,
defaultAction
);
}
}
}
}
public
void
setInput
(
DBNNode
rootNode
)
{
treeViewer
.
setInput
(
new
DatabaseNavigatorContent
(
rootNode
));
}
...
...
@@ -210,7 +269,7 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
return
checkboxTreeViewer
;
}
else
{
if
(
navigatorFilter
!=
null
)
{
CustomFilteredTree
filteredTree
=
new
CustomFilteredTree
(
t
his
,
t
reeStyle
);
CustomFilteredTree
filteredTree
=
new
CustomFilteredTree
(
treeStyle
);
filterControl
=
filteredTree
.
getFilterControl
();
return
filteredTree
.
getViewer
();
}
else
{
...
...
@@ -582,7 +641,7 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
////////////////////////////////////////////////////////////////////////////
// Filtered tree
private
static
class
TreeFilter
extends
PatternFilter
{
private
class
TreeFilter
extends
PatternFilter
{
private
final
INavigatorFilter
filter
;
private
boolean
hasPattern
=
false
;
...
...
@@ -609,7 +668,13 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
}
public
boolean
isElementVisible
(
Viewer
viewer
,
Object
element
){
if
(
hasPattern
&&
filter
.
filterFolders
()
&&
element
instanceof
DBNLocalFolder
)
{
if
(
filterShowConnected
&&
element
instanceof
DBNDataSource
&&
!((
DBNDataSource
)
element
).
getDataSourceContainer
().
isConnected
())
{
return
false
;
}
if
((
filterShowConnected
||
getFilterObjectType
()
==
DatabaseNavigatorTreeFilterObjectType
.
connection
||
(
hasPattern
&&
filter
.
filterFolders
()))
&&
element
instanceof
DBNLocalFolder
)
{
return
hasVisibleConnections
(
viewer
,
(
DBNLocalFolder
)
element
);
}
if
(
filter
.
select
(
element
))
{
...
...
@@ -629,6 +694,10 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
return
true
;
}
}
else
if
(
isLeafMatch
(
viewer
,
child
))
{
if
(
filterShowConnected
&&
child
instanceof
DBNDataSource
&&
!((
DBNDataSource
)
child
).
getDataSourceContainer
().
isConnected
())
{
continue
;
}
return
true
;
}
}
...
...
@@ -637,15 +706,45 @@ public class DatabaseNavigatorTree extends Composite implements INavigatorListen
}
private
static
class
CustomFilteredTree
extends
FilteredTree
{
CustomFilteredTree
(
DatabaseNavigatorTree
navigatorTree
,
int
treeStyle
)
{
super
(
navigatorTree
,
treeStyle
,
new
TreeFilter
(
navigatorTree
.
navigatorFilter
),
true
);
private
class
CustomFilteredTree
extends
FilteredTree
{
CustomFilteredTree
(
int
treeStyle
)
{
super
(
DatabaseNavigatorTree
.
this
,
treeStyle
,
new
TreeFilter
(
DatabaseNavigatorTree
.
this
.
navigatorFilter
),
true
);
try
{
if
(
treeViewer
!=
null
)
{
treeViewer
.
setUseHashlookup
(
true
);
}
}
catch
(
Throwable
e
)
{
// May happen in old Eclipse versions
}
setInitialText
(
UINavigatorMessages
.
actions_navigator_search_tip
);
((
GridLayout
)
getLayout
()).
verticalSpacing
=
0
;
UIUtils
.
addDefaultEditActionsSupport
(
UIUtils
.
getActiveWorkbenchWindow
(),
getFilterControl
());
}
@Override
protected
Composite
createFilterControls
(
Composite
parent
)
{
super
.
createFilterControls
(
parent
);
((
GridLayout
)
parent
.
getLayout
()).
numColumns
++;
IWorkbenchWindow
workbenchWindow
=
UIUtils
.
getActiveWorkbenchWindow
();
ToolBarManager
filterManager
=
new
ToolBarManager
();
filterManager
.
add
(
new
Separator
(
IWorkbenchActionConstants
.
MB_ADDITIONS
));
final
IMenuService
menuService
=
workbenchWindow
.
getService
(
IMenuService
.
class
);
if
(
menuService
!=
null
)
{
menuService
.
populateContributionManager
(
filterManager
,
FILTER_TOOLBAR_CONTRIBUTION_ID
);
}
filterManager
.
createControl
(
parent
);
parent
.
addDisposeListener
(
e
->
filterManager
.
dispose
());
return
parent
;
}
@Override
protected
TreeViewer
doCreateTreeViewer
(
Composite
parent
,
int
style
)
{
return
((
DatabaseNavigatorTree
)
getParent
()).
doCreateNavigatorTreeViewer
(
parent
,
style
);
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DatabaseNavigatorTreeFilter.java
浏览文件 @
26b08ebd
...
...
@@ -16,20 +16,29 @@
*/
package
org.jkiss.dbeaver.ui.navigator.database
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.access.DBAUser
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabase
Item
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabase
Node
;
import
org.jkiss.dbeaver.model.struct.DBSEntity
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSPackage
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedure
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSSequence
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSTableIndex
;
import
org.jkiss.dbeaver.model.struct.rdb.*
;
import
org.jkiss.dbeaver.ui.navigator.INavigatorFilter
;
/**
* Default database navigator filter
*/
public
class
DatabaseNavigatorTreeFilter
implements
INavigatorFilter
{
private
DatabaseNavigatorTreeFilterObjectType
filterObjectType
=
DatabaseNavigatorTreeFilterObjectType
.
table
;
DatabaseNavigatorTreeFilterObjectType
getFilterObjectType
()
{
return
filterObjectType
;
}
void
setFilterObjectType
(
DatabaseNavigatorTreeFilterObjectType
filterObjectType
)
{
this
.
filterObjectType
=
filterObjectType
;
}
@Override
public
boolean
filterFolders
()
{
return
false
;
...
...
@@ -42,16 +51,26 @@ public class DatabaseNavigatorTreeFilter implements INavigatorFilter {
@Override
public
boolean
select
(
Object
element
)
{
if
(!(
element
instanceof
DBNDatabase
Item
))
{
if
(!(
element
instanceof
DBNDatabase
Node
))
{
return
true
;
}
DBSObject
object
=
((
DBNDatabaseItem
)
element
).
getObject
();
return
!(
object
instanceof
DBSEntity
)
&&
!(
object
instanceof
DBSProcedure
)
&&
!(
object
instanceof
DBSTableIndex
)
&&
!(
object
instanceof
DBSPackage
)
&&
!(
object
instanceof
DBSSequence
)
&&
!(
object
instanceof
DBAUser
);
DBSObject
object
=
((
DBNDatabaseNode
)
element
).
getObject
();
switch
(
filterObjectType
)
{
case
connection:
return
!(
object
instanceof
DBPDataSourceContainer
);
case
container:
return
!(
object
instanceof
DBSSchema
)
&&
!(
object
instanceof
DBSCatalog
);
default
:
return
!(
object
instanceof
DBSEntity
)
&&
!(
object
instanceof
DBSProcedure
)
&&
!(
object
instanceof
DBSTableIndex
)
&&
!(
object
instanceof
DBSPackage
)
&&
!(
object
instanceof
DBSSequence
)
&&
!(
object
instanceof
DBAUser
);
}
}
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DatabaseNavigatorTreeFilterObjectType.java
0 → 100644
浏览文件 @
26b08ebd
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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.navigator.database
;
public
enum
DatabaseNavigatorTreeFilterObjectType
{
connection
,
container
,
table
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/DefaultNavigatorNodeRenderer.java
浏览文件 @
26b08ebd
...
...
@@ -90,4 +90,9 @@ public class DefaultNavigatorNodeRenderer implements INavigatorItemRenderer {
}
@Override
public
void
performAction
(
DBNNode
node
,
Tree
tree
,
Event
event
,
boolean
defaultAction
)
{
}
}
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/NavigatorViewBase.java
浏览文件 @
26b08ebd
...
...
@@ -70,7 +70,7 @@ public abstract class NavigatorViewBase extends ViewPart implements INavigatorMo
return
DBWorkbench
.
getPlatform
().
getNavigatorModel
();
}
p
rotected
DatabaseNavigatorTree
getNavigatorTree
()
p
ublic
DatabaseNavigatorTree
getNavigatorTree
()
{
return
tree
;
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/StatisticsNavigatorNodeRenderer.java
浏览文件 @
26b08ebd
...
...
@@ -72,6 +72,10 @@ public class StatisticsNavigatorNodeRenderer extends DefaultNavigatorNodeRendere
private
static
final
RGB
HOST_NAME_FG_DARK
=
new
RGB
(
140
,
140
,
140
);
private
static
final
RGB
HOST_NAME_FG_LIGHT
=
new
RGB
(
105
,
105
,
105
);
// Disabled because of performance and a couple of glitches
// Sometimes hover bg remains after mouse move
private
static
final
boolean
PAINT_ACTION_HOVER
=
false
;
private
final
INavigatorModelView
view
;
private
static
final
ByteNumberFormat
numberFormat
=
new
ByteNumberFormat
();
...
...
@@ -136,6 +140,17 @@ public class StatisticsNavigatorNodeRenderer extends DefaultNavigatorNodeRendere
}
}
@Override
public
void
performAction
(
DBNNode
node
,
Tree
tree
,
Event
event
,
boolean
defaultAction
)
{
if
(
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getBoolean
(
NavigatorPreferences
.
NAVIGATOR_SHOW_NODE_ACTIONS
))
{
// Detect active action
INavigatorNodeActionHandler
overActionButton
=
getActionButtonFor
(
node
,
tree
,
event
);
if
(
overActionButton
!=
null
)
{
overActionButton
.
handleNodeAction
(
view
,
node
,
event
,
defaultAction
);
}
}
}
private
String
getDetailsTipText
(
DBNNode
element
,
Tree
tree
,
Event
event
)
{
if
(
element
instanceof
DBNDatabaseNode
)
{
if
(
element
instanceof
DBNDataSource
)
{
...
...
@@ -282,8 +297,21 @@ public class StatisticsNavigatorNodeRenderer extends DefaultNavigatorNodeRendere
// event.height * 2 / 3;
xPos
-=
imageSize
;
widthOccupied
+=
imageSize
;
//gc.fillRectangle(xPos, event.y + (event.height - imageSize) / 2, imageBounds.width, imageBounds.height);
Point
mousePos
=
tree
.
getDisplay
().
getCursorLocation
();
Point
itemPos
=
tree
.
toDisplay
(
xPos
,
event
.
y
+
(
event
.
height
-
imageSize
)
/
2
);
if
(
PAINT_ACTION_HOVER
)
{
if
(
mousePos
.
x
>=
itemPos
.
x
-
1
&&
mousePos
.
x
<=
itemPos
.
x
+
imageBounds
.
width
+
2
&&
mousePos
.
y
>
itemPos
.
y
-
1
&&
mousePos
.
y
<
itemPos
.
y
+
imageBounds
.
height
+
2
)
{
Color
oldBackground
=
gc
.
getBackground
();
Color
overBG
=
UIUtils
.
getSharedColor
(
new
RGB
(
200
,
200
,
255
));
gc
.
setBackground
(
overBG
);
gc
.
fillRoundRectangle
(
xPos
-
1
,
event
.
y
+
(
event
.
height
-
imageSize
)
/
2
-
1
,
imageBounds
.
width
+
2
,
imageBounds
.
height
+
2
,
2
,
2
);
gc
.
setBackground
(
oldBackground
);
}
}
gc
.
drawImage
(
image
,
xPos
,
event
.
y
+
(
event
.
height
-
imageSize
)
/
2
);
// gc.drawImage(image,
// 0, 0, imageBounds.width, imageBounds.height,
// xPos, event.y + (event.height - imageSize) / 2, imageBounds.width, imageBounds.height);
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/ICompositeDialogPageContainer.java
0 → 100644
浏览文件 @
26b08ebd
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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
;
import
org.eclipse.jface.dialogs.IDialogPage
;
/**
* ICompositeDialogPageContainer
*/
public
interface
ICompositeDialogPageContainer
extends
ICompositeDialogPage
{
void
showSubPage
(
IDialogPage
subPage
);
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/dialogs/DialogUtils.java
浏览文件 @
26b08ebd
...
...
@@ -16,10 +16,13 @@
*/
package
org.jkiss.dbeaver.ui.dialogs
;
import
org.eclipse.jface.viewers.TreeViewer
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.ModifyListener
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.dialogs.FilteredTree
;
import
org.eclipse.ui.dialogs.PatternFilter
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.Log
;
...
...
@@ -188,4 +191,20 @@ public class DialogUtils {
return
directoryText
.
getTextControl
();
}
public
static
TreeViewer
createFilteredTree
(
Composite
parent
,
int
treeStyle
,
PatternFilter
filter
,
String
initialText
)
{
FilteredTree
filteredTree
;
try
{
filteredTree
=
new
FilteredTree
(
parent
,
treeStyle
,
filter
,
true
,
true
);
}
catch
(
Throwable
e
)
{
// Fast hash lookup is not supported on old Eclipse versions. Use old constructor
filteredTree
=
new
FilteredTree
(
parent
,
treeStyle
,
filter
,
true
);
}
if
(
initialText
!=
null
)
{
filteredTree
.
setInitialText
(
initialText
);
}
return
filteredTree
.
getViewer
();
}
}
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/dialogs/MultiPageWizardDialog.java
浏览文件 @
26b08ebd
...
...
@@ -41,6 +41,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import
org.eclipse.ui.IWorkbenchWizard
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.ICompositeDialogPage
;
import
org.jkiss.dbeaver.ui.ICompositeDialogPageContainer
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.preferences.PreferenceStoreDelegate
;
import
org.jkiss.utils.ArrayUtils
;
...
...
@@ -209,17 +210,17 @@ public class MultiPageWizardDialog extends TitleAreaDialog implements IWizardCon
}
private
void
changePage
()
{
TreeItem
[]
selection
=
pagesTree
.
getSelection
();
if
(
selection
.
length
!=
1
)
{
return
;
}
TreeItem
newItem
=
selection
[
0
];
if
(
prevPage
==
newItem
.
getData
())
{
return
;
}
pageArea
.
setRedraw
(
false
);
try
{
TreeItem
[]
selection
=
pagesTree
.
getSelection
();
if
(
selection
.
length
!=
1
)
{
return
;
}
TreeItem
newItem
=
selection
[
0
];
if
(
prevPage
==
newItem
.
getData
())
{
return
;
}
GridData
gd
;
if
(
prevPage
!=
null
)
{
gd
=
(
GridData
)
prevPage
.
getControl
().
getLayoutData
();
...
...
@@ -254,9 +255,6 @@ public class MultiPageWizardDialog extends TitleAreaDialog implements IWizardCon
gd
=
(
GridData
)
pageControl
.
getLayoutData
();
gd
.
exclude
=
false
;
page
.
setVisible
(
true
);
if
(
page
instanceof
ActiveWizardPage
)
{
((
ActiveWizardPage
)
page
).
activatePage
();
}
}
setTitle
(
page
.
getTitle
());
...
...
@@ -306,7 +304,20 @@ public class MultiPageWizardDialog extends TitleAreaDialog implements IWizardCon
if
(
item
.
getData
()
==
page
)
{
pagesTree
.
setSelection
(
item
);
changePage
();
break
;
return
;
}
if
(
item
.
getData
()
instanceof
ICompositeDialogPageContainer
)
{
IDialogPage
[]
subPages
=
((
ICompositeDialogPageContainer
)
item
.
getData
()).
getSubPages
(
false
,
false
);
if
(!
ArrayUtils
.
isEmpty
(
subPages
))
{
for
(
IDialogPage
subPage
:
subPages
)
{
if
(
subPage
==
page
)
{
pagesTree
.
setSelection
(
item
);
changePage
();
((
ICompositeDialogPageContainer
)
item
.
getData
()).
showSubPage
(
page
);
return
;
}
}
}
}
for
(
TreeItem
child
:
item
.
getItems
())
{
if
(
child
.
getData
()
==
page
)
{
...
...
@@ -396,4 +407,7 @@ public class MultiPageWizardDialog extends TitleAreaDialog implements IWizardCon
}
}
protected
void
showPage
(
String
pageName
)
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录