Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
df407d47
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,发现更多精彩内容 >>
提交
df407d47
编写于
5月 11, 2021
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#12361 Checkbox behavior & lf fixes
上级
39dfb218
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
53 addition
and
28 deletion
+53
-28
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/CustomCheckboxCellEditor.java
...g/jkiss/dbeaver/ui/controls/CustomCheckboxCellEditor.java
+53
-28
未找到文件。
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/CustomCheckboxCellEditor.java
浏览文件 @
df407d47
...
...
@@ -20,10 +20,9 @@ import org.eclipse.core.runtime.Assert;
import
org.eclipse.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.FocusAdapter
;
import
org.eclipse.swt.events.FocusEvent
;
import
org.eclipse.swt.events.MouseAdapter
;
import
org.eclipse.swt.events.MouseEvent
;
import
org.eclipse.swt.events.*
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Label
;
...
...
@@ -48,21 +47,59 @@ public class CustomCheckboxCellEditor extends CellEditor {
@Override
protected
Control
createControl
(
Composite
parent
)
{
//Composite ph = UIUtils.createPlaceholder(parent, 1);
checkBox
=
new
Label
(
parent
,
SWT
.
NONE
);
//setCheckIcon();
checkBox
.
setFont
(
parent
.
getFont
());
checkBox
.
setBackground
(
null
);
checkBox
.
addFocusListener
(
new
FocusAdapter
()
{
Composite
ph
=
new
Composite
(
parent
,
SWT
.
NONE
);
GridLayout
gl
=
new
GridLayout
(
1
,
false
);
gl
.
marginWidth
=
0
;
gl
.
marginHeight
=
0
;
ph
.
setLayout
(
gl
);
ph
.
setBackground
(
parent
.
getBackground
());
checkBox
=
new
Label
(
ph
,
SWT
.
NONE
);
GridData
gd
=
new
GridData
(
SWT
.
CENTER
,
SWT
.
FILL
,
true
,
true
);
checkBox
.
setLayoutData
(
gd
);
checkBox
.
setBackground
(
ph
.
getBackground
());
ph
.
addFocusListener
(
new
FocusAdapter
()
{
@Override
public
void
focusLost
(
FocusEvent
e
)
{
CustomCheckboxCellEditor
.
this
.
focusLost
();
}
});
addMouseListener
();
ph
.
addKeyListener
(
new
KeyListener
()
{
@Override
public
void
keyPressed
(
KeyEvent
e
)
{
switch
(
e
.
character
)
{
case
SWT
.
ESC
:
dispose
();
break
;
case
SWT
.
SPACE
:
checked
=
!
checked
;
setCheckIcon
();
applyEditorValue
();
break
;
case
SWT
.
CR
:
applyEditorValue
();
fireApplyEditorValue
();
break
;
}
}
return
checkBox
;
@Override
public
void
keyReleased
(
KeyEvent
e
)
{
}
});
checkBox
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseDown
(
MouseEvent
e
)
{
checked
=
!
checked
;
setCheckIcon
();
applyEditorValue
();
//fireApplyEditorValue();
}
});
return
ph
;
}
private
void
setCheckIcon
()
{
...
...
@@ -81,7 +118,7 @@ public class CustomCheckboxCellEditor extends CellEditor {
@Override
protected
void
doSetFocus
()
{
checkBox
.
setFocus
();
checkBox
.
getParent
().
setFocus
();
}
@Override
...
...
@@ -98,7 +135,7 @@ public class CustomCheckboxCellEditor extends CellEditor {
layoutData
.
grabHorizontal
=
true
;
layoutData
.
horizontalAlignment
=
SWT
.
LEFT
;
}
else
{
layoutData
.
grabHorizontal
=
fals
e
;
layoutData
.
grabHorizontal
=
tru
e
;
layoutData
.
horizontalAlignment
=
SWT
.
CENTER
;
}
return
layoutData
;
...
...
@@ -135,21 +172,9 @@ public class CustomCheckboxCellEditor extends CellEditor {
}
}
private
void
addMouseListener
()
{
checkBox
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseDown
(
MouseEvent
e
)
{
checked
=
!
checked
;
setCheckIcon
();
applyEditorValue
();
fireApplyEditorValue
();
}
});
}
@Override
public
void
activate
(
ColumnViewerEditorActivationEvent
activationEvent
)
{
if
(
activationEvent
.
eventType
!=
ColumnViewerEditorActivationEvent
.
TRAVERSAL
)
{
/*if (activationEvent.eventType != ColumnViewerEditorActivationEvent.TRAVERSAL) */
{
super
.
activate
(
activationEvent
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录