Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
143686e4
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,发现更多精彩内容 >>
提交
143686e4
编写于
8月 07, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6473 Object container selector control redesign
上级
0411ba00
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
241 addition
and
54 deletion
+241
-54
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerSettings.java
...ver/tools/transfer/database/DatabaseConsumerSettings.java
+12
-18
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/page/DatabaseConsumerPageMapping.java
...s/transfer/database/page/DatabaseConsumerPageMapping.java
+24
-10
plugins/org.jkiss.dbeaver.ui.editors.base/src/org/jkiss/dbeaver/ui/editors/object/struct/EditForeignKeyPage.java
.../dbeaver/ui/editors/object/struct/EditForeignKeyPage.java
+20
-9
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/ObjectContainerSelectorPanel.java
...iss/dbeaver/ui/controls/ObjectContainerSelectorPanel.java
+185
-17
未找到文件。
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerSettings.java
浏览文件 @
143686e4
...
...
@@ -19,14 +19,11 @@ package org.jkiss.dbeaver.tools.transfer.database;
import
org.eclipse.jface.dialogs.DialogSettings
;
import
org.eclipse.jface.dialogs.IDialogSettings
;
import
org.eclipse.jface.operation.IRunnableContext
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.model.navigator.DBNDataSource
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabaseNode
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
...
...
@@ -34,6 +31,7 @@ import org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.model.struct.DBSDataManipulator
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.tools.transfer.DTUtils
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferConsumer
;
import
org.jkiss.dbeaver.tools.transfer.IDataTransferSettings
;
...
...
@@ -277,24 +275,20 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
}
}
@NotNull
public
String
getContainerFullName
()
{
DBSObjectContainer
container
=
getContainer
();
return
container
==
null
?
""
:
container
instanceof
DBPDataSource
?
DBUtils
.
getObjectFullName
(
container
,
DBPEvaluationContext
.
UI
)
:
DBUtils
.
getObjectFullName
(
container
,
DBPEvaluationContext
.
UI
)
+
" ["
+
container
.
getDataSource
().
getContainer
().
getName
()
+
"]"
;
}
public
void
loadNode
(
IRunnableContext
runnableContext
)
{
if
(
containerNode
==
null
&&
!
CommonUtils
.
isEmpty
(
containerNodePath
))
{
if
(!
CommonUtils
.
isEmpty
(
containerNodePath
))
{
public
void
loadNode
(
IRunnableContext
runnableContext
,
@Nullable
DBSObjectContainer
producerContainer
)
{
if
(
containerNode
==
null
&&
(
producerContainer
!=
null
||
!
CommonUtils
.
isEmpty
(
containerNodePath
)))
{
if
(
producerContainer
!=
null
||
!
CommonUtils
.
isEmpty
(
containerNodePath
))
{
try
{
runnableContext
.
run
(
true
,
true
,
monitor
->
{
try
{
DBNNode
node
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByPath
(
new
DefaultProgressMonitor
(
monitor
),
containerNodePath
);
DBNNode
node
;
if
(
producerContainer
!=
null
)
{
node
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByObject
(
producerContainer
);
}
else
{
node
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByPath
(
new
DefaultProgressMonitor
(
monitor
),
containerNodePath
);
}
if
(
node
instanceof
DBNDatabaseNode
)
{
containerNode
=
(
DBNDatabaseNode
)
node
;
}
...
...
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/page/DatabaseConsumerPageMapping.java
浏览文件 @
143686e4
...
...
@@ -104,7 +104,12 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
{
// Target container
// Use first source object as cur selection (it's better than nothing)
containerPanel
=
new
ObjectContainerSelectorPanel
(
composite
,
DTMessages
.
data_transfer_db_consumer_target_container
,
DTMessages
.
data_transfer_db_consumer_choose_container
)
{
containerPanel
=
new
ObjectContainerSelectorPanel
(
composite
,
DBWorkbench
.
getPlatform
().
getWorkspace
().
getActiveProject
(),
"container.data-transfer.database-consumer"
,
DTMessages
.
data_transfer_db_consumer_target_container
,
DTMessages
.
data_transfer_db_consumer_choose_container
)
{
@Nullable
@Override
protected
DBNNode
getSelectedNode
()
{
...
...
@@ -127,10 +132,7 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
@Override
protected
void
setSelectedNode
(
DBNDatabaseNode
node
)
{
settings
.
setContainerNode
(
node
);
DBNDataSource
dataSourceNode
=
DBNDataSource
.
getDataSourceNode
(
node
);
setContainerInfo
(
dataSourceNode
==
null
?
node
.
getNodeIconDefault
()
:
dataSourceNode
.
getNodeIconDefault
(),
settings
.
getContainerFullName
());
setContainerInfo
(
node
);
// Reset mappings
for
(
DatabaseMappingContainer
mappingContainer
:
settings
.
getDataMappings
().
values
())
{
if
(
mappingContainer
.
getMappingType
()
!=
DatabaseMappingType
.
unspecified
)
{
...
...
@@ -717,13 +719,25 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
public
void
activatePage
()
{
final
DatabaseConsumerSettings
settings
=
getDatabaseConsumerSettings
();
settings
.
loadNode
(
getContainer
());
DBSObjectContainer
producerContainer
=
null
;
for
(
DataTransferPipe
pipe
:
getWizard
().
getSettings
().
getDataPipes
())
{
if
(
pipe
.
getProducer
()
!=
null
)
{
DBSObject
producerObject
=
pipe
.
getProducer
().
getDatabaseObject
();
if
(
producerObject
instanceof
DBSDataContainer
)
{
DBSObject
container
=
producerObject
.
getParentObject
();
if
(
container
instanceof
DBSObjectContainer
)
{
producerContainer
=
(
DBSObjectContainer
)
container
;
}
}
}
}
settings
.
loadNode
(
getContainer
(),
producerContainer
);
DBNDatabaseNode
containerNode
=
settings
.
getContainerNode
();
if
(
containerNode
!=
null
)
{
DBNDataSource
dataSourceNode
=
DBNDataSource
.
getDataSourceNode
(
containerNode
);
containerPanel
.
setContainerInfo
(
dataSourceNode
==
null
?
containerNode
.
getNodeIconDefault
()
:
dataSourceNode
.
getNodeIcon
(),
settings
.
getContainerFullName
());
//DBNDataSource dataSourceNode = DBNDataSource.getDataSourceNode(containerNode);
containerPanel
.
setContainerInfo
(
containerNode
);
}
if
(
mappingViewer
.
getInput
()
==
null
)
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.base/src/org/jkiss/dbeaver/ui/editors/object/struct/EditForeignKeyPage.java
浏览文件 @
143686e4
...
...
@@ -64,6 +64,7 @@ import java.util.List;
*/
public
class
EditForeignKeyPage
extends
BaseObjectEditPage
{
public
static
final
String
CONTAINER_LOGICAL_FK
=
"container.logical-fk"
;
private
static
final
Log
log
=
Log
.
getLog
(
EditForeignKeyPage
.
class
);
public
static
final
FKType
FK_TYPE_PHYSICAL
=
new
FKType
(
"Physical"
,
true
);
...
...
@@ -73,7 +74,7 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
private
DBSEntityAssociation
foreignKey
;
private
DBSEntity
curRefTable
;
private
List
<
DBSEntityConstraint
>
curConstraints
;
private
DBNDatabaseNode
ownerTableNode
;
private
DBNDatabaseNode
ownerTableNode
,
ownerContainerNode
;
private
Table
tableList
;
private
Combo
uniqueKeyCombo
;
private
Text
fkNameText
;
...
...
@@ -485,10 +486,18 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
}
private
void
createContainerSelector
(
Composite
tableGroup
)
throws
DBException
{
ObjectContainerSelectorPanel
containerPanel
=
new
ObjectContainerSelectorPanel
(
tableGroup
,
"Reference table container"
,
"Select reference table catalog/schema"
)
{
ObjectContainerSelectorPanel
containerPanel
=
new
ObjectContainerSelectorPanel
(
tableGroup
,
foreignKey
.
getDataSource
().
getContainer
().
getRegistry
().
getProject
(),
CONTAINER_LOGICAL_FK
,
"Reference table container"
,
"Select reference table catalog/schema"
)
{
@Nullable
@Override
protected
DBNNode
getSelectedNode
()
{
if
(
ownerContainerNode
!=
null
)
{
return
ownerContainerNode
;
}
DBSObject
containerObject
;
if
(
ownerTableNode
!=
null
)
{
DBNNode
containerNode
=
ownerTableNode
.
getParentNode
();
...
...
@@ -513,17 +522,17 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
log
.
error
(
"Error getting real object container"
,
e
);
}
}
return
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByObject
(
containerObject
);
return
ownerContainerNode
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByObject
(
containerObject
);
}
@Override
protected
void
setSelectedNode
(
DBNDatabaseNode
node
)
{
owner
Table
Node
=
node
;
if
(
n
ode
==
null
)
{
setContainerInfo
(
DBIcon
.
TYPE_UNKNOWN
,
""
);
owner
Container
Node
=
node
;
if
(
ownerContainerN
ode
==
null
)
{
setContainerInfo
(
null
);
}
else
{
setContainerInfo
(
node
.
getNodeIconDefault
(),
node
.
getNodeFullName
()
);
loadTableList
(
owner
Table
Node
);
setContainerInfo
(
node
);
loadTableList
(
owner
Container
Node
);
}
}
};
...
...
@@ -536,7 +545,9 @@ public class EditForeignKeyPage extends BaseObjectEditPage {
while
(
containerNode
instanceof
DBNDatabaseFolder
)
{
containerNode
=
containerNode
.
getParentNode
();
}
containerPanel
.
setContainerInfo
(
containerNode
.
getNodeIconDefault
(),
containerNode
.
getNodeFullName
());
if
(
containerNode
instanceof
DBNDatabaseNode
)
{
containerPanel
.
setContainerInfo
((
DBNDatabaseNode
)
containerNode
);
}
}
}
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/ObjectContainerSelectorPanel.java
浏览文件 @
143686e4
...
...
@@ -17,17 +17,22 @@
*/
package
org.jkiss.dbeaver.ui.controls
;
import
org.eclipse.jface.dialogs.IDialogSettings
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.*
;
import
org.eclipse.swt.events.MouseAdapter
;
import
org.eclipse.swt.events.MouseEvent
;
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.Combo
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Label
;
import
org.eclipse.swt.widgets.Text
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.app.DBPProject
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabaseNode
;
import
org.jkiss.dbeaver.model.navigator.DBNModel
;
...
...
@@ -38,19 +43,55 @@ import org.jkiss.dbeaver.model.struct.rdb.DBSSchema;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* ObjectContainerSelectorPanel
*/
public
abstract
class
ObjectContainerSelectorPanel
extends
Composite
{
private
static
final
Log
log
=
Log
.
getLog
(
ObjectContainerSelectorPanel
.
class
);
public
static
final
int
MAX_HISTORY_LENGTH
=
20
;
private
final
DBPProject
project
;
private
final
String
selectorId
;
private
final
Label
containerIcon
;
private
final
Text
containerName
;
private
final
Combo
containerNameCombo
;
private
final
List
<
HistoryItem
>
historyItems
=
new
ArrayList
<>();
private
static
class
HistoryItem
{
private
String
containerName
;
private
String
containerPath
;
private
String
dataSourceName
;
private
DBNDatabaseNode
containerNode
;
HistoryItem
(
String
containerName
,
String
containerPath
,
String
dataSourceName
,
DBNDatabaseNode
node
)
{
this
.
containerName
=
containerName
;
this
.
containerPath
=
containerPath
;
this
.
dataSourceName
=
dataSourceName
;
this
.
containerNode
=
node
;
}
public
String
getFullName
()
{
String
dsName
=
containerNode
!=
null
?
containerNode
.
getDataSourceContainer
().
getName
()
:
dataSourceName
;
if
(
CommonUtils
.
equalObjects
(
dsName
,
containerName
))
{
return
containerName
;
}
return
containerName
+
" ["
+
dsName
+
"]"
;
}
}
protected
ObjectContainerSelectorPanel
(
Composite
parent
,
String
containerTitle
,
String
containerHint
)
{
protected
ObjectContainerSelectorPanel
(
Composite
parent
,
DBPProject
project
,
String
selectorId
,
String
containerTitle
,
String
containerHint
)
{
super
(
parent
,
SWT
.
NONE
);
this
.
project
=
project
;
this
.
selectorId
=
selectorId
;
GridLayout
layout
=
new
GridLayout
(
4
,
false
);
layout
.
marginHeight
=
0
;
layout
.
marginWidth
=
0
;
...
...
@@ -61,21 +102,26 @@ public abstract class ObjectContainerSelectorPanel extends Composite
containerIcon
=
new
Label
(
this
,
SWT
.
NONE
);
containerIcon
.
setImage
(
DBeaverIcons
.
getImage
(
DBIcon
.
TYPE_UNKNOWN
));
containerName
=
new
Text
(
this
,
SWT
.
BORDER
|
SWT
.
READ_ONLY
);
containerName
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
containerName
.
setText
(
""
);
containerName
Combo
=
new
Combo
(
this
,
SWT
.
BORDER
|
SWT
.
DROP_DOWN
|
SWT
.
READ_ONLY
);
containerName
Combo
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
containerName
Combo
.
setText
(
""
);
if
(
containerHint
!=
null
)
{
UIUtils
.
addEmptyTextHint
(
containerName
,
text
->
containerHint
);
UIUtils
.
addEmptyTextHint
(
containerName
Combo
,
text
->
containerHint
);
}
containerNameCombo
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
handleContainerChange
();
}
});
Button
browseButton
=
new
Button
(
this
,
SWT
.
PUSH
);
browseButton
.
setImage
(
DBeaverIcons
.
getImage
(
DBIcon
.
TREE_FOLDER
));
browseButton
.
setText
(
"..."
);
Runnable
containerSelector
=
()
->
{
DBPProject
activeProject
=
DBWorkbench
.
getPlatform
().
getWorkspace
().
getActiveProject
();
if
(
activeProject
!=
null
)
{
if
(
project
!=
null
)
{
final
DBNModel
navigatorModel
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
();
final
DBNProject
rootNode
=
navigatorModel
.
getRoot
().
getProjectNode
(
activeP
roject
);
final
DBNProject
rootNode
=
navigatorModel
.
getRoot
().
getProjectNode
(
p
roject
);
DBNNode
selectedNode
=
getSelectedNode
();
DBNNode
node
=
DBWorkbench
.
getPlatformUI
().
selectObject
(
getShell
(),
...
...
@@ -87,6 +133,8 @@ public abstract class ObjectContainerSelectorPanel extends Composite
new
Class
[]{
DBSSchema
.
class
});
if
(
node
instanceof
DBNDatabaseNode
)
{
setSelectedNode
((
DBNDatabaseNode
)
node
);
addNodeToHistory
((
DBNDatabaseNode
)
node
);
saveHistory
();
}
}
};
...
...
@@ -96,21 +144,141 @@ public abstract class ObjectContainerSelectorPanel extends Composite
containerSelector
.
run
();
}
});
containerName
.
addMouseListener
(
new
MouseAdapter
()
{
containerName
Combo
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseDoubleClick
(
MouseEvent
e
)
{
containerSelector
.
run
();
}
});
loadHistory
();
}
public
void
setContainerInfo
(
DBPImage
image
,
String
name
)
{
containerIcon
.
setImage
(
DBeaverIcons
.
getImage
(
image
));
containerName
.
setText
(
name
);
private
HistoryItem
addNodeToHistory
(
DBNDatabaseNode
node
)
{
for
(
int
i
=
0
;
i
<
historyItems
.
size
();
i
++)
{
HistoryItem
item
=
historyItems
.
get
(
i
);
if
(
item
.
containerPath
.
equals
(
node
.
getNodeItemPath
()))
{
item
.
containerNode
=
node
;
moveHistoryItemToBeginning
(
item
);
return
item
;
}
}
HistoryItem
newItem
=
new
HistoryItem
(
node
.
getNodeFullName
(),
node
.
getNodeItemPath
(),
node
.
getDataSourceContainer
().
getName
(),
node
);
historyItems
.
add
(
0
,
newItem
);
return
newItem
;
}
private
void
moveHistoryItemToBeginning
(
HistoryItem
item
)
{
historyItems
.
remove
(
item
);
historyItems
.
add
(
0
,
item
);
removeItemFromCombo
(
item
);
containerNameCombo
.
add
(
item
.
getFullName
(),
0
);
containerNameCombo
.
select
(
0
);
}
private
void
handleContainerChange
()
{
int
historyIndex
=
containerNameCombo
.
getSelectionIndex
();
if
(
historyIndex
>=
0
&&
historyIndex
<
historyItems
.
size
())
{
HistoryItem
historyItem
=
historyItems
.
get
(
historyIndex
);
if
(
historyItem
.
containerNode
==
null
)
{
// Load node
try
{
UIUtils
.
runInProgressDialog
(
monitor
->
{
try
{
DBNNode
node
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getNodeByPath
(
monitor
,
project
,
historyItem
.
containerPath
);
if
(
node
instanceof
DBNDatabaseNode
)
{
historyItem
.
containerNode
=
(
DBNDatabaseNode
)
node
;
}
}
catch
(
DBException
e
)
{
throw
new
InvocationTargetException
(
e
);
}
});
}
catch
(
InvocationTargetException
e
)
{
DBWorkbench
.
getPlatformUI
().
showError
(
"Bad container path"
,
"Can't find database node by path "
+
historyItem
.
containerPath
,
e
.
getTargetException
());
}
}
if
(
historyItem
.
containerNode
!=
null
)
{
setSelectedNode
(
historyItem
.
containerNode
);
moveHistoryItemToBeginning
(
historyItem
);
}
else
{
historyItems
.
remove
(
historyIndex
);
containerNameCombo
.
remove
(
historyIndex
);
}
}
//setSelectedNode(node);
}
private
void
loadHistory
()
{
IDialogSettings
historySection
=
UIUtils
.
getDialogSettings
(
"ObjectContainerSelector"
);
IDialogSettings
projectSection
=
historySection
.
getSection
(
project
.
getName
());
if
(
projectSection
!=
null
)
{
IDialogSettings
selectorSection
=
projectSection
.
getSection
(
selectorId
);
if
(
selectorSection
!=
null
)
{
for
(
int
i
=
1
;
i
<
MAX_HISTORY_LENGTH
;
i
++)
{
IDialogSettings
itemSection
=
selectorSection
.
getSection
(
"item"
+
i
);
if
(
itemSection
==
null
)
{
break
;
}
historyItems
.
add
(
new
HistoryItem
(
itemSection
.
get
(
"name"
),
itemSection
.
get
(
"path"
),
itemSection
.
get
(
"data-source"
),
null
));
}
}
}
for
(
HistoryItem
item
:
historyItems
)
{
containerNameCombo
.
add
(
item
.
getFullName
());
}
}
private
void
saveHistory
()
{
IDialogSettings
selectorHistorySection
=
UIUtils
.
getDialogSettings
(
"ObjectContainerSelector"
);
IDialogSettings
projectSection
=
UIUtils
.
getSettingsSection
(
selectorHistorySection
,
project
.
getName
());
IDialogSettings
selectorSection
=
projectSection
.
addNewSection
(
selectorId
);
for
(
int
i
=
0
;
i
<
historyItems
.
size
();
i
++)
{
HistoryItem
item
=
historyItems
.
get
(
i
);
IDialogSettings
itemSection
=
selectorSection
.
addNewSection
(
"item"
+
(
i
+
1
));
itemSection
.
put
(
"name"
,
item
.
containerName
);
itemSection
.
put
(
"path"
,
item
.
containerPath
);
itemSection
.
put
(
"data-source"
,
item
.
dataSourceName
);
}
}
public
void
setContainerInfo
(
DBNDatabaseNode
node
)
{
if
(
node
==
null
)
{
containerIcon
.
setImage
(
DBeaverIcons
.
getImage
(
DBIcon
.
TYPE_UNKNOWN
));
containerNameCombo
.
select
(-
1
);
return
;
}
HistoryItem
item
=
addNodeToHistory
(
node
);
containerIcon
.
setImage
(
DBeaverIcons
.
getImage
(
node
.
getNodeIconDefault
()));
removeItemFromCombo
(
item
);
containerNameCombo
.
add
(
item
.
getFullName
(),
0
);
containerNameCombo
.
select
(
0
);
}
private
void
removeItemFromCombo
(
HistoryItem
item
)
{
int
itemCount
=
containerNameCombo
.
getItemCount
();
for
(
int
i
=
0
;
i
<
itemCount
;
i
++)
{
if
(
containerNameCombo
.
getItem
(
i
).
equals
(
item
.
getFullName
()))
{
containerNameCombo
.
remove
(
i
);
break
;
}
}
}
protected
abstract
void
setSelectedNode
(
DBNDatabaseNode
node
);
@Nullable
protected
abstract
DBNNode
getSelectedNode
();
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录