Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
39210761
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,发现更多精彩内容 >>
提交
39210761
编写于
9月 20, 2016
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Content viewer refactoring
上级
0ed6349b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
27 deletion
+44
-27
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ContentPanelEditor.java
...org/jkiss/dbeaver/ui/data/editors/ContentPanelEditor.java
+44
-27
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ContentPanelEditor.java
浏览文件 @
39210761
...
...
@@ -23,9 +23,9 @@ import org.eclipse.jface.action.Separator;
import
org.eclipse.jface.resource.JFaceResources
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.ImageLoader
;
import
org.eclipse.swt.
widgets.Composite
;
import
org.eclipse.swt.
widgets.Control
;
import
org.eclipse.swt.widgets.
Text
;
import
org.eclipse.swt.
graphics.Point
;
import
org.eclipse.swt.
graphics.Rectangle
;
import
org.eclipse.swt.widgets.
*
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
...
...
@@ -43,7 +43,6 @@ import org.jkiss.dbeaver.ui.DBeaverIcons;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.controls.imageview.ImageViewer
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditorStandalone
;
import
org.jkiss.dbeaver.ui.editors.binary.BinaryContent
;
import
org.jkiss.dbeaver.ui.editors.binary.HexEditControl
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
...
...
@@ -56,7 +55,7 @@ import java.nio.ByteBuffer;
/**
* ControlPanelEditor
*/
public
class
ContentPanelEditor
extends
BaseValueEditor
<
Control
>
implements
IValueEditorStandalone
{
public
class
ContentPanelEditor
extends
BaseValueEditor
<
Control
>
{
private
static
final
Log
log
=
Log
.
getLog
(
ContentPanelEditor
.
class
);
...
...
@@ -64,18 +63,9 @@ public class ContentPanelEditor extends BaseValueEditor<Control> implements IVal
super
(
controller
);
}
@Override
public
void
showValueEditor
()
{
}
@Override
public
void
closeValueEditor
()
{
}
@Override
public
void
contributeActions
(
@NotNull
IContributionManager
manager
,
@NotNull
IValueController
controller
)
throws
DBCException
{
manager
.
add
(
new
ContentTypeSwitchAction
());
if
(
control
instanceof
ImageViewer
)
{
((
ImageViewer
)
control
).
fillToolBar
(
manager
);
manager
.
add
(
new
Separator
());
...
...
@@ -242,24 +232,51 @@ public class ContentPanelEditor extends BaseValueEditor<Control> implements IVal
{
if
(!
content
.
isNull
())
{
try
{
try
(
InputStream
contentStream
=
content
.
getContents
(
monitor
).
getContentStream
())
{
/*
FileFormat.load(contentStream, new ImageLoader() {
public ImageData[] load(InputStream stream) {
return null;
}
});
*/
new
ImageLoader
().
load
(
contentStream
);
DBDContentStorage
contents
=
content
.
getContents
(
monitor
);
if
(
contents
!=
null
)
{
try
(
InputStream
contentStream
=
contents
.
getContentStream
())
{
new
ImageLoader
().
load
(
contentStream
);
}
isImage
=
true
;
}
isImage
=
true
;
}
catch
(
Exception
e
)
{
// this is not an image
log
.
debug
(
e
.
getMessage
());
log
.
debug
(
"Can't detect image type: "
+
e
.
getMessage
());
}
}
}
}
private
class
ContentTypeSwitchAction
extends
Action
{
private
Menu
menu
;
public
ContentTypeSwitchAction
()
{
super
(
"Text"
,
Action
.
AS_DROP_DOWN_MENU
);
}
@Override
public
void
runWithEvent
(
Event
event
)
{
if
(
event
.
widget
instanceof
ToolItem
)
{
ToolItem
toolItem
=
(
ToolItem
)
event
.
widget
;
Menu
menu
=
createMenu
(
toolItem
);
Rectangle
bounds
=
toolItem
.
getBounds
();
Point
point
=
toolItem
.
getControl
().
toDisplay
(
bounds
.
x
,
bounds
.
y
+
bounds
.
height
);
menu
.
setLocation
(
point
.
x
,
point
.
y
);
menu
.
setVisible
(
true
);
}
}
private
Menu
createMenu
(
ToolItem
toolItem
)
{
if
(
menu
==
null
)
{
menu
=
new
Menu
(
toolItem
.
getParent
());
new
MenuItem
(
menu
,
SWT
.
NONE
).
setText
(
"Text"
);
new
MenuItem
(
menu
,
SWT
.
NONE
).
setText
(
"Image"
);
new
MenuItem
(
menu
,
SWT
.
NONE
).
setText
(
"Hex"
);
}
return
menu
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录