Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
df08b266
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,发现更多精彩内容 >>
提交
df08b266
编写于
5月 27, 2020
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#8810 SQL tool task mode. Task registry refactoring
Former-commit-id:
d9a6f9e6
上级
dfd4c7c4
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
795 addition
and
11 deletion
+795
-11
features/org.jkiss.dbeaver.ui.feature/feature.xml
features/org.jkiss.dbeaver.ui.feature/feature.xml
+1
-0
plugins/org.jkiss.dbeaver.ext.mysql/plugin.xml
plugins/org.jkiss.dbeaver.ext.mysql/plugin.xml
+2
-3
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/tasks/MySQLToolTableCheck.java
...rg/jkiss/dbeaver/ext/mysql/tasks/MySQLToolTableCheck.java
+47
-0
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/tasks/MySQLToolTableCheckSettings.java
.../dbeaver/ext/mysql/tasks/MySQLToolTableCheckSettings.java
+61
-0
plugins/org.jkiss.dbeaver.model.sql/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.model.sql/META-INF/MANIFEST.MF
+1
-0
plugins/org.jkiss.dbeaver.model.sql/src/org/jkiss/dbeaver/model/sql/task/SQLToolExecuteHandler.java
...g/jkiss/dbeaver/model/sql/task/SQLToolExecuteHandler.java
+22
-6
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/task/DBTTaskType.java
...r.model/src/org/jkiss/dbeaver/model/task/DBTTaskType.java
+2
-0
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/task/TaskTypeDescriptor.java
...c/org/jkiss/dbeaver/registry/task/TaskTypeDescriptor.java
+5
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.tasks.sql.ui/META-INF/MANIFEST.MF
+26
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/OSGI-INF/l10n/bundle.properties
...kiss.dbeaver.tasks.sql.ui/OSGI-INF/l10n/bundle.properties
+0
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/build.properties
plugins/org.jkiss.dbeaver.tasks.sql.ui/build.properties
+6
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/plugin.xml
plugins/org.jkiss.dbeaver.tasks.sql.ui/plugin.xml
+9
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/pom.xml
plugins/org.jkiss.dbeaver.tasks.sql.ui/pom.xml
+16
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/src/org/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskConfigurationWizard.java
.../dbeaver/tasks/ui/sql/SQLToolTaskConfigurationWizard.java
+67
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/src/org/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskConfigurator.java
...g/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskConfigurator.java
+90
-0
plugins/org.jkiss.dbeaver.tasks.sql.ui/src/org/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskPageSettings.java
...g/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskPageSettings.java
+401
-0
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/registry/TaskConfiguratorDescriptor.java
...dbeaver/tasks/ui/registry/TaskConfiguratorDescriptor.java
+15
-0
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/registry/TaskUIRegistry.java
...c/org/jkiss/dbeaver/tasks/ui/registry/TaskUIRegistry.java
+23
-2
plugins/pom.xml
plugins/pom.xml
+1
-0
未找到文件。
features/org.jkiss.dbeaver.ui.feature/feature.xml
浏览文件 @
df08b266
...
...
@@ -55,6 +55,7 @@
<plugin
id=
"org.jkiss.dbeaver.ext.ui.locks"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.tasks.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.tasks.native.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.tasks.sql.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.data.transfer.ui"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.import_config"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
<plugin
id=
"org.jkiss.dbeaver.ext.format.sqlworkbenchj"
download-size=
"0"
install-size=
"0"
version=
"0.0.0"
unpack=
"false"
/>
...
...
plugins/org.jkiss.dbeaver.ext.mysql/plugin.xml
浏览文件 @
df08b266
...
...
@@ -370,6 +370,7 @@
<extension
point=
"org.jkiss.dbeaver.task"
>
<category
id=
"mysql"
name=
"MySQL"
description=
"MySQL database task"
icon=
"icons/mysql_icon.png"
/>
<category
id=
"mysqlTool"
parent=
"mysql"
name=
"Tools"
description=
"MySQL database tools"
icon=
"icons/mysql_icon.png"
/>
<task
id=
"mysqlDatabaseBackup"
name=
"MySQL dump"
description=
"MySQL database export task"
icon=
"platform:/plugin/org.jkiss.dbeaver.ui/icons/file/export.png"
type=
"mysql"
handler=
"org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportHandler"
>
<objectType
name=
"org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog"
/>
...
...
@@ -383,11 +384,9 @@
</task>
<!-- SQL tools -->
<!--
<task id="mysqlToolCheckTable" name="Check" description="Check table(s)" type="mysql" handler="org.jkiss.dbeaver.ext.mysql.tasks.MySQLScriptExecuteHandler">
<task
id=
"mysqlToolCheckTable"
name=
"Check table"
description=
"Check table(s)"
icon=
"platform:/plugin/org.jkiss.dbeaver.model/icons/tree/admin.png"
type=
"mysqlTool"
handler=
"org.jkiss.dbeaver.ext.mysql.tasks.MySQLToolTableCheck"
>
<objectType
name=
"org.jkiss.dbeaver.ext.mysql.model.MySQLTable"
/>
</task>
-->
</extension>
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/tasks/MySQLToolTableCheck.java
0 → 100644
浏览文件 @
df08b266
/*
* 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.mysql.tasks
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.ext.mysql.model.MySQLTableBase
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.sql.task.SQLToolExecuteHandler
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.List
;
/**
* Table check
*/
public
class
MySQLToolTableCheck
extends
SQLToolExecuteHandler
<
MySQLTableBase
,
MySQLToolTableCheckSettings
>
{
@NotNull
@Override
protected
MySQLToolTableCheckSettings
createToolSettings
()
{
return
new
MySQLToolTableCheckSettings
();
}
public
void
generateObjectQueries
(
DBCSession
session
,
MySQLToolTableCheckSettings
settings
,
List
<
String
>
queries
,
MySQLTableBase
object
)
{
String
sql
=
"CHECK TABLE "
+
object
.
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
);
String
option
=
settings
.
getOption
();
if
(!
CommonUtils
.
isEmpty
(
option
))
sql
+=
" "
+
option
;
queries
.
add
(
sql
);
}
}
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/tasks/MySQLToolTableCheckSettings.java
0 → 100644
浏览文件 @
df08b266
/*
* 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.mysql.tasks
;
import
org.jkiss.dbeaver.ext.mysql.model.MySQLTableBase
;
import
org.jkiss.dbeaver.model.meta.IPropertyValueListProvider
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.sql.task.SQLToolExecuteSettings
;
/**
* Table check settings
*/
public
class
MySQLToolTableCheckSettings
extends
SQLToolExecuteSettings
<
MySQLTableBase
>
{
private
String
option
;
@Property
(
listProvider
=
CheckOptionListProvider
.
class
)
public
String
getOption
()
{
return
option
;
}
public
void
setOption
(
String
option
)
{
this
.
option
=
option
;
}
private
static
class
CheckOptionListProvider
implements
IPropertyValueListProvider
<
String
>
{
@Override
public
boolean
allowCustomValue
()
{
return
false
;
}
@Override
public
Object
[]
getPossibleValues
(
String
object
)
{
return
new
String
[]
{
""
,
"FOR UPGRADE"
,
"QUICK"
,
"FAST"
,
"MEDIUM"
,
"EXTENDED"
,
"CHANGED"
};
}
}
}
plugins/org.jkiss.dbeaver.model.sql/META-INF/MANIFEST.MF
浏览文件 @
df08b266
...
...
@@ -22,6 +22,7 @@ Export-Package: org.jkiss.dbeaver.model.sql,
org.jkiss.dbeaver.model.sql.parser.rules,
org.jkiss.dbeaver.model.sql.parser.tokens,
org.jkiss.dbeaver.model.sql.registry,
org.jkiss.dbeaver.model.sql.task,
org.jkiss.dbeaver.model.text,
org.jkiss.dbeaver.model.text.parser,
org.jkiss.dbeaver.model.text.parser.rules
...
...
plugins/org.jkiss.dbeaver.model.sql/src/org/jkiss/dbeaver/model/sql/task/SQLToolExecuteHandler.java
浏览文件 @
df08b266
...
...
@@ -19,24 +19,29 @@ package org.jkiss.dbeaver.model.sql.task;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.task.DBTTask
;
import
org.jkiss.dbeaver.model.task.DBTTaskExecutionListener
;
import
org.jkiss.dbeaver.model.task.DBTTaskHandler
;
import
java.io.Writer
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
/**
* SQLToolExecuteHandler
*/
public
abstract
class
SQLToolExecuteHandler
implements
DBTTaskHandler
{
public
abstract
class
SQLToolExecuteHandler
<
OBJECT_TYPE
extends
DBSObject
,
SETTINGS
extends
SQLToolExecuteSettings
<
OBJECT_TYPE
>>
implements
DBTTaskHandler
{
@Override
public
void
executeTask
(
public
final
void
executeTask
(
@NotNull
DBRRunnableContext
runnableContext
,
@NotNull
DBTTask
task
,
@NotNull
Locale
locale
,
...
...
@@ -44,12 +49,12 @@ public abstract class SQLToolExecuteHandler implements DBTTaskHandler {
@NotNull
Writer
logStream
,
@NotNull
DBTTaskExecutionListener
listener
)
throws
DBException
{
S
QLToolExecuteSettings
settings
=
new
SQLToolExecute
Settings
();
S
ETTINGS
settings
=
createTool
Settings
();
settings
.
loadConfiguration
(
runnableContext
,
task
.
getProperties
());
executeWithSettings
(
runnableContext
,
task
,
locale
,
log
,
logStream
,
listener
,
settings
);
}
private
void
executeWithSettings
(
@NotNull
DBRRunnableContext
runnableContext
,
DBTTask
task
,
@NotNull
Locale
locale
,
@NotNull
Log
log
,
Writer
logStream
,
@NotNull
DBTTaskExecutionListener
listener
,
S
QLToolExecuteSettings
settings
)
throws
DBException
{
private
void
executeWithSettings
(
@NotNull
DBRRunnableContext
runnableContext
,
DBTTask
task
,
@NotNull
Locale
locale
,
@NotNull
Log
log
,
Writer
logStream
,
@NotNull
DBTTaskExecutionListener
listener
,
S
ETTINGS
settings
)
throws
DBException
{
// Start consumers
listener
.
taskStarted
(
settings
);
...
...
@@ -73,9 +78,20 @@ public abstract class SQLToolExecuteHandler implements DBTTaskHandler {
listener
.
taskFinished
(
settings
,
error
);
}
private
void
executeTool
(
DBRProgressMonitor
monitor
,
DBTTask
task
,
S
QLToolExecuteSettings
settings
,
Log
log
,
Writer
logStream
)
throws
DBException
{
List
objectList
=
settings
.
getObjectList
();
private
void
executeTool
(
DBRProgressMonitor
monitor
,
DBTTask
task
,
S
ETTINGS
settings
,
Log
log
,
Writer
logStream
)
throws
DBException
{
List
<
String
>
queries
=
new
ArrayList
<>
();
List
<
OBJECT_TYPE
>
objectList
=
settings
.
getObjectList
();
for
(
OBJECT_TYPE
object
:
objectList
)
{
try
(
DBCSession
session
=
DBUtils
.
openMetaSession
(
monitor
,
object
,
"Generate tool queries"
))
{
generateObjectQueries
(
session
,
settings
,
queries
,
object
);
}
}
}
@NotNull
protected
abstract
SETTINGS
createToolSettings
();
protected
abstract
void
generateObjectQueries
(
DBCSession
session
,
SETTINGS
settings
,
List
<
String
>
queries
,
OBJECT_TYPE
object
)
throws
DBCException
;
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/task/DBTTaskType.java
浏览文件 @
df08b266
...
...
@@ -53,4 +53,6 @@ public interface DBTTaskType {
@NotNull
DBTTaskHandler
createHandler
()
throws
DBException
;
Class
<?
extends
DBTTaskHandler
>
getHandlerClass
();
}
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/task/TaskTypeDescriptor.java
浏览文件 @
df08b266
...
...
@@ -122,6 +122,11 @@ public class TaskTypeDescriptor extends AbstractContextDescriptor implements DBT
return
handlerImplType
.
createInstance
(
DBTTaskHandler
.
class
);
}
@Override
public
Class
<?
extends
DBTTaskHandler
>
getHandlerClass
()
{
return
handlerImplType
.
getObjectClass
(
DBTTaskHandler
.
class
);
}
@Override
public
String
toString
()
{
return
getId
();
...
...
plugins/org.jkiss.dbeaver.tasks.sql.ui/META-INF/MANIFEST.MF
0 → 100644
浏览文件 @
df08b266
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: DBeaver Tasks - SQL Tools UI
Bundle-SymbolicName: org.jkiss.dbeaver.tasks.sql.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Release-Date: 20200601
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.swt,
org.eclipse.core.resources,
org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.editors,
org.eclipse.ui.views,
org.eclipse.ui.workbench,
org.eclipse.ui.workbench.texteditor,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.model.sql,
org.jkiss.dbeaver.registry,
org.jkiss.dbeaver.tasks.ui,
org.jkiss.dbeaver.ui
Bundle-ClassPath: .
Automatic-Module-Name: org.jkiss.dbeaver.tasks.sql.ui
plugins/org.jkiss.dbeaver.tasks.sql.ui/OSGI-INF/l10n/bundle.properties
0 → 100644
浏览文件 @
df08b266
plugins/org.jkiss.dbeaver.tasks.sql.ui/build.properties
0 → 100644
浏览文件 @
df08b266
source..
=
src/
output..
=
target/classes/
bin.includes
=
.,
\
META-INF/,
\
OSGI-INF/,
\
plugin.xml
plugins/org.jkiss.dbeaver.tasks.sql.ui/plugin.xml
0 → 100644
浏览文件 @
df08b266
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point=
"org.jkiss.dbeaver.task.ui"
>
<configurator
handler=
"org.jkiss.dbeaver.model.sql.task.SQLToolExecuteHandler"
class=
"org.jkiss.dbeaver.tasks.ui.sql.SQLToolTaskConfigurator"
/>
</extension>
</plugin>
plugins/org.jkiss.dbeaver.tasks.sql.ui/pom.xml
0 → 100644
浏览文件 @
df08b266
<?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.tasks.sql.ui
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<packaging>
eclipse-plugin
</packaging>
</project>
plugins/org.jkiss.dbeaver.tasks.sql.ui/src/org/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskConfigurationWizard.java
0 → 100644
浏览文件 @
df08b266
/*
* 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.tasks.ui.sql
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.sql.task.SQLToolExecuteSettings
;
import
org.jkiss.dbeaver.model.task.DBTTask
;
import
org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
java.util.Map
;
class
SQLToolTaskConfigurationWizard
extends
TaskConfigurationWizard
{
private
SQLToolExecuteSettings
settings
=
new
SQLToolExecuteSettings
();
private
SQLToolTaskPageSettings
pageSettings
;
public
SQLToolTaskConfigurationWizard
()
{
}
public
SQLToolTaskConfigurationWizard
(
@NotNull
DBTTask
task
)
{
super
(
task
);
settings
.
loadConfiguration
(
UIUtils
.
getDefaultRunnableContext
(),
task
.
getProperties
());
}
@Override
protected
String
getDefaultWindowTitle
()
{
return
"Script Execute"
;
}
@Override
public
String
getTaskTypeId
()
{
return
getCurrentTask
().
getType
().
getId
();
}
@Override
public
void
addPages
()
{
super
.
addPages
();
pageSettings
=
new
SQLToolTaskPageSettings
(
this
);
addPage
(
pageSettings
);
}
@Override
public
void
saveTaskState
(
DBRRunnableContext
runnableContext
,
DBTTask
task
,
Map
<
String
,
Object
>
state
)
{
//pageSettings.saveSettings();
settings
.
saveConfiguration
(
state
);
}
public
SQLToolExecuteSettings
getSettings
()
{
return
settings
;
}
}
plugins/org.jkiss.dbeaver.tasks.sql.ui/src/org/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskConfigurator.java
0 → 100644
浏览文件 @
df08b266
/*
* 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.tasks.ui.sql
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Table
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.app.DBPProject
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.task.DBTTask
;
import
org.jkiss.dbeaver.model.task.DBTTaskType
;
import
org.jkiss.dbeaver.tasks.ui.DBTTaskConfigPanel
;
import
org.jkiss.dbeaver.tasks.ui.DBTTaskConfigurator
;
import
org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard
;
/**
* SQL tool task configurator
*/
public
class
SQLToolTaskConfigurator
implements
DBTTaskConfigurator
{
private
static
final
Log
log
=
Log
.
getLog
(
SQLToolTaskConfigurator
.
class
);
@Override
public
ConfigPanel
createInputConfigurator
(
DBRRunnableContext
runnableContext
,
@NotNull
DBTTaskType
taskType
)
{
return
new
ConfigPanel
(
runnableContext
,
taskType
);
}
@Override
public
TaskConfigurationWizard
createTaskConfigWizard
(
@NotNull
DBTTask
taskConfiguration
)
{
return
new
SQLToolTaskConfigurationWizard
(
taskConfiguration
);
}
private
static
class
ConfigPanel
implements
DBTTaskConfigPanel
{
private
DBRRunnableContext
runnableContext
;
private
DBTTaskType
taskType
;
private
Table
objectsTable
;
private
DBPProject
currentProject
;
private
SQLToolTaskConfigurationWizard
dtWizard
;
ConfigPanel
(
DBRRunnableContext
runnableContext
,
DBTTaskType
taskType
)
{
this
.
runnableContext
=
runnableContext
;
this
.
taskType
=
taskType
;
//this.currentProject = NavigatorUtils.getSelectedProject();
}
@Override
public
void
createControl
(
Composite
parent
,
TaskConfigurationWizard
wizard
,
Runnable
propertyChangeListener
)
{
dtWizard
=
(
SQLToolTaskConfigurationWizard
)
wizard
;
}
@Override
public
void
loadSettings
()
{
}
@Override
public
void
saveSettings
()
{
}
@Override
public
boolean
isComplete
()
{
return
objectsTable
.
getItemCount
()
>
0
;
}
@Override
public
String
getErrorMessage
()
{
if
(
objectsTable
.
getItemCount
()
==
0
)
{
return
"No objects selected"
;
}
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.tasks.sql.ui/src/org/jkiss/dbeaver/tasks/ui/sql/SQLToolTaskPageSettings.java
0 → 100644
浏览文件 @
df08b266
/*
* 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.tasks.ui.sql
;
import
org.eclipse.jface.viewers.TableViewer
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.navigator.DBNDataSource
;
import
org.jkiss.dbeaver.model.navigator.DBNProject
;
import
org.jkiss.dbeaver.model.navigator.DBNResource
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.ActiveWizardPage
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.*
;
/**
* SQL task settings page
*/
class
SQLToolTaskPageSettings
extends
ActiveWizardPage
<
SQLToolTaskConfigurationWizard
>
{
private
static
final
Log
log
=
Log
.
getLog
(
SQLToolTaskPageSettings
.
class
);
private
SQLToolTaskConfigurationWizard
sqlWizard
;
private
Button
ignoreErrorsCheck
;
private
Button
dumpQueryCheck
;
private
Button
autoCommitCheck
;
private
TableViewer
scriptsViewer
;
private
TableViewer
dataSourceViewer
;
private
List
<
DBNResource
>
selectedScripts
=
new
ArrayList
<>();
private
List
<
DBNDataSource
>
selectedDataSources
=
new
ArrayList
<>();
SQLToolTaskPageSettings
(
SQLToolTaskConfigurationWizard
wizard
)
{
super
(
"Tool parameters"
);
setTitle
(
"Tool parameters"
);
setDescription
(
"Parameters for database tool"
);
this
.
sqlWizard
=
wizard
;
}
@Override
public
void
createControl
(
Composite
parent
)
{
initializeDialogUnits
(
parent
);
Composite
composite
=
UIUtils
.
createComposite
(
parent
,
1
);
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
/*
SQLScriptExecuteSettings dtSettings = getWizard().getSettings();
SashForm mainGroup = new SashForm(composite, SWT.NONE);
mainGroup.setSashWidth(5);
mainGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
DBNProject projectNode = DBWorkbench.getPlatform().getNavigatorModel().getRoot().getProjectNode(sqlWizard.getProject());
{
Composite filesGroup = UIUtils.createControlGroup(mainGroup, DTMessages.sql_script_task_page_settings_group_files, 2, GridData.FILL_BOTH, 0);
scriptsViewer = new TableViewer(filesGroup, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
scriptsViewer.setContentProvider(new ListContentProvider());
scriptsViewer.getTable().setHeaderVisible(true);
scriptsViewer.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return ((DBNResource) element).getResource().getProjectRelativePath().toString();
}
@Override
public Image getImage(Object element) {
return DBeaverIcons.getImage(((DBNResource)element).getNodeIconDefault());
}
});
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 300;
gd.widthHint = 400;
scriptsViewer.getTable().setLayoutData(gd);
SQLTaskScriptSelectorDialog.createScriptColumns(scriptsViewer);
final Table scriptTable = scriptsViewer.getTable();
scriptTable.setLayoutData(new GridData(GridData.FILL_BOTH));
ToolBar buttonsToolbar = new ToolBar(filesGroup, SWT.VERTICAL);
buttonsToolbar.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
UIUtils.createToolItem(buttonsToolbar, "Add script", UIIcon.ROW_ADD, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SQLTaskScriptSelectorDialog dialog = new SQLTaskScriptSelectorDialog(getShell(), projectNode);
if (dialog.open() == IDialogConstants.OK_ID) {
for (DBNResource script : dialog.getSelectedScripts()) {
if (!selectedScripts.contains(script)) {
selectedScripts.add(script);
}
}
refreshScripts();
}
}
});
ToolItem deleteItem = UIUtils.createToolItem(buttonsToolbar, "Remove script", UIIcon.ROW_DELETE, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ISelection selection = scriptsViewer.getSelection();
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
for (Object element : ((IStructuredSelection) selection).toArray()) {
if (element instanceof DBNResource) {
selectedScripts.remove(element);
}
}
refreshScripts();
}
}
});
UIUtils.createToolBarSeparator(buttonsToolbar, SWT.HORIZONTAL);
ToolItem moveUpItem = UIUtils.createToolItem(buttonsToolbar, "Move script up", UIIcon.ARROW_UP, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int selectionIndex = scriptTable.getSelectionIndex();
if (selectionIndex > 0) {
DBNResource prevScript = selectedScripts.get(selectionIndex - 1);
selectedScripts.set(selectionIndex - 1, selectedScripts.get(selectionIndex));
selectedScripts.set(selectionIndex, prevScript);
refreshScripts();
}
}
});
ToolItem moveDownItem = UIUtils.createToolItem(buttonsToolbar, "Move script down", UIIcon.ARROW_DOWN, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int selectionIndex = scriptTable.getSelectionIndex();
if (selectionIndex < scriptTable.getItemCount() - 1) {
DBNResource nextScript = selectedScripts.get(selectionIndex + 1);
selectedScripts.set(selectionIndex + 1, selectedScripts.get(selectionIndex));
selectedScripts.set(selectionIndex, nextScript);
refreshScripts();
}
}
});
scriptsViewer.addSelectionChangedListener(event -> {
int selectionIndex = scriptTable.getSelectionIndex();
deleteItem.setEnabled(selectionIndex >= 0);
moveUpItem.setEnabled(selectionIndex > 0);
moveDownItem.setEnabled(selectionIndex < scriptTable.getItemCount() - 1);
});
deleteItem.setEnabled(false);
}
{
Composite connectionsGroup = UIUtils.createControlGroup(mainGroup, DTMessages.sql_script_task_page_settings_group_connections, 2, GridData.FILL_BOTH, 0);
dataSourceViewer = new TableViewer(connectionsGroup, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
dataSourceViewer.setContentProvider(new ListContentProvider());
//dataSourceViewer.getTable().setHeaderVisible(true);
dataSourceViewer.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return ((DBNDataSource) element).getNodeName();
}
@Override
public Image getImage(Object element) {
return DBeaverIcons.getImage(((DBNDataSource)element).getNodeIcon());
}
});
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 300;
gd.widthHint = 400;
dataSourceViewer.getTable().setLayoutData(gd);
final Table dsTable = dataSourceViewer.getTable();
dsTable.setLayoutData(new GridData(GridData.FILL_BOTH));
ToolBar buttonsToolbar = new ToolBar(connectionsGroup, SWT.VERTICAL);
buttonsToolbar.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
UIUtils.createToolItem(buttonsToolbar, "Add datasource", UIIcon.ROW_ADD, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SQLTaskDataSourceSelectorDialog dialog = new SQLTaskDataSourceSelectorDialog(getShell(), projectNode);
if (dialog.open() == IDialogConstants.OK_ID) {
for (DBNDataSource ds : dialog.getSelectedDataSources()) {
if (!selectedDataSources.contains(ds)) {
selectedDataSources.add(ds);
}
}
refreshDataSources();
}
}
});
ToolItem deleteItem = UIUtils.createToolItem(buttonsToolbar, "Remove datasource", UIIcon.ROW_DELETE, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ISelection selection = dataSourceViewer.getSelection();
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
for (Object element : ((IStructuredSelection) selection).toArray()) {
if (element instanceof DBNDataSource) {
selectedDataSources.remove(element);
}
}
refreshDataSources();
}
}
});
UIUtils.createToolBarSeparator(buttonsToolbar, SWT.HORIZONTAL);
ToolItem moveUpItem = UIUtils.createToolItem(buttonsToolbar, "Move datasource up", UIIcon.ARROW_UP, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int selectionIndex = dsTable.getSelectionIndex();
if (selectionIndex > 0) {
DBNDataSource prevScript = selectedDataSources.get(selectionIndex - 1);
selectedDataSources.set(selectionIndex - 1, selectedDataSources.get(selectionIndex));
selectedDataSources.set(selectionIndex, prevScript);
refreshDataSources();
}
}
});
ToolItem moveDownItem = UIUtils.createToolItem(buttonsToolbar, "Move datasource down", UIIcon.ARROW_DOWN, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int selectionIndex = dsTable.getSelectionIndex();
if (selectionIndex < dsTable.getItemCount() - 1) {
DBNDataSource nextScript = selectedDataSources.get(selectionIndex + 1);
selectedDataSources.set(selectionIndex + 1, selectedDataSources.get(selectionIndex));
selectedDataSources.set(selectionIndex, nextScript);
refreshScripts();
}
}
});
dataSourceViewer.addSelectionChangedListener(event -> {
int selectionIndex = dsTable.getSelectionIndex();
deleteItem.setEnabled(selectionIndex >= 0);
moveUpItem.setEnabled(selectionIndex > 0);
moveDownItem.setEnabled(selectionIndex < dsTable.getItemCount() - 1);
});
deleteItem.setEnabled(false);
}
{
Composite settingsGroup = UIUtils.createControlGroup(composite, DTMessages.sql_script_task_page_settings_group_script, 3, GridData.HORIZONTAL_ALIGN_BEGINNING, 0);
ignoreErrorsCheck = UIUtils.createCheckbox(settingsGroup, DTMessages.sql_script_task_page_settings_option_ignore_errors, "", dtSettings.isIgnoreErrors(), 1);
dumpQueryCheck = UIUtils.createCheckbox(settingsGroup, DTMessages.sql_script_task_page_settings_option_dump_results, "", dtSettings.isDumpQueryResultsToLog(), 1);
dumpQueryCheck.setEnabled(false);
autoCommitCheck = UIUtils.createCheckbox(settingsGroup, DTMessages.sql_script_task_page_settings_option_auto_commit, "", dtSettings.isAutoCommit(), 1);
}
getWizard().createTaskSaveButtons(composite, true, 1);
loadSettings();
*/
setControl
(
composite
);
}
private
void
refreshScripts
()
{
scriptsViewer
.
refresh
(
true
,
true
);
updateSelectedScripts
();
}
private
void
refreshDataSources
()
{
dataSourceViewer
.
refresh
(
true
,
true
);
}
private
void
updateSelectedScripts
()
{
DBNProject
projectNode
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getRoot
().
getProjectNode
(
sqlWizard
.
getProject
());
Set
<
DBPDataSourceContainer
>
dataSources
=
new
LinkedHashSet
<>();
for
(
DBNResource
element
:
selectedScripts
)
{
Collection
<
DBPDataSourceContainer
>
resDS
=
element
.
getAssociatedDataSources
();
if
(!
CommonUtils
.
isEmpty
(
resDS
))
{
dataSources
.
addAll
(
resDS
);
}
}
if
(!
dataSources
.
isEmpty
())
{
List
<
DBNDataSource
>
checkedDataSources
=
new
ArrayList
<>();
for
(
DBPDataSourceContainer
ds
:
dataSources
)
{
DBNDataSource
dsNode
=
projectNode
.
getDatabases
().
getDataSource
(
ds
);
if
(
dsNode
!=
null
)
{
checkedDataSources
.
add
(
dsNode
);
}
}
if
(!
checkedDataSources
.
isEmpty
())
{
refreshDataSources
();
for
(
DBNDataSource
dsNode
:
checkedDataSources
)
{
if
(!
selectedDataSources
.
contains
(
dsNode
))
{
selectedDataSources
.
add
(
dsNode
);
}
}
}
}
refreshDataSources
();
updatePageCompletion
();
}
@Override
public
void
activatePage
()
{
updatePageCompletion
();
}
@Override
public
void
deactivatePage
()
{
}
@Override
protected
boolean
determinePageCompletion
()
{
if
(
selectedScripts
.
isEmpty
())
{
setErrorMessage
(
"You must select script(s) to execute"
);
return
false
;
}
if
(
selectedDataSources
.
isEmpty
())
{
setErrorMessage
(
"You must select connection(s)"
);
return
false
;
}
setErrorMessage
(
null
);
return
true
;
}
/*
public void loadSettings() {
SQLScriptExecuteSettings settings = sqlWizard.getSettings();
List<String> scriptFiles = settings.getScriptFiles();
for (String filePath : scriptFiles) {
IFile file = SQLScriptExecuteSettings.getWorkspaceFile(filePath);
if (file == null) {
log.debug("Script file '" + filePath + "' not found");
continue;
}
DBPProject currentProject = DBWorkbench.getPlatform().getWorkspace().getProject(file.getProject());
if (currentProject == null) {
log.debug("Project '" + file.getProject().getName() + "' not found");
continue;
}
DBNProject projectNode = DBWorkbench.getPlatform().getNavigatorModel().getRoot().getProjectNode(currentProject);
if (projectNode != null) {
DBNResource resource = projectNode.findResource(file);
if (resource != null) {
selectedScripts.add(resource);
}
}
}
scriptsViewer.setInput(selectedScripts);
for (DBPDataSourceContainer dataSource : settings.getDataSources()) {
DBNProject projectNode = DBWorkbench.getPlatform().getNavigatorModel().getRoot().getProjectNode(dataSource.getProject());
DBNDataSource dsNode = projectNode.getDatabases().getDataSource(dataSource);
if (dsNode != null) {
selectedDataSources.add(dsNode);
}
}
dataSourceViewer.setInput(selectedDataSources);
// if (!selectedDataSources.isEmpty()) {
// dataSourceTree.getCheckboxViewer().setCheckedElements(selectedDataSources.toArray());
// dataSourceTree.getCheckboxViewer().reveal(selectedDataSources.get(0));
// }
}
public void saveSettings() {
if (sqlWizard == null) {
return;
}
SQLScriptExecuteSettings settings = sqlWizard.getSettings();
List<String> scriptPaths = new ArrayList<>();
for (DBNResource resource : selectedScripts) {
IResource res = resource.getResource();
if (res instanceof IFile) {
scriptPaths.add(res.getFullPath().toString());
}
}
settings.setScriptFiles(scriptPaths);
List<DBPDataSourceContainer> dsList = new ArrayList<>();
for (DBNDataSource dsNode : selectedDataSources) {
dsList.add(dsNode.getDataSourceContainer());
}
settings.setDataSources(dsList);
settings.setIgnoreErrors(ignoreErrorsCheck.getSelection());
settings.setDumpQueryResultsToLog(dumpQueryCheck.getSelection());
settings.setAutoCommit(autoCommitCheck.getSelection());
}
*/
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/registry/TaskConfiguratorDescriptor.java
浏览文件 @
df08b266
...
...
@@ -31,14 +31,25 @@ import org.jkiss.utils.CommonUtils;
public
class
TaskConfiguratorDescriptor
extends
AbstractContextDescriptor
{
private
final
TaskTypeDescriptor
type
;
private
final
ObjectType
taskHandlerType
;
private
final
IConfigurationElement
config
;
private
final
ObjectType
implType
;
private
final
boolean
supportsPanel
;
TaskConfiguratorDescriptor
(
IConfigurationElement
config
)
{
super
(
config
);
this
.
type
=
null
;
this
.
config
=
config
;
this
.
taskHandlerType
=
new
ObjectType
(
config
,
"handler"
);
this
.
implType
=
new
ObjectType
(
config
,
"class"
);
this
.
supportsPanel
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
"supportsPanel"
),
true
);
}
TaskConfiguratorDescriptor
(
TaskTypeDescriptor
type
,
IConfigurationElement
config
)
{
super
(
config
);
this
.
type
=
type
;
this
.
config
=
config
;
this
.
taskHandlerType
=
null
;
this
.
implType
=
new
ObjectType
(
config
,
"class"
);
this
.
supportsPanel
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
"supportsPanel"
),
true
);
}
...
...
@@ -58,6 +69,10 @@ public class TaskConfiguratorDescriptor extends AbstractContextDescriptor {
return
type
;
}
public
ObjectType
getTaskHandlerType
()
{
return
taskHandlerType
;
}
@NotNull
public
DBTTaskConfigurator
createConfigurator
()
throws
DBException
{
return
implType
.
createInstance
(
DBTTaskConfigurator
.
class
);
...
...
plugins/org.jkiss.dbeaver.tasks.ui/src/org/jkiss/dbeaver/tasks/ui/registry/TaskUIRegistry.java
浏览文件 @
df08b266
...
...
@@ -22,12 +22,16 @@ import org.eclipse.core.runtime.Platform;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.task.DBTTaskHandler
;
import
org.jkiss.dbeaver.model.task.DBTTaskType
;
import
org.jkiss.dbeaver.registry.task.TaskRegistry
;
import
org.jkiss.dbeaver.registry.task.TaskTypeDescriptor
;
import
org.jkiss.dbeaver.tasks.ui.DBTTaskConfigurator
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
TaskUIRegistry
{
...
...
@@ -45,6 +49,7 @@ public class TaskUIRegistry {
}
private
final
Map
<
DBTTaskType
,
TaskConfiguratorDescriptor
>
taskConfigurators
=
new
LinkedHashMap
<>();
private
final
List
<
TaskConfiguratorDescriptor
>
taskHandlerConfigurators
=
new
ArrayList
<>();
private
TaskUIRegistry
(
IExtensionRegistry
registry
)
{
IConfigurationElement
[]
extElements
=
registry
.
getConfigurationElementsFor
(
TASK_EXTENSION_ID
);
...
...
@@ -54,7 +59,12 @@ public class TaskUIRegistry {
String
typeId
=
ext
.
getAttribute
(
"type"
);
TaskTypeDescriptor
taskType
=
TaskRegistry
.
getInstance
().
getTaskType
(
typeId
);
if
(
taskType
==
null
)
{
log
.
debug
(
"Task type '"
+
typeId
+
"' not found. Skip configurator."
);
if
(!
CommonUtils
.
isEmpty
(
ext
.
getAttribute
(
"handler"
)))
{
TaskConfiguratorDescriptor
configDescriptor
=
new
TaskConfiguratorDescriptor
(
ext
);
taskHandlerConfigurators
.
add
(
configDescriptor
);
}
else
{
log
.
debug
(
"Task type '"
+
typeId
+
"' not found. Skip configurator."
);
}
}
else
{
TaskConfiguratorDescriptor
configDescriptor
=
new
TaskConfiguratorDescriptor
(
taskType
,
ext
);
taskConfigurators
.
put
(
taskType
,
configDescriptor
);
...
...
@@ -78,7 +88,18 @@ public class TaskUIRegistry {
public
DBTTaskConfigurator
createConfigurator
(
DBTTaskType
taskType
)
throws
DBCException
{
TaskConfiguratorDescriptor
configuratorDescriptor
=
taskConfigurators
.
get
(
taskType
);
if
(
configuratorDescriptor
==
null
)
{
throw
new
DBCException
(
"Task configurator not supported for "
+
taskType
.
getName
());
Class
<?
extends
DBTTaskHandler
>
handlerClass
=
taskType
.
getHandlerClass
();
if
(
handlerClass
!=
null
)
{
for
(
TaskConfiguratorDescriptor
tcd
:
taskHandlerConfigurators
)
{
if
(
tcd
.
getTaskHandlerType
().
getObjectClass
().
isAssignableFrom
(
handlerClass
))
{
configuratorDescriptor
=
tcd
;
break
;
}
}
}
if
(
configuratorDescriptor
==
null
)
{
throw
new
DBCException
(
"Task configurator not supported for "
+
taskType
.
getName
());
}
}
try
{
return
configuratorDescriptor
.
createConfigurator
();
...
...
plugins/pom.xml
浏览文件 @
df08b266
...
...
@@ -117,6 +117,7 @@
<module>
org.jkiss.dbeaver.ext.erd
</module>
<module>
org.jkiss.dbeaver.tasks.native.ui
</module>
<module>
org.jkiss.dbeaver.tasks.ui
</module>
<module>
org.jkiss.dbeaver.tasks.sql.ui
</module>
<module>
org.jkiss.dbeaver.data.office.ui
</module>
<module>
org.jkiss.dbeaver.ext.sample.database
</module>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录