Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
32674d49
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
32674d49
编写于
3月 14, 2013
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Data import handler
Former-commit-id:
530f7b3f
上级
8599de22
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
165 addition
and
52 deletion
+165
-52
plugins/org.jkiss.dbeaver.core/plugin.properties
plugins/org.jkiss.dbeaver.core/plugin.properties
+3
-1
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+15
-0
plugins/org.jkiss.dbeaver.core/plugin_ru.properties
plugins/org.jkiss.dbeaver.core/plugin_ru.properties
+3
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/navigator/DBNAdapterFactory.java
.../org/jkiss/dbeaver/model/navigator/DBNAdapterFactory.java
+2
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java
...ver/tools/transfer/database/DatabaseTransferConsumer.java
+5
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/handlers/DataExportHandler.java
...ss/dbeaver/tools/transfer/handlers/DataExportHandler.java
+8
-39
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/handlers/DataImportHandler.java
...ss/dbeaver/tools/transfer/handlers/DataImportHandler.java
+38
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/handlers/DataTransferHandler.java
.../dbeaver/tools/transfer/handlers/DataTransferHandler.java
+72
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferSettings.java
...s/dbeaver/tools/transfer/wizard/DataTransferSettings.java
+10
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferWizard.java
...iss/dbeaver/tools/transfer/wizard/DataTransferWizard.java
+9
-2
未找到文件。
plugins/org.jkiss.dbeaver.core/plugin.properties
浏览文件 @
32674d49
...
...
@@ -110,7 +110,9 @@ command.org.jkiss.dbeaver.ui.editors.sql.comment.single.description=Add or remov
command.org.jkiss.dbeaver.ui.editors.sql.comment.multi.name
=
Toggle Block Comment
command.org.jkiss.dbeaver.ui.editors.sql.comment.multi.description
=
Add or remove multi line comment
command.org.jkiss.dbeaver.core.export.data.name
=
Export Data
command.org.jkiss.dbeaver.core.export.data.description
=
Export data to file(s)
command.org.jkiss.dbeaver.core.export.data.description
=
Export data to file(s) or database table(s)
command.org.jkiss.dbeaver.core.import.data.name
=
Import Data
command.org.jkiss.dbeaver.core.import.data.description
=
Import data from database table(s)
command.org.jkiss.dbeaver.core.compare.objects.name
=
Compare
command.org.jkiss.dbeaver.core.compare.objects.description
=
Compare database objects
...
...
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
32674d49
...
...
@@ -206,6 +206,7 @@
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.comment.multi"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.comment.multi.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.comment.multi.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.export.data"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.export.data.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.export.data.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.core.export.data"
name=
"%command.org.jkiss.dbeaver.core.export.data.name"
description=
"%command.org.jkiss.dbeaver.core.export.data.description"
categoryId=
"org.jkiss.dbeaver.core.util"
/>
<command
id=
"org.jkiss.dbeaver.core.import.data"
name=
"%command.org.jkiss.dbeaver.core.import.data.name"
description=
"%command.org.jkiss.dbeaver.core.import.data.description"
categoryId=
"org.jkiss.dbeaver.core.util"
/>
<command
id=
"org.jkiss.dbeaver.core.compare.objects"
name=
"%command.org.jkiss.dbeaver.core.compare.objects.name"
description=
"%command.org.jkiss.dbeaver.core.compare.objects.description"
categoryId=
"org.jkiss.dbeaver.core.util"
/>
<command
id=
"org.jkiss.dbeaver.core.resultset.toggleMode"
name=
"%command.org.jkiss.dbeaver.core.resultset.toggleMode.name"
description=
"%command.org.jkiss.dbeaver.core.resultset.toggleMode.description"
categoryId=
"org.jkiss.dbeaver.core.rs"
/>
...
...
@@ -235,6 +236,7 @@
<extension
point=
"org.eclipse.ui.commandImages"
>
<image
commandId=
"org.jkiss.dbeaver.ui.editors.sql.export.data"
icon=
"icons/file/export.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.export.data"
icon=
"icons/file/export.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.import.data"
icon=
"icons/file/import.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.compare.objects"
icon=
"icons/file/compare.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.driver.manager"
icon=
"icons/driver_manager.png"
/>
<image
commandId=
"org.jkiss.dbeaver.core.new.connection"
icon=
"icons/database_connect.png"
/>
...
...
@@ -366,6 +368,16 @@
</with>
</enabledWhen>
</handler>
<handler
commandId=
"org.jkiss.dbeaver.core.import.data"
class=
"org.jkiss.dbeaver.tools.transfer.handlers.DataImportHandler"
>
<enabledWhen>
<with
variable=
"selection"
>
<count
value=
"+"
/>
<iterate
operator=
"and"
>
<adapt
type=
"org.jkiss.dbeaver.model.struct.DBSDataManipulator"
/>
</iterate>
</with>
</enabledWhen>
</handler>
<handler
commandId=
"org.jkiss.dbeaver.core.compare.objects"
class=
"org.jkiss.dbeaver.tools.compare.CompareObjectsHandler"
>
<enabledWhen>
<with
variable=
"selection"
>
...
...
@@ -1338,6 +1350,9 @@
<command
commandId=
"org.jkiss.dbeaver.core.export.data"
>
<visibleWhen
checkEnabled=
"true"
/>
</command>
<command
commandId=
"org.jkiss.dbeaver.core.import.data"
>
<visibleWhen
checkEnabled=
"true"
/>
</command>
<command
commandId=
"org.jkiss.dbeaver.core.compare.objects"
>
<visibleWhen
checkEnabled=
"true"
/>
</command>
...
...
plugins/org.jkiss.dbeaver.core/plugin_ru.properties
浏览文件 @
32674d49
...
...
@@ -107,7 +107,9 @@ command.org.jkiss.dbeaver.ui.editors.sql.open.file.description=\u0417\u0430\u043
command.org.jkiss.dbeaver.ui.editors.sql.save.file.name=
\u0421\u
043E
\u0445\u0440\u0430\u
043D
\u0438\u0442\u
044C SQL
\u0441\u
043A
\u0440\u0438\u
043F
\u0442
command.org.jkiss.dbeaver.ui.editors.sql.save.file.description=
\u0421\u
043E
\u0445\u0440\u0430\u
043D
\u0438\u0442\u
044C
\u0432
\u0444\u0430\u0439\u
043B
command.org.jkiss.dbeaver.core.export.data.name
=
\u
042D
\u
043A
\u0441\u
043F
\u
043E
\u0440\u0442
\u0434\u0430\u
043D
\u
043D
\u
044B
\u0445
command.org.jkiss.dbeaver.core.export.data.description=
\u
042D
\u
043A
\u0441\u
043F
\u
043E
\u0440\u0442
\u0434\u0430\u
043D
\u
043D
\u
044B
\u0445
\u0432
\u0444\u0430\u0439\u
043B(
\u
044B)
command.org.jkiss.dbeaver.core.export.data.description=
\u
042D
\u
043A
\u0441\u
043F
\u
043E
\u0440\u0442
\u0434\u0430\u
043D
\u
043D
\u
044B
\u0445
\u0432
\u0444\u0430\u0439\u
043B
\u
044B
\u0438\u
043B
\u0438
\u0442\u0430\u0431\u
043B
\u0438\u0446\u
044B
\u0411\u0414
command.org.jkiss.dbeaver.core.import.data.name=
\u0418\u
043C
\u
043F
\u
043E
\u0440\u0442
\u0434\u0430\u
043D
\u
043D
\u
044B
\u0445
command.org.jkiss.dbeaver.core.import.data.description=
\u0418\u
043C
\u
043F
\u
043E
\u0440\u0442
\u0434\u0430\u
043D
\u
043D
\u
044B
\u0445
\u0438\u0437
\u0442\u0430\u0431\u
043B
\u0438\u0446
\u0411\u0414
command.org.jkiss.dbeaver.core.compare.objects.name=
\u0421\u0440\u0430\u0432\u
043D
\u0438\u0442\u
044C
command.org.jkiss.dbeaver.core.compare.objects.description
=
\u0421\u0440\u0430\u0432\u
043D
\u0438\u0442\u
044C
\u
043E
\u0431\u
044A
\u0435\u
043A
\u0442\u
044B
\u0411\u0414
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/navigator/DBNAdapterFactory.java
浏览文件 @
32674d49
...
...
@@ -33,10 +33,7 @@ import org.jkiss.dbeaver.model.DBPDataSource;
import
org.jkiss.dbeaver.model.DBPNamedObject
;
import
org.jkiss.dbeaver.model.DBPObject
;
import
org.jkiss.dbeaver.model.DBPQualifiedObject
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.model.struct.DBSDataSourceContainer
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSWrapper
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.ui.properties.PropertyCollector
;
/**
...
...
@@ -50,6 +47,7 @@ public class DBNAdapterFactory implements IAdapterFactory
DBPObject
.
class
,
DBSObject
.
class
,
DBSDataContainer
.
class
,
DBSDataManipulator
.
class
,
DBSDataSourceContainer
.
class
,
IPropertySource
.
class
,
IProject
.
class
,
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java
浏览文件 @
32674d49
...
...
@@ -47,6 +47,11 @@ public class DatabaseTransferConsumer implements IDataTransferConsumer<DatabaseC
{
}
public
DatabaseTransferConsumer
(
DBSDataManipulator
targetObject
)
{
}
@Override
public
void
fetchStart
(
DBCExecutionContext
context
,
DBCResultSet
resultSet
)
throws
DBCException
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/handlers/DataExportHandler.java
浏览文件 @
32674d49
...
...
@@ -18,52 +18,21 @@
*/
package
org.jkiss.dbeaver.tools.transfer.handlers
;
import
org.eclipse.core.commands.AbstractHandler
;
import
org.eclipse.core.commands.ExecutionEvent
;
import
org.eclipse.core.commands.ExecutionException
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.eclipse.ui.handlers.HandlerUtil
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferNode
;
import
org.jkiss.dbeaver.tools.transfer.database.DatabaseTransferProducer
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferProducer
;
import
org.jkiss.dbeaver.tools.transfer.wizard.DataTransferWizard
;
import
org.jkiss.dbeaver.ui.dialogs.ActiveWizardDialog
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
public
class
DataExportHandler
extends
AbstractHandler
{
public
class
DataExportHandler
extends
DataTransferHandler
{
@Override
public
Object
execute
(
ExecutionEvent
event
)
throws
ExecutionException
{
final
IWorkbenchWindow
workbenchWindow
=
HandlerUtil
.
getActiveWorkbenchWindow
(
event
);
final
ISelection
selection
=
HandlerUtil
.
getCurrentSelection
(
event
);
if
(!(
selection
instanceof
IStructuredSelection
))
{
protected
IDataTransferNode
adaptTransferNode
(
Object
object
)
{
final
DBSDataContainer
adapted
=
RuntimeUtils
.
getObjectAdapter
(
object
,
DBSDataContainer
.
class
);
if
(
adapted
!=
null
)
{
return
new
DatabaseTransferProducer
(
adapted
);
}
else
{
return
null
;
}
IStructuredSelection
ss
=
(
IStructuredSelection
)
selection
;
final
List
<
IDataTransferProducer
>
dataProducers
=
new
ArrayList
<
IDataTransferProducer
>();
for
(
Iterator
<?>
iter
=
ss
.
iterator
();
iter
.
hasNext
();
)
{
Object
object
=
iter
.
next
();
final
DBSDataContainer
adapted
=
RuntimeUtils
.
getObjectAdapter
(
object
,
DBSDataContainer
.
class
);
if
(
adapted
!=
null
)
{
dataProducers
.
add
(
new
DatabaseTransferProducer
(
adapted
));
}
}
// Refresh objects
if
(!
dataProducers
.
isEmpty
())
{
ActiveWizardDialog
dialog
=
new
ActiveWizardDialog
(
workbenchWindow
,
new
DataTransferWizard
(
dataProducers
));
dialog
.
open
();
}
return
null
;
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/handlers/DataImportHandler.java
0 → 100644
浏览文件 @
32674d49
/*
* Copyright (C) 2010-2012 Serge Rieder
* serge@jkiss.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
org.jkiss.dbeaver.tools.transfer.handlers
;
import
org.jkiss.dbeaver.model.struct.DBSDataManipulator
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferNode
;
import
org.jkiss.dbeaver.tools.transfer.database.DatabaseTransferConsumer
;
public
class
DataImportHandler
extends
DataTransferHandler
{
@Override
protected
IDataTransferNode
adaptTransferNode
(
Object
object
)
{
final
DBSDataManipulator
adapted
=
RuntimeUtils
.
getObjectAdapter
(
object
,
DBSDataManipulator
.
class
);
if
(
adapted
!=
null
)
{
return
new
DatabaseTransferConsumer
(
adapted
);
}
else
{
return
null
;
}
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/handlers/DataTransferHandler.java
0 → 100644
浏览文件 @
32674d49
/*
* Copyright (C) 2010-2012 Serge Rieder
* serge@jkiss.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
org.jkiss.dbeaver.tools.transfer.handlers
;
import
org.eclipse.core.commands.AbstractHandler
;
import
org.eclipse.core.commands.ExecutionEvent
;
import
org.eclipse.core.commands.ExecutionException
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.eclipse.ui.handlers.HandlerUtil
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferNode
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferProducer
;
import
org.jkiss.dbeaver.tools.transfer.database.DatabaseTransferProducer
;
import
org.jkiss.dbeaver.tools.transfer.wizard.DataTransferWizard
;
import
org.jkiss.dbeaver.ui.dialogs.ActiveWizardDialog
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
public
abstract
class
DataTransferHandler
extends
AbstractHandler
{
@Override
public
Object
execute
(
ExecutionEvent
event
)
throws
ExecutionException
{
final
IWorkbenchWindow
workbenchWindow
=
HandlerUtil
.
getActiveWorkbenchWindow
(
event
);
final
ISelection
selection
=
HandlerUtil
.
getCurrentSelection
(
event
);
if
(!(
selection
instanceof
IStructuredSelection
))
{
return
null
;
}
IStructuredSelection
ss
=
(
IStructuredSelection
)
selection
;
final
List
<
IDataTransferNode
>
transferNodes
=
new
ArrayList
<
IDataTransferNode
>();
for
(
Iterator
<?>
iter
=
ss
.
iterator
();
iter
.
hasNext
();
)
{
Object
object
=
iter
.
next
();
IDataTransferNode
node
=
adaptTransferNode
(
object
);
if
(
node
!=
null
)
{
transferNodes
.
add
(
node
);
}
}
// Run transfer wizard
if
(!
transferNodes
.
isEmpty
())
{
ActiveWizardDialog
dialog
=
new
ActiveWizardDialog
(
workbenchWindow
,
new
DataTransferWizard
(
transferNodes
));
dialog
.
open
();
}
return
null
;
}
protected
abstract
IDataTransferNode
adaptTransferNode
(
Object
object
);
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferSettings.java
浏览文件 @
32674d49
...
...
@@ -76,13 +76,18 @@ public class DataTransferSettings {
private
transient
int
curPipeNum
=
0
;
public
DataTransferSettings
(
Collection
<?
extends
IDataTransfer
Producer
>
sourc
es
)
public
DataTransferSettings
(
Collection
<?
extends
IDataTransfer
Node
>
transferNod
es
)
{
this
(
sources
,
null
);
}
final
List
<
IDataTransferProducer
>
producers
=
new
ArrayList
<
IDataTransferProducer
>();
final
List
<
IDataTransferConsumer
>
consumers
=
new
ArrayList
<
IDataTransferConsumer
>();
for
(
IDataTransferNode
node
:
transferNodes
)
{
if
(
node
instanceof
IDataTransferProducer
)
{
producers
.
add
((
IDataTransferProducer
)
node
);
}
else
if
(
node
instanceof
IDataTransferConsumer
)
{
consumers
.
add
((
IDataTransferConsumer
)
node
);
}
}
public
DataTransferSettings
(
Collection
<?
extends
IDataTransferProducer
>
producers
,
Collection
<?
extends
IDataTransferConsumer
>
consumers
)
{
dataPipes
=
new
ArrayList
<
DataTransferPipe
>();
if
(!
CommonUtils
.
isEmpty
(
producers
))
{
// Make pipes
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/wizard/DataTransferWizard.java
浏览文件 @
32674d49
...
...
@@ -29,6 +29,8 @@ import org.jkiss.dbeaver.core.DBeaverUI;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferConsumer
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferNode
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferProducer
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferSettings
;
import
org.jkiss.dbeaver.ui.UIUtils
;
...
...
@@ -42,8 +44,13 @@ public class DataTransferWizard extends Wizard implements IExportWizard {
private
DataTransferSettings
settings
;
public
DataTransferWizard
(
List
<?
extends
IDataTransferProducer
>
dataContainers
)
{
this
.
settings
=
new
DataTransferSettings
(
dataContainers
);
public
DataTransferWizard
(
List
<?
extends
IDataTransferNode
>
transferNodes
)
{
this
.
settings
=
new
DataTransferSettings
(
transferNodes
);
loadSettings
();
}
private
void
loadSettings
()
{
IDialogSettings
section
=
UIUtils
.
getDialogSettings
(
RS_EXPORT_WIZARD_DIALOG_SETTINGS
);
setDialogSettings
(
section
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录