Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
0ff5509d
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,发现更多精彩内容 >>
未验证
提交
0ff5509d
编写于
4月 28, 2020
作者:
S
Serge Rider
提交者:
GitHub
4月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8573 from dbeaver/ref#8562
#8562 part of plugin ext.db2 moved in ext.db2.ui
上级
390d1206
0a68cf4a
变更
31
展开全部
隐藏空白更改
内联
并排
Showing
31 changed file
with
2035 addition
and
1778 deletion
+2035
-1778
features/org.jkiss.dbeaver.db.feature/feature.xml
features/org.jkiss.dbeaver.db.feature/feature.xml
+1
-0
features/org.jkiss.dbeaver.db.ui.feature/feature.xml
features/org.jkiss.dbeaver.db.ui.feature/feature.xml
+1
-1
plugins/org.jkiss.dbeaver.ext.db2.ui/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.ext.db2.ui/META-INF/MANIFEST.MF
+21
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/OSGI-INF/l10n/bundle_ru.properties
...iss.dbeaver.ext.db2.ui/OSGI-INF/l10n/bundle_ru.properties
+20
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/build.properties
plugins/org.jkiss.dbeaver.ext.db2.ui/build.properties
+8
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/icons/db2_icon.png
plugins/org.jkiss.dbeaver.ext.db2.ui/icons/db2_icon.png
+0
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/plugin.xml
plugins/org.jkiss.dbeaver.ext.db2.ui/plugin.xml
+114
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/pom.xml
plugins/org.jkiss.dbeaver.ext.db2.ui/pom.xml
+14
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/Activator.java
...xt.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/Activator.java
+85
-85
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/editors/DB2RoutineDDLEditor.java
...jkiss/dbeaver/ext/db2/ui/editors/DB2RoutineDDLEditor.java
+2
-1
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/internal/DB2Messages.java
...rc/org/jkiss/dbeaver/ext/db2/ui/internal/DB2Messages.java
+119
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/DB2ToolShowError.java
.../org/jkiss/dbeaver/ext/db2/ui/tools/DB2ToolShowError.java
+45
-45
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/DB2ToolShowErrorDialog.java
...kiss/dbeaver/ext/db2/ui/tools/DB2ToolShowErrorDialog.java
+137
-137
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2BaseTableToolDialog.java
.../ext/db2/ui/tools/maintenance/DB2BaseTableToolDialog.java
+116
-116
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2ReorgCheckTableDialog.java
...xt/db2/ui/tools/maintenance/DB2ReorgCheckTableDialog.java
+64
-64
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2ReorgCheckTableTool.java
.../ext/db2/ui/tools/maintenance/DB2ReorgCheckTableTool.java
+45
-45
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2ReorgIndexDialog.java
...ver/ext/db2/ui/tools/maintenance/DB2ReorgIndexDialog.java
+129
-129
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2ReorgIndexTool.java
...eaver/ext/db2/ui/tools/maintenance/DB2ReorgIndexTool.java
+45
-45
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2ReorgTableDialog.java
...ver/ext/db2/ui/tools/maintenance/DB2ReorgTableDialog.java
+392
-392
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2ReorgTableTool.java
...eaver/ext/db2/ui/tools/maintenance/DB2ReorgTableTool.java
+45
-45
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2RunstatsDialog.java
...eaver/ext/db2/ui/tools/maintenance/DB2RunstatsDialog.java
+158
-158
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2RunstatsTool.java
...dbeaver/ext/db2/ui/tools/maintenance/DB2RunstatsTool.java
+45
-45
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2TruncateDialog.java
...eaver/ext/db2/ui/tools/maintenance/DB2TruncateDialog.java
+121
-121
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/tools/maintenance/DB2TruncateTool.java
...dbeaver/ext/db2/ui/tools/maintenance/DB2TruncateTool.java
+49
-49
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/views/DB2ConnectionPage.java
...org/jkiss/dbeaver/ext/db2/ui/views/DB2ConnectionPage.java
+3
-3
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/views/DB2ConnectionTracePage.java
...kiss/dbeaver/ext/db2/ui/views/DB2ConnectionTracePage.java
+204
-204
plugins/org.jkiss.dbeaver.ext.db2.ui/templates/db2-templates.properties
...iss.dbeaver.ext.db2.ui/templates/db2-templates.properties
+0
-0
plugins/org.jkiss.dbeaver.ext.db2.ui/templates/db2-templates.xml
.../org.jkiss.dbeaver.ext.db2.ui/templates/db2-templates.xml
+50
-0
plugins/org.jkiss.dbeaver.ext.db2/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.ext.db2/META-INF/MANIFEST.MF
+0
-4
plugins/org.jkiss.dbeaver.ext.db2/plugin.xml
plugins/org.jkiss.dbeaver.ext.db2/plugin.xml
+0
-88
plugins/pom.xml
plugins/pom.xml
+2
-1
未找到文件。
features/org.jkiss.dbeaver.db.feature/feature.xml
浏览文件 @
0ff5509d
...
...
@@ -27,6 +27,7 @@
<plugin
id=
"org.jkiss.dbeaver.ext.athena"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.bigquery"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.clickhouse"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.db2"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"true"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.db2.zos"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.db2.i"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.derby"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
...
...
features/org.jkiss.dbeaver.db.ui.feature/feature.xml
浏览文件 @
0ff5509d
...
...
@@ -20,7 +20,7 @@
<includes
id=
"org.jkiss.dbeaver.db.feature"
version=
"0.0.0"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.mysql.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.db2"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"true"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.db2
.ui
"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"true"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.exasol"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.mssql.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.oracle.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
...
...
plugins/org.jkiss.dbeaver.ext.db2.ui/META-INF/MANIFEST.MF
0 → 100644
浏览文件 @
0ff5509d
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jkiss.dbeaver.ext.db2.ui;singleton:=true
Bundle-Version: 1.0.1.qualifier
Bundle-Release-Date: 20200504
Bundle-Activator: org.jkiss.dbeaver.ext.db2.ui.Activator
Require-Bundle: org.eclipse.ui,
org.jkiss.dbeaver.ui.editors.connection,
org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ui.editors.data,
org.jkiss.dbeaver.ui.editors.acl,
org.jkiss.dbeaver.ui.editors.sql,
org.jkiss.dbeaver.tasks.ui,
org.jkiss.dbeaver.ext.db2
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: OSGI-INF/l10n/bundle
Automatic-Module-Name: org.jkiss.dbeaver.ext.db2.ui
Import-Package: org.jkiss.dbeaver.ui.editors.object.struct
plugins/org.jkiss.dbeaver.ext.db2.ui/OSGI-INF/l10n/bundle_ru.properties
0 → 100644
浏览文件 @
0ff5509d
# DBeaver - Universal Database Manager
# Copyright (C) 2013-2016 Denis Forveille titou10.titou10@gmail.com
# Copyright (C) 2010-2020 DBeaver Corp and others serge@jkiss.org
Bundle-Vendor
=
JKISS
Bundle-Name
=
DBeaver DB2 UI
dialog.connection.header
=
DB2 Connection Settings
editor.source.ddl.name
=
DDL
editor.source.ddl.description
=
DDL
tool.org.jkiss.dbeaver.ext.db2.table.reorg.name
=
Reorg Table...
tool.org.jkiss.dbeaver.ext.db2.table.reorgix.name
=
Reorg Index...
tool.org.jkiss.dbeaver.ext.db2.table.reorgcheck.name
=
Reorg Check (Table)...
tool.org.jkiss.dbeaver.ext.db2.table.reorgcheckix.name
=
Reorg Check (Indexes)...
tool.org.jkiss.dbeaver.ext.db2.table.setintegrity.name
=
Set Integrity...
tool.org.jkiss.dbeaver.ext.db2.table.runstats.name
=
Runstats...
tool.org.jkiss.dbeaver.ext.db2.table.truncate.name
=
Truncate...
tool.org.jkiss.dbeaver.ext.db2.showerror.name
=
Retrieve SQL Error Message...
\ No newline at end of file
plugins/org.jkiss.dbeaver.ext.db2.ui/build.properties
0 → 100644
浏览文件 @
0ff5509d
source..
=
src/
output..
=
target/classes/
bin.includes
=
plugin.xml,
\
META-INF/,
\
OSGI-INF/,
\
.,
\
icons/,
\
templates/
plugins/org.jkiss.dbeaver.ext.db2.ui/icons/db2_icon.png
0 → 100644
浏览文件 @
0ff5509d
3.3 KB
plugins/org.jkiss.dbeaver.ext.db2.ui/plugin.xml
0 → 100644
浏览文件 @
0ff5509d
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2014 Denis Forveille (titou10.titou10@gmail.com)
* 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.
-->
<plugin>
<extension
point=
"org.jkiss.dbeaver.dataSourceView"
>
<view
id=
"org.jkiss.dbeaver.ext.db2.dataSourceWizardView"
dataSource=
"db2"
targetID=
"org.jkiss.dbeaver.ext.ui.newConnectionWizard"
label=
"%dialog.connection.header"
class=
"org.jkiss.dbeaver.ext.db2.ui.views.DB2ConnectionPage"
icon=
"icons/db2_icon.png"
>
</view>
<view
id=
"org.jkiss.dbeaver.ext.db2.dataSourceEditorView"
dataSource=
"db2"
targetID=
"org.jkiss.dbeaver.ext.ui.editConnectionDialog"
label=
"%dialog.connection.header"
class=
"org.jkiss.dbeaver.ext.db2.ui.views.DB2ConnectionPage"
>
</view>
</extension>
<extension
point=
"org.jkiss.dbeaver.databaseEditor"
>
<editor
id=
"source.routine.ddl"
class=
"org.jkiss.dbeaver.ext.db2.ui.editors.DB2RoutineDDLEditor"
label=
"%editor.source.ddl.name"
description=
"%editor.source.ddl.description"
icon=
"#sql_text"
position=
"additions_middle"
contributor=
"org.jkiss.dbeaver.ui.editors.sql.SQLEditorContributorNested"
type=
"folder"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Routine"
/>
</editor>
</extension>
<extension
point=
"org.jkiss.dbeaver.tools"
>
<tools>
<toolGroup
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance"
label=
"Statistics"
/>
<tool
class=
"org.jkiss.dbeaver.ext.db2.ui.tools.DB2ToolShowError"
description=
"Display SQL Error Message"
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.DB2ToolShowError"
label=
"%tool.org.jkiss.dbeaver.ext.db2.showerror.name"
singleton=
"true"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2DataSource"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2RunstatsTool"
description=
"Runstats"
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2RunstatsTool"
group=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.runstats.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2ReorgTableTool"
description=
"Reorg table"
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2ReorgTableTool"
group=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.reorg.name"
singleton=
"true"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2ReorgIndexTool"
description=
"Reorg index"
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2ReorgIndexTool"
group=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.reorgix.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2ReorgCheckTableTool"
description=
"Reorg check table"
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2ReorgCheckTableTool"
group=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.reorgcheck.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2TruncateTool"
description=
"Truncate table"
id=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance.DB2Truncate"
group=
"org.jkiss.dbeaver.ext.db2.ui.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.truncate.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
</tools>
</extension>
</plugin>
plugins/org.jkiss.dbeaver.ext.db2.ui/pom.xml
0 → 100644
浏览文件 @
0ff5509d
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.jkiss.dbeaver
</groupId>
<artifactId>
plugins
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<relativePath>
../
</relativePath>
</parent>
<artifactId>
org.jkiss.dbeaver.ext.db2.ui
</artifactId>
<version>
1.0.1-SNAPSHOT
</version>
<packaging>
eclipse-plugin
</packaging>
</project>
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/Activator.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/Activator.java
浏览文件 @
0ff5509d
/*
* 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.ext.db2
;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.eclipse.ui.plugin.AbstractUIPlugin
;
import
org.osgi.framework.BundleContext
;
/**
* The activator class controls the plug-in life cycle
*/
public
class
Activator
extends
AbstractUIPlugin
{
// The plug-in ID
public
static
final
String
PLUGIN_ID
=
"org.jkiss.dbeaver.ext.db2"
;
// The shared instance
private
static
Activator
plugin
;
/**
* The constructor
*/
public
Activator
()
{
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
public
void
start
(
BundleContext
context
)
throws
Exception
{
super
.
start
(
context
);
plugin
=
this
;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public
void
stop
(
BundleContext
context
)
throws
Exception
{
plugin
=
null
;
super
.
stop
(
context
);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public
static
Activator
getDefault
()
{
return
plugin
;
}
/**
* Returns an image descriptor for the image file at the given plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public
static
ImageDescriptor
getImageDescriptor
(
String
path
)
{
return
imageDescriptorFromPlugin
(
PLUGIN_ID
,
path
);
}
}
/*
* 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.ext.db2
.ui
;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.eclipse.ui.plugin.AbstractUIPlugin
;
import
org.osgi.framework.BundleContext
;
/**
* The activator class controls the plug-in life cycle
*/
public
class
Activator
extends
AbstractUIPlugin
{
// The plug-in ID
public
static
final
String
PLUGIN_ID
=
"org.jkiss.dbeaver.ext.db2"
;
// The shared instance
private
static
Activator
plugin
;
/**
* The constructor
*/
public
Activator
()
{
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
public
void
start
(
BundleContext
context
)
throws
Exception
{
super
.
start
(
context
);
plugin
=
this
;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public
void
stop
(
BundleContext
context
)
throws
Exception
{
plugin
=
null
;
super
.
stop
(
context
);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public
static
Activator
getDefault
()
{
return
plugin
;
}
/**
* Returns an image descriptor for the image file at the given plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public
static
ImageDescriptor
getImageDescriptor
(
String
path
)
{
return
imageDescriptorFromPlugin
(
PLUGIN_ID
,
path
);
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/editors/DB2RoutineDDLEditor.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/editors/DB2RoutineDDLEditor.java
浏览文件 @
0ff5509d
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.db2.editors
;
package
org.jkiss.dbeaver.ext.db2.
ui.
editors
;
import
org.eclipse.jface.action.ControlContribution
;
import
org.eclipse.jface.action.IContributionManager
;
...
...
@@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Combo;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.jkiss.dbeaver.ext.db2.DB2Constants
;
import
org.jkiss.dbeaver.ext.db2.editors.DB2DDLFormat
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Routine
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLSourceViewer
;
...
...
plugins/org.jkiss.dbeaver.ext.db2.ui/src/org/jkiss/dbeaver/ext/db2/ui/internal/DB2Messages.java
0 → 100644
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
* Copyright (C) 2011-2012 Eugene Fradkin (eugene.fradkin@gmail.com)
*
* 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.ext.db2.ui.internal
;
import
org.eclipse.osgi.util.NLS
;
public
class
DB2Messages
extends
NLS
{
static
final
String
BUNDLE_NAME
=
"org.jkiss.dbeaver.ext.db2.DB2Resources"
;
//$NON-NLS-1$
static
{
// initialize resource bundle
NLS
.
initializeMessages
(
BUNDLE_NAME
,
DB2Messages
.
class
);
}
private
DB2Messages
()
{
// Pure Utility Class
}
public
static
String
db2_connection_page_tab_database
;
public
static
String
db2_connection_page_tab_security
;
public
static
String
db2_connection_trace_page_checkbox_append
;
public
static
String
db2_connection_trace_page_checkbox_connect
;
public
static
String
db2_connection_trace_page_checkbox_connection_calls
;
public
static
String
db2_connection_trace_page_checkbox_diagnostics
;
public
static
String
db2_connection_trace_page_checkbox_drda_flows
;
public
static
String
db2_connection_trace_page_checkbox_driver_configuration
;
public
static
String
db2_connection_trace_page_checkbox_enable_trace
;
public
static
String
db2_connection_trace_page_checkbox_parameter_metadata
;
public
static
String
db2_connection_trace_page_checkbox_result_set_calls
;
public
static
String
db2_connection_trace_page_checkbox_result_set_metadata
;
public
static
String
db2_connection_trace_page_checkbox_sql_j
;
public
static
String
db2_connection_trace_page_checkbox_statement_calls
;
public
static
String
db2_connection_trace_page_checkbox_xa_calls
;
public
static
String
db2_connection_trace_page_header_levels
;
public
static
String
db2_connection_trace_page_label_file_name
;
public
static
String
db2_connection_trace_page_label_folder
;
public
static
String
db2_connection_trace_page_string_trace
;
public
static
String
db2_connection_trace_page_tab_description_trace_settings
;
public
static
String
db2_connection_trace_page_tab_trace_settings
;
public
static
String
dialog_connection_host
;
public
static
String
dialog_connection_password
;
public
static
String
dialog_connection_port
;
public
static
String
dialog_connection_database
;
public
static
String
dialog_connection_user_name
;
public
static
String
dialog_table_tools_options
;
public
static
String
dialog_table_tools_result
;
public
static
String
dialog_table_tools_progress
;
public
static
String
dialog_table_tools_runstats_title
;
public
static
String
dialog_table_tools_runstats_cols_title
;
public
static
String
dialog_table_tools_runstats_cols_all
;
public
static
String
dialog_table_tools_runstats_cols_all_and_distribution
;
public
static
String
dialog_table_tools_runstats_cols_no
;
public
static
String
dialog_table_tools_runstats_indexes_title
;
public
static
String
dialog_table_tools_runstats_indexes_detailed
;
public
static
String
dialog_table_tools_runstats_indexes_all
;
public
static
String
dialog_table_tools_runstats_indexes_no
;
public
static
String
dialog_table_tools_runstats_stats_title
;
public
static
String
dialog_table_tools_reorg_title
;
public
static
String
dialog_table_tools_reorg_inplace
;
public
static
String
dialog_table_tools_reorg_useindex
;
public
static
String
dialog_table_tools_reorg_useindexscan
;
public
static
String
dialog_table_tools_reorg_truncate
;
public
static
String
dialog_table_tools_reorg_usetempts
;
public
static
String
dialog_table_tools_reorg_reorglobs
;
public
static
String
dialog_table_tools_reorg_reorglobsts
;
public
static
String
dialog_table_tools_reorg_resetdict
;
public
static
String
dialog_table_tools_reorg_access_title
;
public
static
String
dialog_table_tools_reorg_access_no
;
public
static
String
dialog_table_tools_reorg_access_read
;
public
static
String
dialog_table_tools_reorg_access_readwrite
;
public
static
String
dialog_table_tools_reorgix_access_title
;
public
static
String
dialog_table_tools_reorgix_access_default
;
public
static
String
dialog_table_tools_reorgix_access_no
;
public
static
String
dialog_table_tools_reorgix_access_read
;
public
static
String
dialog_table_tools_reorgix_access_readwrite
;
public
static
String
dialog_table_tools_reorgix_options_title
;
public
static
String
dialog_table_tools_reorgix_options_full
;
public
static
String
dialog_table_tools_reorgix_options_cleanup_keys
;
public
static
String
dialog_table_tools_reorgix_options_cleanup_pages
;
public
static
String
dialog_table_tools_reorgcheck_title
;
public
static
String
dialog_table_tools_truncate_title
;
public
static
String
dialog_table_tools_truncate_storage_title
;
public
static
String
dialog_table_tools_truncate_storage_reuse
;
public
static
String
dialog_table_tools_truncate_storage_drop
;
public
static
String
dialog_table_tools_truncate_triggers_title
;
public
static
String
dialog_table_tools_truncate_triggers_ignore
;
public
static
String
dialog_table_tools_truncate_triggers_restrict
;
public
static
String
dialog_tools_msg_title
;
public
static
String
dialog_tools_msg_code
;
public
static
String
dialog_tools_mes_error_code_title
;
public
static
String
dialog_tools_mes_error_code
;
public
static
String
dialog_tools_mes_message
;
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/DB2ToolShowError.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/DB2ToolShowError.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2DataSource
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
java.util.Collection
;
/**
* Manage the "Database/Tools" menu for DB2
*
* @author Denis Forveille
*/
public
class
DB2ToolShowError
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
for
(
DBSObject
object
:
objects
)
{
if
(
object
.
getDataSource
()
instanceof
DB2DataSource
)
{
DB2ToolShowErrorDialog
dialog
=
new
DB2ToolShowErrorDialog
(
window
,
(
DB2DataSource
)
object
.
getDataSource
());
dialog
.
open
();
}
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2DataSource
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
java.util.Collection
;
/**
* Manage the "Database/Tools" menu for DB2
*
* @author Denis Forveille
*/
public
class
DB2ToolShowError
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
for
(
DBSObject
object
:
objects
)
{
if
(
object
.
getDataSource
()
instanceof
DB2DataSource
)
{
DB2ToolShowErrorDialog
dialog
=
new
DB2ToolShowErrorDialog
(
window
,
(
DB2DataSource
)
object
.
getDataSource
());
dialog
.
open
();
}
}
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/DB2ToolShowErrorDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/DB2ToolShowErrorDialog.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools
;
import
org.eclipse.jface.dialogs.Dialog
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.DB2Utils
;
import
org.jkiss.dbeaver.ext.db2.model.DB2DataSource
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
/**
* Dialog to display the SQL message associated with an SQL Error Code
*
* @author Denis Forveille
*
*/
class
DB2ToolShowErrorDialog
extends
Dialog
{
private
final
DB2DataSource
db2DataSource
;
private
Text
textSqlErrorCode
;
private
Text
resultMessage
;
public
DB2ToolShowErrorDialog
(
IWorkbenchWindow
window
,
DB2DataSource
db2DataSource
)
{
super
(
window
.
getShell
());
this
.
db2DataSource
=
db2DataSource
;
}
@Override
protected
void
configureShell
(
Shell
newShell
)
{
super
.
configureShell
(
newShell
);
newShell
.
setText
(
DB2Messages
.
dialog_tools_msg_title
);
}
@Override
protected
Button
createButton
(
Composite
parent
,
int
id
,
String
label
,
boolean
defaultButton
)
{
// Disable all default buttons
return
null
;
}
@Override
protected
Control
createDialogArea
(
Composite
parent
)
{
Composite
area
=
(
Composite
)
super
.
createDialogArea
(
parent
);
// -----------------------------------
// Line 1: Label + input code + button
// -----------------------------------
Composite
container1
=
UIUtils
.
createPlaceholder
(
area
,
3
,
5
);
// SQL Error Code
UIUtils
.
createLabel
(
container1
,
DB2Messages
.
dialog_tools_msg_code
);
textSqlErrorCode
=
new
Text
(
container1
,
SWT
.
BORDER
);
// Button
Button
button
=
new
Button
(
container1
,
SWT
.
PUSH
);
button
.
setText
(
"Retrieve Message"
);
button
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
Integer
sqlIntegerCode
=
0
;
try
{
sqlIntegerCode
=
Integer
.
valueOf
(
textSqlErrorCode
.
getText
());
}
catch
(
NumberFormatException
nfe
)
{
DBWorkbench
.
getPlatformUI
().
showError
(
DB2Messages
.
dialog_tools_mes_error_code_title
,
DB2Messages
.
dialog_tools_mes_error_code
);
return
;
}
try
{
String
msg
=
DB2Utils
.
getMessageFromCode
(
db2DataSource
,
sqlIntegerCode
);
resultMessage
.
setText
(
msg
);
}
catch
(
Exception
e1
)
{
// Most propably, there is no message for this code. tell this to the user..
resultMessage
.
setText
(
e1
.
getMessage
());
}
}
});
getShell
().
setDefaultButton
(
button
);
// -----------------------------------
// Line 2: Label for Message
// -----------------------------------
UIUtils
.
createControlLabel
(
container1
,
DB2Messages
.
dialog_tools_mes_message
);
// -----------------------------------
// Line 3: Message
// -----------------------------------
// Message
resultMessage
=
new
Text
(
container1
,
SWT
.
MULTI
|
SWT
.
BORDER
|
SWT
.
WRAP
|
SWT
.
V_SCROLL
);
resultMessage
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
resultMessage
.
setEditable
(
false
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
horizontalSpan
=
2
;
gd
.
widthHint
=
600
;
gd
.
heightHint
=
80
;
resultMessage
.
setLayoutData
(
gd
);
return
area
;
}
@Override
protected
boolean
isResizable
()
{
return
true
;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools
;
import
org.eclipse.jface.dialogs.Dialog
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.DB2Utils
;
import
org.jkiss.dbeaver.ext.db2.model.DB2DataSource
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
/**
* Dialog to display the SQL message associated with an SQL Error Code
*
* @author Denis Forveille
*
*/
class
DB2ToolShowErrorDialog
extends
Dialog
{
private
final
DB2DataSource
db2DataSource
;
private
Text
textSqlErrorCode
;
private
Text
resultMessage
;
public
DB2ToolShowErrorDialog
(
IWorkbenchWindow
window
,
DB2DataSource
db2DataSource
)
{
super
(
window
.
getShell
());
this
.
db2DataSource
=
db2DataSource
;
}
@Override
protected
void
configureShell
(
Shell
newShell
)
{
super
.
configureShell
(
newShell
);
newShell
.
setText
(
DB2Messages
.
dialog_tools_msg_title
);
}
@Override
protected
Button
createButton
(
Composite
parent
,
int
id
,
String
label
,
boolean
defaultButton
)
{
// Disable all default buttons
return
null
;
}
@Override
protected
Control
createDialogArea
(
Composite
parent
)
{
Composite
area
=
(
Composite
)
super
.
createDialogArea
(
parent
);
// -----------------------------------
// Line 1: Label + input code + button
// -----------------------------------
Composite
container1
=
UIUtils
.
createPlaceholder
(
area
,
3
,
5
);
// SQL Error Code
UIUtils
.
createLabel
(
container1
,
DB2Messages
.
dialog_tools_msg_code
);
textSqlErrorCode
=
new
Text
(
container1
,
SWT
.
BORDER
);
// Button
Button
button
=
new
Button
(
container1
,
SWT
.
PUSH
);
button
.
setText
(
"Retrieve Message"
);
button
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
Integer
sqlIntegerCode
=
0
;
try
{
sqlIntegerCode
=
Integer
.
valueOf
(
textSqlErrorCode
.
getText
());
}
catch
(
NumberFormatException
nfe
)
{
DBWorkbench
.
getPlatformUI
().
showError
(
DB2Messages
.
dialog_tools_mes_error_code_title
,
DB2Messages
.
dialog_tools_mes_error_code
);
return
;
}
try
{
String
msg
=
DB2Utils
.
getMessageFromCode
(
db2DataSource
,
sqlIntegerCode
);
resultMessage
.
setText
(
msg
);
}
catch
(
Exception
e1
)
{
// Most propably, there is no message for this code. tell this to the user..
resultMessage
.
setText
(
e1
.
getMessage
());
}
}
});
getShell
().
setDefaultButton
(
button
);
// -----------------------------------
// Line 2: Label for Message
// -----------------------------------
UIUtils
.
createControlLabel
(
container1
,
DB2Messages
.
dialog_tools_mes_message
);
// -----------------------------------
// Line 3: Message
// -----------------------------------
// Message
resultMessage
=
new
Text
(
container1
,
SWT
.
MULTI
|
SWT
.
BORDER
|
SWT
.
WRAP
|
SWT
.
V_SCROLL
);
resultMessage
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
resultMessage
.
setEditable
(
false
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
horizontalSpan
=
2
;
gd
.
widthHint
=
600
;
gd
.
heightHint
=
80
;
resultMessage
.
setLayoutData
(
gd
);
return
area
;
}
@Override
protected
boolean
isResizable
()
{
return
true
;
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2BaseTableToolDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2BaseTableToolDialog.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Font
;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.swt.widgets.TreeColumn
;
import
org.eclipse.swt.widgets.TreeItem
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCResultSet
;
import
org.jkiss.dbeaver.model.exec.DBCStatement
;
import
org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCResultSetMetaDataImpl
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.dialogs.GenerateMultiSQLDialog
;
import
org.jkiss.dbeaver.ui.editors.sql.dialogs.SQLScriptProgressListener
;
import
org.jkiss.dbeaver.ui.editors.sql.dialogs.SQLScriptStatusDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.SQLException
;
import
java.util.Collection
;
/**
* Base Dialog for DB2 Tools Dialogs
*/
public
abstract
class
DB2BaseTableToolDialog
extends
GenerateMultiSQLDialog
<
DB2Table
>
{
public
DB2BaseTableToolDialog
(
IWorkbenchPartSite
partSite
,
String
title
,
Collection
<
DB2Table
>
objects
)
{
super
(
partSite
,
title
,
objects
,
true
);
}
protected
int
getNumberExtraResultingColumns
()
{
return
0
;
}
@Override
protected
SQLScriptProgressListener
<
DB2Table
>
getScriptListener
()
{
final
int
nbExtraColumns
=
getNumberExtraResultingColumns
();
return
new
SQLScriptStatusDialog
<
DB2Table
>(
getTitle
()
+
" "
+
DB2Messages
.
dialog_table_tools_progress
,
null
)
{
@Override
protected
void
createStatusColumns
(
Tree
objectTree
)
{
TreeColumn
msgColumn
=
new
TreeColumn
(
objectTree
,
SWT
.
NONE
);
msgColumn
.
setText
(
DB2Messages
.
dialog_table_tools_result
);
for
(
int
i
=
0
;
i
<
nbExtraColumns
;
i
++)
{
new
TreeColumn
(
objectTree
,
SWT
.
NONE
);
}
}
// DF: This method is for tools that return resultsets
@Override
public
void
processObjectResults
(
@NotNull
DB2Table
db2Table
,
@Nullable
DBCStatement
statement
,
@Nullable
DBCResultSet
resultSet
)
throws
DBCException
{
if
(
resultSet
==
null
)
{
return
;
}
// Retrive column names
JDBCResultSetMetaDataImpl
rsMetaData
=
(
JDBCResultSetMetaDataImpl
)
resultSet
.
getMeta
();
try
{
TreeItem
treeItem
=
getTreeItem
(
db2Table
);
Font
f
=
UIUtils
.
makeBoldFont
(
treeItem
.
getFont
());
if
(
treeItem
!=
null
)
{
// Display the column names
TreeItem
subItem
=
null
;
subItem
=
new
TreeItem
(
treeItem
,
SWT
.
NONE
);
subItem
.
setFont
(
f
);
for
(
int
i
=
0
;
i
<
rsMetaData
.
getColumnCount
();
i
++)
{
subItem
.
setText
(
i
,
rsMetaData
.
getColumnName
(
i
+
1
));
subItem
.
setGrayed
(
true
);
}
// Display the data for each row
while
(
resultSet
.
nextRow
())
{
subItem
=
new
TreeItem
(
treeItem
,
SWT
.
NONE
);
for
(
int
i
=
0
;
i
<
rsMetaData
.
getColumnCount
();
i
++)
{
subItem
.
setText
(
i
,
CommonUtils
.
toString
(
resultSet
.
getAttributeValue
(
i
)));
}
}
treeItem
.
setExpanded
(
true
);
}
}
catch
(
SQLException
e
)
{
throw
new
DBCException
(
e
.
getMessage
());
}
}
};
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Font
;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.swt.widgets.TreeColumn
;
import
org.eclipse.swt.widgets.TreeItem
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCResultSet
;
import
org.jkiss.dbeaver.model.exec.DBCStatement
;
import
org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCResultSetMetaDataImpl
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.dialogs.GenerateMultiSQLDialog
;
import
org.jkiss.dbeaver.ui.editors.sql.dialogs.SQLScriptProgressListener
;
import
org.jkiss.dbeaver.ui.editors.sql.dialogs.SQLScriptStatusDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.SQLException
;
import
java.util.Collection
;
/**
* Base Dialog for DB2 Tools Dialogs
*/
public
abstract
class
DB2BaseTableToolDialog
extends
GenerateMultiSQLDialog
<
DB2Table
>
{
public
DB2BaseTableToolDialog
(
IWorkbenchPartSite
partSite
,
String
title
,
Collection
<
DB2Table
>
objects
)
{
super
(
partSite
,
title
,
objects
,
true
);
}
protected
int
getNumberExtraResultingColumns
()
{
return
0
;
}
@Override
protected
SQLScriptProgressListener
<
DB2Table
>
getScriptListener
()
{
final
int
nbExtraColumns
=
getNumberExtraResultingColumns
();
return
new
SQLScriptStatusDialog
<
DB2Table
>(
getTitle
()
+
" "
+
DB2Messages
.
dialog_table_tools_progress
,
null
)
{
@Override
protected
void
createStatusColumns
(
Tree
objectTree
)
{
TreeColumn
msgColumn
=
new
TreeColumn
(
objectTree
,
SWT
.
NONE
);
msgColumn
.
setText
(
DB2Messages
.
dialog_table_tools_result
);
for
(
int
i
=
0
;
i
<
nbExtraColumns
;
i
++)
{
new
TreeColumn
(
objectTree
,
SWT
.
NONE
);
}
}
// DF: This method is for tools that return resultsets
@Override
public
void
processObjectResults
(
@NotNull
DB2Table
db2Table
,
@Nullable
DBCStatement
statement
,
@Nullable
DBCResultSet
resultSet
)
throws
DBCException
{
if
(
resultSet
==
null
)
{
return
;
}
// Retrive column names
JDBCResultSetMetaDataImpl
rsMetaData
=
(
JDBCResultSetMetaDataImpl
)
resultSet
.
getMeta
();
try
{
TreeItem
treeItem
=
getTreeItem
(
db2Table
);
Font
f
=
UIUtils
.
makeBoldFont
(
treeItem
.
getFont
());
if
(
treeItem
!=
null
)
{
// Display the column names
TreeItem
subItem
=
null
;
subItem
=
new
TreeItem
(
treeItem
,
SWT
.
NONE
);
subItem
.
setFont
(
f
);
for
(
int
i
=
0
;
i
<
rsMetaData
.
getColumnCount
();
i
++)
{
subItem
.
setText
(
i
,
rsMetaData
.
getColumnName
(
i
+
1
));
subItem
.
setGrayed
(
true
);
}
// Display the data for each row
while
(
resultSet
.
nextRow
())
{
subItem
=
new
TreeItem
(
treeItem
,
SWT
.
NONE
);
for
(
int
i
=
0
;
i
<
rsMetaData
.
getColumnCount
();
i
++)
{
subItem
.
setText
(
i
,
CommonUtils
.
toString
(
resultSet
.
getAttributeValue
(
i
)));
}
}
treeItem
.
setExpanded
(
true
);
}
}
catch
(
SQLException
e
)
{
throw
new
DBCException
(
e
.
getMessage
());
}
}
};
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2ReorgCheckTableDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2ReorgCheckTableDialog.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table Reorg Check dialog
*/
public
class
DB2ReorgCheckTableDialog
extends
DB2BaseTableToolDialog
{
private
static
final
int
NB_RESULT_COLS
=
12
;
public
DB2ReorgCheckTableDialog
(
IWorkbenchPartSite
partSite
,
final
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_reorgcheck_title
,
selectedTables
);
}
@Override
protected
int
getNumberExtraResultingColumns
()
{
return
NB_RESULT_COLS
;
}
@Override
protected
void
createControls
(
Composite
parent
)
{
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
128
);
sb
.
append
(
"CALL SYSPROC.REORGCHK_TB_STATS('T','"
);
sb
.
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
));
sb
.
append
(
"')"
);
lines
.
add
(
sb
.
toString
());
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table Reorg Check dialog
*/
public
class
DB2ReorgCheckTableDialog
extends
DB2BaseTableToolDialog
{
private
static
final
int
NB_RESULT_COLS
=
12
;
public
DB2ReorgCheckTableDialog
(
IWorkbenchPartSite
partSite
,
final
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_reorgcheck_title
,
selectedTables
);
}
@Override
protected
int
getNumberExtraResultingColumns
()
{
return
NB_RESULT_COLS
;
}
@Override
protected
void
createControls
(
Composite
parent
)
{
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
128
);
sb
.
append
(
"CALL SYSPROC.REORGCHK_TB_STATS('T','"
);
sb
.
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
));
sb
.
append
(
"')"
);
lines
.
add
(
sb
.
toString
());
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2ReorgCheckTableTool.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2ReorgCheckTableTool.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table reorg action
*/
public
class
DB2ReorgCheckTableTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2ReorgCheckTableDialog
dialog
=
new
DB2ReorgCheckTableDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table reorg action
*/
public
class
DB2ReorgCheckTableTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2ReorgCheckTableDialog
dialog
=
new
DB2ReorgCheckTableDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2ReorgIndexDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2ReorgIndexDialog.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table reorg index dialog
*/
public
class
DB2ReorgIndexDialog
extends
DB2BaseTableToolDialog
{
private
Button
dlgAccessNo
;
private
Button
dlgAccessReadOnly
;
private
Button
dlgAccessReadWrite
;
private
Button
dlgCleanupKeysAndpages
;
private
Button
dlgCleanupPagesOnly
;
public
DB2ReorgIndexDialog
(
IWorkbenchPartSite
partSite
,
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_runstats_title
,
selectedTables
);
}
@Override
protected
void
createControls
(
Composite
parent
)
{
Group
optionsGroup
=
UIUtils
.
createControlGroup
(
parent
,
DB2Messages
.
dialog_table_tools_options
,
1
,
0
,
0
);
optionsGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Composite
composite
=
new
Composite
(
optionsGroup
,
2
);
composite
.
setLayout
(
new
GridLayout
(
2
,
false
));
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
// REORG ACCESS
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_reorgix_access_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupAccess
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupAccess
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
Button
dlgAccessDefault
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessDefault
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_default
);
dlgAccessDefault
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgAccessNo
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessNo
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_no
);
dlgAccessNo
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgAccessReadOnly
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessReadOnly
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_read
);
dlgAccessReadOnly
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgAccessReadWrite
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessReadWrite
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_readwrite
);
dlgAccessReadWrite
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// PAGE CLEANUP
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_reorgix_options_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupCleanup
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupCleanup
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
Button
dlgFullIndex
=
new
Button
(
groupCleanup
,
SWT
.
RADIO
);
dlgFullIndex
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_options_full
);
dlgFullIndex
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgFullIndex
.
setSelection
(
true
);
dlgCleanupKeysAndpages
=
new
Button
(
groupCleanup
,
SWT
.
RADIO
);
dlgCleanupKeysAndpages
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_options_cleanup_keys
);
dlgCleanupKeysAndpages
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgCleanupPagesOnly
=
new
Button
(
groupCleanup
,
SWT
.
RADIO
);
dlgCleanupPagesOnly
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_options_cleanup_pages
);
dlgCleanupPagesOnly
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"CALL SYSPROC.ADMIN_CMD('"
);
sb
.
append
(
"REORG INDEXES ALL FOR TABLE "
).
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
));
if
(
dlgAccessNo
.
getSelection
())
{
sb
.
append
(
" ALLOW NO ACCESS"
);
}
if
(
dlgAccessReadOnly
.
getSelection
())
{
sb
.
append
(
" ALLOW READ ACCESS"
);
}
if
(
dlgAccessReadWrite
.
getSelection
())
{
sb
.
append
(
" ALLOW WRITE ACCESS"
);
}
if
(
dlgCleanupKeysAndpages
.
getSelection
())
{
sb
.
append
(
" CLEANUP ALL"
);
}
if
(
dlgCleanupPagesOnly
.
getSelection
())
{
sb
.
append
(
" CLEANUP PAGES"
);
}
sb
.
append
(
"')"
);
lines
.
add
(
sb
.
toString
());
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table reorg index dialog
*/
public
class
DB2ReorgIndexDialog
extends
DB2BaseTableToolDialog
{
private
Button
dlgAccessNo
;
private
Button
dlgAccessReadOnly
;
private
Button
dlgAccessReadWrite
;
private
Button
dlgCleanupKeysAndpages
;
private
Button
dlgCleanupPagesOnly
;
public
DB2ReorgIndexDialog
(
IWorkbenchPartSite
partSite
,
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_runstats_title
,
selectedTables
);
}
@Override
protected
void
createControls
(
Composite
parent
)
{
Group
optionsGroup
=
UIUtils
.
createControlGroup
(
parent
,
DB2Messages
.
dialog_table_tools_options
,
1
,
0
,
0
);
optionsGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Composite
composite
=
new
Composite
(
optionsGroup
,
2
);
composite
.
setLayout
(
new
GridLayout
(
2
,
false
));
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
// REORG ACCESS
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_reorgix_access_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupAccess
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupAccess
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
Button
dlgAccessDefault
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessDefault
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_default
);
dlgAccessDefault
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgAccessNo
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessNo
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_no
);
dlgAccessNo
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgAccessReadOnly
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessReadOnly
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_read
);
dlgAccessReadOnly
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgAccessReadWrite
=
new
Button
(
groupAccess
,
SWT
.
RADIO
);
dlgAccessReadWrite
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_access_readwrite
);
dlgAccessReadWrite
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// PAGE CLEANUP
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_reorgix_options_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupCleanup
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupCleanup
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
Button
dlgFullIndex
=
new
Button
(
groupCleanup
,
SWT
.
RADIO
);
dlgFullIndex
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_options_full
);
dlgFullIndex
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgFullIndex
.
setSelection
(
true
);
dlgCleanupKeysAndpages
=
new
Button
(
groupCleanup
,
SWT
.
RADIO
);
dlgCleanupKeysAndpages
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_options_cleanup_keys
);
dlgCleanupKeysAndpages
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgCleanupPagesOnly
=
new
Button
(
groupCleanup
,
SWT
.
RADIO
);
dlgCleanupPagesOnly
.
setText
(
DB2Messages
.
dialog_table_tools_reorgix_options_cleanup_pages
);
dlgCleanupPagesOnly
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"CALL SYSPROC.ADMIN_CMD('"
);
sb
.
append
(
"REORG INDEXES ALL FOR TABLE "
).
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
));
if
(
dlgAccessNo
.
getSelection
())
{
sb
.
append
(
" ALLOW NO ACCESS"
);
}
if
(
dlgAccessReadOnly
.
getSelection
())
{
sb
.
append
(
" ALLOW READ ACCESS"
);
}
if
(
dlgAccessReadWrite
.
getSelection
())
{
sb
.
append
(
" ALLOW WRITE ACCESS"
);
}
if
(
dlgCleanupKeysAndpages
.
getSelection
())
{
sb
.
append
(
" CLEANUP ALL"
);
}
if
(
dlgCleanupPagesOnly
.
getSelection
())
{
sb
.
append
(
" CLEANUP PAGES"
);
}
sb
.
append
(
"')"
);
lines
.
add
(
sb
.
toString
());
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2ReorgIndexTool.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2ReorgIndexTool.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table reorg index action
*/
public
class
DB2ReorgIndexTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2ReorgIndexDialog
dialog
=
new
DB2ReorgIndexDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table reorg index action
*/
public
class
DB2ReorgIndexTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2ReorgIndexDialog
dialog
=
new
DB2ReorgIndexDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2ReorgTableDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2ReorgTableDialog.java
浏览文件 @
0ff5509d
此差异已折叠。
点击以展开。
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2ReorgTableTool.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2ReorgTableTool.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table reorg action
*/
public
class
DB2ReorgTableTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2ReorgTableDialog
dialog
=
new
DB2ReorgTableDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table reorg action
*/
public
class
DB2ReorgTableTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2ReorgTableDialog
dialog
=
new
DB2ReorgTableDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2RunstatsDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2RunstatsDialog.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.graphics.Rectangle
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.swt.widgets.Spinner
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table runstats dialog
*/
public
class
DB2RunstatsDialog
extends
DB2BaseTableToolDialog
{
private
Button
dlgColsAllAndDistribution
;
private
Button
dlgColsAll
;
private
Button
dlgSample
;
private
Spinner
dlgSampleValue
;
private
Button
dlgIndexesDetailed
;
private
Button
dlgIndexesAll
;
public
DB2RunstatsDialog
(
IWorkbenchPartSite
partSite
,
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_runstats_title
,
selectedTables
);
}
@Override
protected
void
createControls
(
Composite
parent
)
{
Group
optionsGroup
=
UIUtils
.
createControlGroup
(
parent
,
DB2Messages
.
dialog_table_tools_options
,
1
,
0
,
0
);
optionsGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Composite
composite
=
new
Composite
(
optionsGroup
,
2
);
composite
.
setLayout
(
new
GridLayout
(
2
,
false
));
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
// RUNSTATS ON COLUMNS
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_runstats_cols_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupCols
=
new
Composite
(
composite
,
SWT
.
NONE
);
groupCols
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgColsAllAndDistribution
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgColsAllAndDistribution
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_cols_all_and_distribution
);
dlgColsAllAndDistribution
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgColsAll
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgColsAll
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_cols_all
);
dlgColsAll
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
Button
dlgColsNo
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgColsNo
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_cols_no
);
dlgColsNo
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// RUNSTATS ON INDEXES
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_runstats_indexes_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupIx
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupIx
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgIndexesDetailed
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgIndexesDetailed
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_indexes_detailed
);
dlgIndexesDetailed
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgIndexesAll
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgIndexesAll
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_indexes_all
);
dlgIndexesAll
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
Button
dlgIndexesNo
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgIndexesNo
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_indexes_no
);
dlgIndexesNo
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// SAMPLING
dlgSample
=
UIUtils
.
createCheckbox
(
composite
,
DB2Messages
.
dialog_table_tools_runstats_stats_title
,
false
);
dlgSample
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
dlgSampleValue
.
setEnabled
(
dlgSample
.
getSelection
());
updateSQL
();
}
});
dlgSampleValue
=
new
Spinner
(
composite
,
SWT
.
BORDER
);
dlgSampleValue
.
setMinimum
(
0
);
dlgSampleValue
.
setMaximum
(
100
);
dlgSampleValue
.
setIncrement
(
1
);
Rectangle
clientArea
=
getShell
().
getClientArea
();
dlgSampleValue
.
setLocation
(
clientArea
.
x
,
clientArea
.
y
);
dlgSampleValue
.
pack
();
dlgSampleValue
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Initial setup
dlgColsAllAndDistribution
.
setSelection
(
true
);
dlgIndexesDetailed
.
setSelection
(
true
);
dlgSampleValue
.
setSelection
(
0
);
dlgSampleValue
.
setEnabled
(
false
);
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"CALL SYSPROC.ADMIN_CMD('"
);
sb
.
append
(
"RUNSTATS ON TABLE "
).
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
));
if
(
dlgColsAllAndDistribution
.
getSelection
())
{
sb
.
append
(
" ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS"
);
}
if
(
dlgColsAll
.
getSelection
())
{
sb
.
append
(
" ON ALL COLUMNS"
);
}
if
(
dlgIndexesDetailed
.
getSelection
())
{
sb
.
append
(
" AND SAMPLED DETAILED INDEXES ALL"
);
}
if
(
dlgIndexesAll
.
getSelection
())
{
sb
.
append
(
" AND INDEXES ALL"
);
}
if
(
dlgSample
.
getSelection
())
{
sb
.
append
(
" TABLESAMPLE SYSTEM("
).
append
(
dlgSampleValue
.
getSelection
()).
append
(
")"
);
}
sb
.
append
(
"')"
);
lines
.
add
(
sb
.
toString
());
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.graphics.Rectangle
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.swt.widgets.Spinner
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 Table runstats dialog
*/
public
class
DB2RunstatsDialog
extends
DB2BaseTableToolDialog
{
private
Button
dlgColsAllAndDistribution
;
private
Button
dlgColsAll
;
private
Button
dlgSample
;
private
Spinner
dlgSampleValue
;
private
Button
dlgIndexesDetailed
;
private
Button
dlgIndexesAll
;
public
DB2RunstatsDialog
(
IWorkbenchPartSite
partSite
,
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_runstats_title
,
selectedTables
);
}
@Override
protected
void
createControls
(
Composite
parent
)
{
Group
optionsGroup
=
UIUtils
.
createControlGroup
(
parent
,
DB2Messages
.
dialog_table_tools_options
,
1
,
0
,
0
);
optionsGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Composite
composite
=
new
Composite
(
optionsGroup
,
2
);
composite
.
setLayout
(
new
GridLayout
(
2
,
false
));
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
// RUNSTATS ON COLUMNS
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_runstats_cols_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupCols
=
new
Composite
(
composite
,
SWT
.
NONE
);
groupCols
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgColsAllAndDistribution
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgColsAllAndDistribution
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_cols_all_and_distribution
);
dlgColsAllAndDistribution
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgColsAll
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgColsAll
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_cols_all
);
dlgColsAll
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
Button
dlgColsNo
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgColsNo
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_cols_no
);
dlgColsNo
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// RUNSTATS ON INDEXES
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_runstats_indexes_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupIx
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupIx
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgIndexesDetailed
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgIndexesDetailed
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_indexes_detailed
);
dlgIndexesDetailed
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgIndexesAll
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgIndexesAll
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_indexes_all
);
dlgIndexesAll
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
Button
dlgIndexesNo
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgIndexesNo
.
setText
(
DB2Messages
.
dialog_table_tools_runstats_indexes_no
);
dlgIndexesNo
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// SAMPLING
dlgSample
=
UIUtils
.
createCheckbox
(
composite
,
DB2Messages
.
dialog_table_tools_runstats_stats_title
,
false
);
dlgSample
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
dlgSampleValue
.
setEnabled
(
dlgSample
.
getSelection
());
updateSQL
();
}
});
dlgSampleValue
=
new
Spinner
(
composite
,
SWT
.
BORDER
);
dlgSampleValue
.
setMinimum
(
0
);
dlgSampleValue
.
setMaximum
(
100
);
dlgSampleValue
.
setIncrement
(
1
);
Rectangle
clientArea
=
getShell
().
getClientArea
();
dlgSampleValue
.
setLocation
(
clientArea
.
x
,
clientArea
.
y
);
dlgSampleValue
.
pack
();
dlgSampleValue
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Initial setup
dlgColsAllAndDistribution
.
setSelection
(
true
);
dlgIndexesDetailed
.
setSelection
(
true
);
dlgSampleValue
.
setSelection
(
0
);
dlgSampleValue
.
setEnabled
(
false
);
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"CALL SYSPROC.ADMIN_CMD('"
);
sb
.
append
(
"RUNSTATS ON TABLE "
).
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
));
if
(
dlgColsAllAndDistribution
.
getSelection
())
{
sb
.
append
(
" ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS"
);
}
if
(
dlgColsAll
.
getSelection
())
{
sb
.
append
(
" ON ALL COLUMNS"
);
}
if
(
dlgIndexesDetailed
.
getSelection
())
{
sb
.
append
(
" AND SAMPLED DETAILED INDEXES ALL"
);
}
if
(
dlgIndexesAll
.
getSelection
())
{
sb
.
append
(
" AND INDEXES ALL"
);
}
if
(
dlgSample
.
getSelection
())
{
sb
.
append
(
" TABLESAMPLE SYSTEM("
).
append
(
dlgSampleValue
.
getSelection
()).
append
(
")"
);
}
sb
.
append
(
"')"
);
lines
.
add
(
sb
.
toString
());
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2RunstatsTool.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2RunstatsTool.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table runstats action
*/
public
class
DB2RunstatsTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2RunstatsDialog
dialog
=
new
DB2RunstatsDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table runstats action
*/
public
class
DB2RunstatsTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2RunstatsDialog
dialog
=
new
DB2RunstatsDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
}
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2TruncateDialog.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2TruncateDialog.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table truncate dialog
*/
public
class
DB2TruncateDialog
extends
DB2BaseTableToolDialog
{
private
Button
dlgStorageDrop
;
private
Button
dlgStorageReuse
;
private
Button
dlgTriggersDelete
;
private
Button
dlgTriggersRestrict
;
DB2TruncateDialog
(
IWorkbenchPartSite
partSite
,
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_truncate_title
,
selectedTables
);
}
@Override
protected
void
createControls
(
Composite
parent
)
{
Group
optionsGroup
=
UIUtils
.
createControlGroup
(
parent
,
DB2Messages
.
dialog_table_tools_options
,
1
,
0
,
0
);
optionsGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Composite
composite
=
new
Composite
(
optionsGroup
,
2
);
composite
.
setLayout
(
new
GridLayout
(
2
,
false
));
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
// Drop/Reuse Storage
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_truncate_storage_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupCols
=
new
Composite
(
composite
,
SWT
.
NONE
);
groupCols
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgStorageDrop
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgStorageDrop
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_storage_drop
);
dlgStorageDrop
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgStorageReuse
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgStorageReuse
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_storage_reuse
);
dlgStorageReuse
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Triggers Clauses
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_truncate_triggers_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupIx
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupIx
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgTriggersDelete
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgTriggersDelete
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_triggers_ignore
);
dlgTriggersDelete
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgTriggersRestrict
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgTriggersRestrict
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_triggers_restrict
);
dlgTriggersRestrict
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Initial setup
dlgStorageDrop
.
setSelection
(
true
);
dlgTriggersDelete
.
setSelection
(
true
);
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"TRUNCATE TABLE "
).
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DML
));
if
(
dlgStorageDrop
.
getSelection
())
{
sb
.
append
(
" DROP STORAGE"
);
}
if
(
dlgStorageReuse
.
getSelection
())
{
sb
.
append
(
" REUSE STORAGE"
);
}
if
(
dlgTriggersDelete
.
getSelection
())
{
sb
.
append
(
" IGNORE DELETE TRIGGERS"
);
}
if
(
dlgTriggersRestrict
.
getSelection
())
{
sb
.
append
(
" RESTRICT WHEN DELETE TRIGGERS"
);
}
sb
.
append
(
" CONTINUE IDENTITY IMMEDIATE"
);
lines
.
add
(
sb
.
toString
());
}
@Override
protected
boolean
needsRefreshOnFinish
()
{
return
true
;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table truncate dialog
*/
public
class
DB2TruncateDialog
extends
DB2BaseTableToolDialog
{
private
Button
dlgStorageDrop
;
private
Button
dlgStorageReuse
;
private
Button
dlgTriggersDelete
;
private
Button
dlgTriggersRestrict
;
DB2TruncateDialog
(
IWorkbenchPartSite
partSite
,
Collection
<
DB2Table
>
selectedTables
)
{
super
(
partSite
,
DB2Messages
.
dialog_table_tools_truncate_title
,
selectedTables
);
}
@Override
protected
void
createControls
(
Composite
parent
)
{
Group
optionsGroup
=
UIUtils
.
createControlGroup
(
parent
,
DB2Messages
.
dialog_table_tools_options
,
1
,
0
,
0
);
optionsGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
Composite
composite
=
new
Composite
(
optionsGroup
,
2
);
composite
.
setLayout
(
new
GridLayout
(
2
,
false
));
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
// Drop/Reuse Storage
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_truncate_storage_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupCols
=
new
Composite
(
composite
,
SWT
.
NONE
);
groupCols
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgStorageDrop
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgStorageDrop
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_storage_drop
);
dlgStorageDrop
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgStorageReuse
=
new
Button
(
groupCols
,
SWT
.
RADIO
);
dlgStorageReuse
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_storage_reuse
);
dlgStorageReuse
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Triggers Clauses
UIUtils
.
createLabel
(
composite
,
DB2Messages
.
dialog_table_tools_truncate_triggers_title
).
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
Composite
groupIx
=
new
Composite
(
composite
,
SWT
.
NULL
);
groupIx
.
setLayout
(
new
RowLayout
(
SWT
.
VERTICAL
));
dlgTriggersDelete
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgTriggersDelete
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_triggers_ignore
);
dlgTriggersDelete
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
dlgTriggersRestrict
=
new
Button
(
groupIx
,
SWT
.
RADIO
);
dlgTriggersRestrict
.
setText
(
DB2Messages
.
dialog_table_tools_truncate_triggers_restrict
);
dlgTriggersRestrict
.
addSelectionListener
(
SQL_CHANGE_LISTENER
);
// Initial setup
dlgStorageDrop
.
setSelection
(
true
);
dlgTriggersDelete
.
setSelection
(
true
);
// Object Selector
createObjectsSelector
(
parent
);
}
@Override
protected
void
generateObjectCommand
(
List
<
String
>
lines
,
DB2Table
db2Table
)
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"TRUNCATE TABLE "
).
append
(
db2Table
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DML
));
if
(
dlgStorageDrop
.
getSelection
())
{
sb
.
append
(
" DROP STORAGE"
);
}
if
(
dlgStorageReuse
.
getSelection
())
{
sb
.
append
(
" REUSE STORAGE"
);
}
if
(
dlgTriggersDelete
.
getSelection
())
{
sb
.
append
(
" IGNORE DELETE TRIGGERS"
);
}
if
(
dlgTriggersRestrict
.
getSelection
())
{
sb
.
append
(
" RESTRICT WHEN DELETE TRIGGERS"
);
}
sb
.
append
(
" CONTINUE IDENTITY IMMEDIATE"
);
lines
.
add
(
sb
.
toString
());
}
@Override
protected
boolean
needsRefreshOnFinish
()
{
return
true
;
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/tools/maintenance/DB2TruncateTool.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/tools/maintenance/DB2TruncateTool.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table truncate action
*/
public
class
DB2TruncateTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2TruncateDialog
dialog
=
new
DB2TruncateDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
// Shell shell = dialog.getShell();
// shell.setSize(shell.computeSize(800, 800));
// shell.layout();
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.ext.db2.
ui.tools.maintenance
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.tools.IUserInterfaceTool
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Collection
;
import
java.util.List
;
/**
* DB2 table truncate action
*/
public
class
DB2TruncateTool
implements
IUserInterfaceTool
{
@Override
public
void
execute
(
IWorkbenchWindow
window
,
IWorkbenchPart
activePart
,
Collection
<
DBSObject
>
objects
)
throws
DBException
{
List
<
DB2Table
>
tables
=
CommonUtils
.
filterCollection
(
objects
,
DB2Table
.
class
);
if
(!
tables
.
isEmpty
())
{
DB2TruncateDialog
dialog
=
new
DB2TruncateDialog
(
activePart
.
getSite
(),
tables
);
dialog
.
open
();
// Shell shell = dialog.getShell();
// shell.setSize(shell.computeSize(800, 800));
// shell.layout();
}
}
}
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/views/DB2ConnectionPage.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/views/DB2ConnectionPage.java
浏览文件 @
0ff5509d
...
...
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.db2.views
;
package
org.jkiss.dbeaver.ext.db2.
ui.
views
;
import
org.eclipse.jface.dialogs.IDialogPage
;
import
org.eclipse.jface.resource.ImageDescriptor
;
...
...
@@ -26,8 +26,8 @@ import org.eclipse.swt.layout.GridLayout;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Label
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.ext.db2.Activator
;
import
org.jkiss.dbeaver.ext.db2.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.
ui.
Activator
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.
DB2Messages
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.ui.ICompositeDialogPage
;
...
...
plugins/org.jkiss.dbeaver.ext.db2
/src/org/jkiss/dbeaver/ext/db2
/views/DB2ConnectionTracePage.java
→
plugins/org.jkiss.dbeaver.ext.db2
.ui/src/org/jkiss/dbeaver/ext/db2/ui
/views/DB2ConnectionTracePage.java
浏览文件 @
0ff5509d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
* Copyright (C) 2011-2012 Eugene Fradkin (eugene.fradkin@gmail.com)
*
* 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.ext.db2.
views
;
import
org.eclipse.jface.dialogs.ControlEnableState
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.ext.db2.DB2Constants
;
import
org.jkiss.dbeaver.ext.db2.
DB2Messages
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Map
;
/**
* OracleConnectionPage
*/
public
class
DB2ConnectionTracePage
extends
ConnectionPageAbstract
{
private
Button
enableTraceCheck
;
private
Text
fileNameText
;
private
Text
folderText
;
private
Button
traceAppendCheck
;
private
LevelConfig
[]
levels
;
private
ControlEnableState
traceEnableState
;
private
Composite
traceGroup
;
private
static
class
LevelConfig
{
final
int
level
;
final
String
label
;
Button
checkbox
;
private
LevelConfig
(
int
level
,
String
label
)
{
this
.
level
=
level
;
this
.
label
=
label
;
}
}
public
DB2ConnectionTracePage
()
{
setTitle
(
DB2Messages
.
db2_connection_trace_page_tab_trace_settings
);
setDescription
(
DB2Messages
.
db2_connection_trace_page_tab_description_trace_settings
);
levels
=
new
LevelConfig
[]
{
new
LevelConfig
(
DB2Constants
.
TRACE_CONNECTION_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_connection_calls
),
new
LevelConfig
(
DB2Constants
.
TRACE_STATEMENT_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_statement_calls
),
new
LevelConfig
(
DB2Constants
.
TRACE_RESULT_SET_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_result_set_calls
),
new
LevelConfig
(
DB2Constants
.
TRACE_DRIVER_CONFIGURATION
,
DB2Messages
.
db2_connection_trace_page_checkbox_driver_configuration
),
new
LevelConfig
(
DB2Constants
.
TRACE_CONNECTS
,
DB2Messages
.
db2_connection_trace_page_checkbox_connect
),
new
LevelConfig
(
DB2Constants
.
TRACE_DRDA_FLOWS
,
DB2Messages
.
db2_connection_trace_page_checkbox_drda_flows
),
new
LevelConfig
(
DB2Constants
.
TRACE_RESULT_SET_META_DATA
,
DB2Messages
.
db2_connection_trace_page_checkbox_result_set_metadata
),
new
LevelConfig
(
DB2Constants
.
TRACE_PARAMETER_META_DATA
,
DB2Messages
.
db2_connection_trace_page_checkbox_parameter_metadata
),
new
LevelConfig
(
DB2Constants
.
TRACE_DIAGNOSTICS
,
DB2Messages
.
db2_connection_trace_page_checkbox_diagnostics
),
new
LevelConfig
(
DB2Constants
.
TRACE_SQLJ
,
DB2Messages
.
db2_connection_trace_page_checkbox_sql_j
),
new
LevelConfig
(
DB2Constants
.
TRACE_XA_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_xa_calls
),
};
}
@Override
public
void
dispose
()
{
super
.
dispose
();
}
@Override
public
void
createControl
(
Composite
parent
)
{
Composite
cfgGroup
=
new
Composite
(
parent
,
SWT
.
NONE
);
GridLayout
gl
=
new
GridLayout
(
1
,
false
);
gl
.
marginHeight
=
10
;
gl
.
marginWidth
=
10
;
cfgGroup
.
setLayout
(
gl
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_BOTH
);
cfgGroup
.
setLayoutData
(
gd
);
enableTraceCheck
=
UIUtils
.
createCheckbox
(
cfgGroup
,
DB2Messages
.
db2_connection_trace_page_checkbox_enable_trace
,
false
);
traceGroup
=
new
Composite
(
cfgGroup
,
SWT
.
NONE
);
traceGroup
.
setLayout
(
new
GridLayout
(
2
,
false
));
traceGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
folderText
=
DialogUtils
.
createOutputFolderChooser
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_label_folder
,
null
);
fileNameText
=
UIUtils
.
createLabelText
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_label_file_name
,
DB2Messages
.
db2_connection_trace_page_string_trace
);
traceAppendCheck
=
UIUtils
.
createLabelCheckbox
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_checkbox_append
,
false
);
Group
levelsGroup
=
UIUtils
.
createControlGroup
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_header_levels
,
2
,
0
,
0
);
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
gd
.
horizontalSpan
=
2
;
levelsGroup
.
setLayoutData
(
gd
);
for
(
LevelConfig
level
:
levels
)
{
level
.
checkbox
=
UIUtils
.
createCheckbox
(
levelsGroup
,
level
.
label
,
false
);
}
enableTraceCheck
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
if
(
traceEnableState
==
null
)
{
traceEnableState
=
ControlEnableState
.
disable
(
traceGroup
);
}
else
{
traceEnableState
.
restore
();
traceEnableState
=
null
;
}
}
});
setControl
(
cfgGroup
);
loadSettings
();
}
@Override
public
boolean
isComplete
()
{
return
true
;
}
@Override
public
void
loadSettings
()
{
// Load values from new connection info
DBPConnectionConfiguration
connectionInfo
=
site
.
getActiveDataSource
().
getConnectionConfiguration
();
Map
<
String
,
String
>
providerProperties
=
connectionInfo
.
getProviderProperties
();
// Settings
enableTraceCheck
.
setSelection
(
CommonUtils
.
getBoolean
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_ENABLED
),
false
));
if
(!
enableTraceCheck
.
getSelection
())
{
if
(
traceEnableState
==
null
)
{
traceEnableState
=
ControlEnableState
.
disable
(
traceGroup
);
}
}
if
(
providerProperties
.
containsKey
(
DB2Constants
.
PROP_TRACE_FOLDER
))
{
folderText
.
setText
(
CommonUtils
.
toString
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_FOLDER
)));
}
if
(
providerProperties
.
containsKey
(
DB2Constants
.
PROP_TRACE_FILE
))
{
fileNameText
.
setText
(
CommonUtils
.
toString
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_FILE
)));
}
traceAppendCheck
.
setSelection
(
CommonUtils
.
getBoolean
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_APPEND
),
false
));
int
traceLevel
=
CommonUtils
.
toInt
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_LEVEL
));
for
(
LevelConfig
level
:
levels
)
{
level
.
checkbox
.
setSelection
((
traceLevel
&
level
.
level
)
!=
0
);
}
}
@Override
public
void
saveSettings
(
DBPDataSourceContainer
dataSource
)
{
super
.
saveSettings
(
dataSource
);
Map
<
String
,
String
>
providerProperties
=
dataSource
.
getConnectionConfiguration
().
getProviderProperties
();
{
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_ENABLED
,
String
.
valueOf
(
enableTraceCheck
.
getSelection
()));
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_FOLDER
,
folderText
.
getText
());
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_FILE
,
fileNameText
.
getText
());
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_APPEND
,
String
.
valueOf
(
traceAppendCheck
.
getSelection
()));
int
traceLevel
=
0
;
for
(
LevelConfig
level
:
levels
)
{
if
(
level
.
checkbox
.
getSelection
())
{
traceLevel
|=
level
.
level
;
}
}
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_LEVEL
,
String
.
valueOf
(
traceLevel
));
}
saveConnectionURL
(
dataSource
.
getConnectionConfiguration
());
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
* Copyright (C) 2011-2012 Eugene Fradkin (eugene.fradkin@gmail.com)
*
* 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.ext.db2.
ui.views
;
import
org.eclipse.jface.dialogs.ControlEnableState
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Group
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.dbeaver.ext.db2.DB2Constants
;
import
org.jkiss.dbeaver.ext.db2.
ui.internal.DB2Messages
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.Map
;
/**
* OracleConnectionPage
*/
public
class
DB2ConnectionTracePage
extends
ConnectionPageAbstract
{
private
Button
enableTraceCheck
;
private
Text
fileNameText
;
private
Text
folderText
;
private
Button
traceAppendCheck
;
private
LevelConfig
[]
levels
;
private
ControlEnableState
traceEnableState
;
private
Composite
traceGroup
;
private
static
class
LevelConfig
{
final
int
level
;
final
String
label
;
Button
checkbox
;
private
LevelConfig
(
int
level
,
String
label
)
{
this
.
level
=
level
;
this
.
label
=
label
;
}
}
public
DB2ConnectionTracePage
()
{
setTitle
(
DB2Messages
.
db2_connection_trace_page_tab_trace_settings
);
setDescription
(
DB2Messages
.
db2_connection_trace_page_tab_description_trace_settings
);
levels
=
new
LevelConfig
[]
{
new
LevelConfig
(
DB2Constants
.
TRACE_CONNECTION_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_connection_calls
),
new
LevelConfig
(
DB2Constants
.
TRACE_STATEMENT_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_statement_calls
),
new
LevelConfig
(
DB2Constants
.
TRACE_RESULT_SET_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_result_set_calls
),
new
LevelConfig
(
DB2Constants
.
TRACE_DRIVER_CONFIGURATION
,
DB2Messages
.
db2_connection_trace_page_checkbox_driver_configuration
),
new
LevelConfig
(
DB2Constants
.
TRACE_CONNECTS
,
DB2Messages
.
db2_connection_trace_page_checkbox_connect
),
new
LevelConfig
(
DB2Constants
.
TRACE_DRDA_FLOWS
,
DB2Messages
.
db2_connection_trace_page_checkbox_drda_flows
),
new
LevelConfig
(
DB2Constants
.
TRACE_RESULT_SET_META_DATA
,
DB2Messages
.
db2_connection_trace_page_checkbox_result_set_metadata
),
new
LevelConfig
(
DB2Constants
.
TRACE_PARAMETER_META_DATA
,
DB2Messages
.
db2_connection_trace_page_checkbox_parameter_metadata
),
new
LevelConfig
(
DB2Constants
.
TRACE_DIAGNOSTICS
,
DB2Messages
.
db2_connection_trace_page_checkbox_diagnostics
),
new
LevelConfig
(
DB2Constants
.
TRACE_SQLJ
,
DB2Messages
.
db2_connection_trace_page_checkbox_sql_j
),
new
LevelConfig
(
DB2Constants
.
TRACE_XA_CALLS
,
DB2Messages
.
db2_connection_trace_page_checkbox_xa_calls
),
};
}
@Override
public
void
dispose
()
{
super
.
dispose
();
}
@Override
public
void
createControl
(
Composite
parent
)
{
Composite
cfgGroup
=
new
Composite
(
parent
,
SWT
.
NONE
);
GridLayout
gl
=
new
GridLayout
(
1
,
false
);
gl
.
marginHeight
=
10
;
gl
.
marginWidth
=
10
;
cfgGroup
.
setLayout
(
gl
);
GridData
gd
=
new
GridData
(
GridData
.
FILL_BOTH
);
cfgGroup
.
setLayoutData
(
gd
);
enableTraceCheck
=
UIUtils
.
createCheckbox
(
cfgGroup
,
DB2Messages
.
db2_connection_trace_page_checkbox_enable_trace
,
false
);
traceGroup
=
new
Composite
(
cfgGroup
,
SWT
.
NONE
);
traceGroup
.
setLayout
(
new
GridLayout
(
2
,
false
));
traceGroup
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
folderText
=
DialogUtils
.
createOutputFolderChooser
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_label_folder
,
null
);
fileNameText
=
UIUtils
.
createLabelText
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_label_file_name
,
DB2Messages
.
db2_connection_trace_page_string_trace
);
traceAppendCheck
=
UIUtils
.
createLabelCheckbox
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_checkbox_append
,
false
);
Group
levelsGroup
=
UIUtils
.
createControlGroup
(
traceGroup
,
DB2Messages
.
db2_connection_trace_page_header_levels
,
2
,
0
,
0
);
gd
=
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
);
gd
.
horizontalSpan
=
2
;
levelsGroup
.
setLayoutData
(
gd
);
for
(
LevelConfig
level
:
levels
)
{
level
.
checkbox
=
UIUtils
.
createCheckbox
(
levelsGroup
,
level
.
label
,
false
);
}
enableTraceCheck
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
if
(
traceEnableState
==
null
)
{
traceEnableState
=
ControlEnableState
.
disable
(
traceGroup
);
}
else
{
traceEnableState
.
restore
();
traceEnableState
=
null
;
}
}
});
setControl
(
cfgGroup
);
loadSettings
();
}
@Override
public
boolean
isComplete
()
{
return
true
;
}
@Override
public
void
loadSettings
()
{
// Load values from new connection info
DBPConnectionConfiguration
connectionInfo
=
site
.
getActiveDataSource
().
getConnectionConfiguration
();
Map
<
String
,
String
>
providerProperties
=
connectionInfo
.
getProviderProperties
();
// Settings
enableTraceCheck
.
setSelection
(
CommonUtils
.
getBoolean
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_ENABLED
),
false
));
if
(!
enableTraceCheck
.
getSelection
())
{
if
(
traceEnableState
==
null
)
{
traceEnableState
=
ControlEnableState
.
disable
(
traceGroup
);
}
}
if
(
providerProperties
.
containsKey
(
DB2Constants
.
PROP_TRACE_FOLDER
))
{
folderText
.
setText
(
CommonUtils
.
toString
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_FOLDER
)));
}
if
(
providerProperties
.
containsKey
(
DB2Constants
.
PROP_TRACE_FILE
))
{
fileNameText
.
setText
(
CommonUtils
.
toString
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_FILE
)));
}
traceAppendCheck
.
setSelection
(
CommonUtils
.
getBoolean
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_APPEND
),
false
));
int
traceLevel
=
CommonUtils
.
toInt
(
providerProperties
.
get
(
DB2Constants
.
PROP_TRACE_LEVEL
));
for
(
LevelConfig
level
:
levels
)
{
level
.
checkbox
.
setSelection
((
traceLevel
&
level
.
level
)
!=
0
);
}
}
@Override
public
void
saveSettings
(
DBPDataSourceContainer
dataSource
)
{
super
.
saveSettings
(
dataSource
);
Map
<
String
,
String
>
providerProperties
=
dataSource
.
getConnectionConfiguration
().
getProviderProperties
();
{
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_ENABLED
,
String
.
valueOf
(
enableTraceCheck
.
getSelection
()));
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_FOLDER
,
folderText
.
getText
());
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_FILE
,
fileNameText
.
getText
());
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_APPEND
,
String
.
valueOf
(
traceAppendCheck
.
getSelection
()));
int
traceLevel
=
0
;
for
(
LevelConfig
level
:
levels
)
{
if
(
level
.
checkbox
.
getSelection
())
{
traceLevel
|=
level
.
level
;
}
}
providerProperties
.
put
(
DB2Constants
.
PROP_TRACE_LEVEL
,
String
.
valueOf
(
traceLevel
));
}
saveConnectionURL
(
dataSource
.
getConnectionConfiguration
());
}
}
plugins/org.jkiss.dbeaver.ext.db2.ui/templates/db2-templates.properties
0 → 100644
浏览文件 @
0ff5509d
plugins/org.jkiss.dbeaver.ext.db2.ui/templates/db2-templates.xml
0 → 100644
浏览文件 @
0ff5509d
<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* 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.
*
-->
<templates>
<template
id=
"org.jkiss.dbeaver.templates.curtime"
name=
"curtimestamp"
context=
"sql_db2"
autoinsert=
"true"
description=
"values (current timestamp)"
>
VALUES (CURRENT TIMESTAMP);
</template>
<template
id=
"org.jkiss.dbeaver.templates.cmdAdminDropSchema"
name=
"cmdAdminDropSchema"
context=
"sql_db2"
autoinsert=
"true"
description=
"Admin Drop Schema"
>
call SYSPROC.ADMIN_DROP_SCHEMA('${schema}',null,?,?);
</template>
<template
id=
"org.jkiss.dbeaver.templates.cmdAdminCopySchema"
name=
"cmdAdminCopySchema"
context=
"sql_db2"
autoinsert=
"true"
description=
"Admin Copy Schema"
>
call SYSPROC.ADMIN_COPY_SCHEMA('${schema}','
<
target schema
>
','COPY', NULL, '
<
source ts1, source ts2
>
','
<
target ts1, target ts2
>
',?,?);
</template>
</templates>
plugins/org.jkiss.dbeaver.ext.db2/META-INF/MANIFEST.MF
浏览文件 @
0ff5509d
...
...
@@ -7,20 +7,16 @@ Bundle-Version: 2.1.117.qualifier
Bundle-Release-Date: 20200504
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jkiss.dbeaver.ext.db2.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.views,
org.eclipse.ui.editors,
org.eclipse.ui.workbench.texteditor,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.registry,
org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.tasks.ui,
org.jkiss.dbeaver.ui.editors.base,
org.jkiss.dbeaver.ui.editors.connection,
org.jkiss.dbeaver.ui.editors.sql,
org.jkiss.dbeaver.ui.editors.session
Bundle-ClassPath: .
...
...
plugins/org.jkiss.dbeaver.ext.db2/plugin.xml
浏览文件 @
0ff5509d
...
...
@@ -392,24 +392,6 @@
</datasource>
</extension>
<extension
point=
"org.jkiss.dbeaver.dataSourceView"
>
<view
id=
"org.jkiss.dbeaver.ext.db2.dataSourceWizardView"
dataSource=
"db2"
targetID=
"org.jkiss.dbeaver.ext.ui.newConnectionWizard"
label=
"%dialog.connection.header"
class=
"org.jkiss.dbeaver.ext.db2.views.DB2ConnectionPage"
icon=
"icons/db2_icon.png"
>
</view>
<view
id=
"org.jkiss.dbeaver.ext.db2.dataSourceEditorView"
dataSource=
"db2"
targetID=
"org.jkiss.dbeaver.ext.ui.editConnectionDialog"
label=
"%dialog.connection.header"
class=
"org.jkiss.dbeaver.ext.db2.views.DB2ConnectionPage"
>
</view>
</extension>
<extension
point=
"org.jkiss.dbeaver.objectManager"
>
<manager
class=
"org.jkiss.dbeaver.ext.db2.manager.DB2AliasManager"
objectType=
"org.jkiss.dbeaver.ext.db2.model.DB2Alias"
/>
<manager
class=
"org.jkiss.dbeaver.ext.db2.manager.DB2BufferpoolManager"
objectType=
"org.jkiss.dbeaver.ext.db2.model.DB2Bufferpool"
/>
...
...
@@ -464,16 +446,6 @@
type=
"folder"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</editor>
<editor
id=
"source.routine.ddl"
class=
"org.jkiss.dbeaver.ext.db2.editors.DB2RoutineDDLEditor"
label=
"%editor.source.ddl.name"
description=
"%editor.source.ddl.description"
icon=
"#sql_text"
position=
"additions_middle"
contributor=
"org.jkiss.dbeaver.ui.editors.sql.SQLEditorContributorNested"
type=
"folder"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Routine"
/>
</editor>
</extension>
...
...
@@ -501,66 +473,6 @@
</dialect>
</extension>
<extension
point=
"org.jkiss.dbeaver.tools"
>
<tools>
<toolGroup
id=
"org.jkiss.dbeaver.ext.db2.tools.maintenance"
label=
"Statistics"
/>
<tool
class=
"org.jkiss.dbeaver.ext.db2.tools.DB2ToolShowError"
description=
"Display SQL Error Message"
id=
"org.jkiss.dbeaver.ext.db2.tools.DB2ToolShowError"
label=
"%tool.org.jkiss.dbeaver.ext.db2.showerror.name"
singleton=
"true"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2DataSource"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2RunstatsTool"
description=
"Runstats"
id=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2RunstatsTool"
group=
"org.jkiss.dbeaver.ext.db2.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.runstats.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2ReorgTableTool"
description=
"Reorg table"
id=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2ReorgTableTool"
group=
"org.jkiss.dbeaver.ext.db2.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.reorg.name"
singleton=
"true"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2ReorgIndexTool"
description=
"Reorg index"
id=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2ReorgIndexTool"
group=
"org.jkiss.dbeaver.ext.db2.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.reorgix.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2ReorgCheckTableTool"
description=
"Reorg check table"
id=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2ReorgCheckTableTool"
group=
"org.jkiss.dbeaver.ext.db2.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.reorgcheck.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
<tool
class=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2TruncateTool"
description=
"Truncate table"
id=
"org.jkiss.dbeaver.ext.db2.tools.maintenance.DB2Truncate"
group=
"org.jkiss.dbeaver.ext.db2.tools.maintenance"
label=
"%tool.org.jkiss.dbeaver.ext.db2.table.truncate.name"
singleton=
"false"
>
<objectType
name=
"org.jkiss.dbeaver.ext.db2.model.DB2Table"
/>
</tool>
</tools>
</extension>
<extension
point=
"org.eclipse.ui.editors"
>
<editor
name=
"%editor.org.jkiss.dbeaver.ext.db2.model.app.DB2ServerApplicationEditor.name"
...
...
plugins/pom.xml
浏览文件 @
0ff5509d
...
...
@@ -24,6 +24,7 @@
<module>
org.jkiss.dbeaver.ext.athena
</module>
<module>
org.jkiss.dbeaver.ext.bigquery
</module>
<module>
org.jkiss.dbeaver.ext.clickhouse
</module>
<module>
org.jkiss.dbeaver.ext.db2
</module>
<module>
org.jkiss.dbeaver.ext.db2.zos
</module>
<module>
org.jkiss.dbeaver.ext.db2.i
</module>
<module>
org.jkiss.dbeaver.ext.derby
</module>
...
...
@@ -78,7 +79,7 @@
<module>
org.jkiss.dbeaver.ext.athena.ui
</module>
<module>
org.jkiss.dbeaver.ext.bigquery.ui
</module>
<module>
org.jkiss.dbeaver.ext.exasol
</module>
<module>
org.jkiss.dbeaver.ext.db2
</module>
<module>
org.jkiss.dbeaver.ext.db2
.ui
</module>
<module>
org.jkiss.dbeaver.ext.generic.ui
</module>
<module>
org.jkiss.dbeaver.ext.mssql.ui
</module>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录