Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
f9c8e8e9
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,发现更多精彩内容 >>
提交
f9c8e8e9
编写于
11月 22, 2012
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
VCC minor fixes
上级
1ca9ecdb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
43 deletion
+17
-43
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/ViewerColumnController.java
...core/src/org/jkiss/dbeaver/ui/ViewerColumnController.java
+17
-43
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/ViewerColumnController.java
浏览文件 @
f9c8e8e9
...
...
@@ -9,7 +9,6 @@ import org.eclipse.jface.viewers.*;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.ControlAdapter
;
import
org.eclipse.swt.events.ControlEvent
;
import
org.eclipse.swt.events.ControlListener
;
import
org.eclipse.swt.graphics.Point
;
import
org.eclipse.swt.graphics.Rectangle
;
import
org.eclipse.swt.widgets.*
;
...
...
@@ -27,7 +26,6 @@ public class ViewerColumnController {
private
final
String
configId
;
private
final
ColumnViewer
viewer
;
private
boolean
columnsMovable
=
true
;
private
final
List
<
ColumnInfo
>
columns
=
new
ArrayList
<
ColumnInfo
>();
private
boolean
clickOnHeader
;
...
...
@@ -142,21 +140,13 @@ public class ViewerColumnController {
final
TreeViewerColumn
item
=
new
TreeViewerColumn
((
TreeViewer
)
viewer
,
columnInfo
.
style
);
final
TreeColumn
column
=
item
.
getColumn
();
column
.
setText
(
columnInfo
.
name
);
column
.
setMoveable
(
columnsMovabl
e
);
column
.
setMoveable
(
tru
e
);
column
.
setWidth
(
columnInfo
.
width
);
if
(!
CommonUtils
.
isEmpty
(
columnInfo
.
description
))
{
column
.
setToolTipText
(
columnInfo
.
description
);
}
item
.
setLabelProvider
(
columnInfo
.
labelProvider
);
column
.
addControlListener
(
new
ControlListener
()
{
@Override
public
void
controlMoved
(
ControlEvent
e
)
{
// if (orderChanged(column.getParent().getColumnOrder())) {
// updateColumnOrder(column.getParent().getColumns(), column.getParent().getColumnOrder());
// }
}
column
.
addControlListener
(
new
ControlAdapter
()
{
@Override
public
void
controlResized
(
ControlEvent
e
)
{
...
...
@@ -169,21 +159,13 @@ public class ViewerColumnController {
final
TableViewerColumn
item
=
new
TableViewerColumn
((
TableViewer
)
viewer
,
columnInfo
.
style
);
final
TableColumn
column
=
item
.
getColumn
();
column
.
setText
(
columnInfo
.
name
);
column
.
setMoveable
(
columnsMovabl
e
);
column
.
setMoveable
(
tru
e
);
column
.
setWidth
(
columnInfo
.
width
);
if
(!
CommonUtils
.
isEmpty
(
columnInfo
.
description
))
{
column
.
setToolTipText
(
columnInfo
.
description
);
}
item
.
setLabelProvider
(
columnInfo
.
labelProvider
);
column
.
addControlListener
(
new
ControlListener
()
{
@Override
public
void
controlMoved
(
ControlEvent
e
)
{
// if (orderChanged(column.getParent().getColumnOrder())) {
// updateColumnOrder(column.getParent().getColumns(), column.getParent().getColumnOrder());
// }
}
column
.
addControlListener
(
new
ControlAdapter
()
{
@Override
public
void
controlResized
(
ControlEvent
e
)
{
...
...
@@ -226,13 +208,7 @@ public class ViewerColumnController {
private
Collection
<
ColumnInfo
>
getVisibleColumns
()
{
Set
<
ColumnInfo
>
visibleList
=
new
TreeSet
<
ColumnInfo
>(
new
Comparator
<
ColumnInfo
>()
{
@Override
public
int
compare
(
ColumnInfo
o1
,
ColumnInfo
o2
)
{
return
o1
.
order
-
o2
.
order
;
}
});
Set
<
ColumnInfo
>
visibleList
=
new
TreeSet
<
ColumnInfo
>(
new
ColumnInfoComparator
());
for
(
ColumnInfo
column
:
columns
)
{
if
(
column
.
visible
)
{
visibleList
.
add
(
column
);
...
...
@@ -307,13 +283,6 @@ public class ViewerColumnController {
this
.
labelProvider
=
labelProvider
;
this
.
order
=
order
;
}
public
int
getWidth
()
{
return
column
instanceof
TreeColumn
?
((
TreeColumn
)
column
).
getWidth
()
:
(
column
instanceof
TableColumn
?
((
TableColumn
)
column
).
getWidth
()
:
0
);
}
}
private
class
ConfigDialog
extends
Dialog
{
...
...
@@ -338,18 +307,15 @@ public class ViewerColumnController {
UIUtils
.
createControlLabel
(
composite
,
"Select columns you want to display"
);
Set
<
ColumnInfo
>
orderedList
=
new
TreeSet
<
ColumnInfo
>(
new
Comparator
<
ColumnInfo
>()
{
@Override
public
int
compare
(
ColumnInfo
o1
,
ColumnInfo
o2
)
{
return
o1
.
order
-
o2
.
order
;
}
});
Set
<
ColumnInfo
>
orderedList
=
new
TreeSet
<
ColumnInfo
>(
new
ColumnInfoComparator
());
orderedList
.
addAll
(
columns
);
for
(
ColumnInfo
columnInfo
:
orderedList
)
{
Button
check
=
new
Button
(
composite
,
SWT
.
CHECK
);
check
.
setText
(
columnInfo
.
name
);
check
.
setSelection
(
columnInfo
.
visible
);
if
(!
CommonUtils
.
isEmpty
(
columnInfo
.
description
))
{
check
.
setToolTipText
(
columnInfo
.
description
);
}
if
(
columnInfo
.
required
)
{
check
.
setEnabled
(
false
);
}
...
...
@@ -374,6 +340,14 @@ public class ViewerColumnController {
}
super
.
okPressed
();
}
}
private
static
class
ColumnInfoComparator
implements
Comparator
<
ColumnInfo
>
{
@Override
public
int
compare
(
ColumnInfo
o1
,
ColumnInfo
o2
)
{
return
o1
.
order
-
o2
.
order
;
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录