Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
43a225ae
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,发现更多精彩内容 >>
提交
43a225ae
编写于
1月 22, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Vertical tabs, explain plan viewer
上级
6475d66d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
131 addition
and
55 deletion
+131
-55
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/views/plan/ExplainPlanViewer.java
...rc/org/jkiss/dbeaver/ui/views/plan/ExplainPlanViewer.java
+22
-11
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/VerticalButton.java
....ui/src/org/jkiss/dbeaver/ui/controls/VerticalButton.java
+60
-44
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/VerticalFolder.java
....ui/src/org/jkiss/dbeaver/ui/controls/VerticalFolder.java
+49
-0
未找到文件。
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/views/plan/ExplainPlanViewer.java
浏览文件 @
43a225ae
...
...
@@ -18,8 +18,6 @@ package org.jkiss.dbeaver.ui.views.plan;
import
org.eclipse.jface.action.Action
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.eclipse.jface.util.IPropertyChangeListener
;
import
org.eclipse.jface.util.PropertyChangeEvent
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
import
org.eclipse.jface.viewers.Viewer
;
...
...
@@ -33,7 +31,6 @@ import org.eclipse.swt.widgets.Composite;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Text
;
import
org.eclipse.ui.IWorkbenchPart
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorCommands
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
...
...
@@ -45,15 +42,19 @@ import org.jkiss.dbeaver.ui.ActionUtils;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.VerticalButton
;
import
org.jkiss.dbeaver.ui.controls.VerticalFolder
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorCommands
;
import
org.jkiss.dbeaver.ui.properties.PropertyTreeViewer
;
import
org.jkiss.utils.CommonUtils
;
/**
* ResultSetViewer
*/
public
class
ExplainPlanViewer
implements
IPropertyChangeListener
public
class
ExplainPlanViewer
{
//static final Log log = Log.getLog(ResultSetViewer.class);
private
SashForm
planPanel
;
private
Text
sqlText
;
private
PlanNodesTree
planTree
;
...
...
@@ -73,7 +74,22 @@ public class ExplainPlanViewer implements IPropertyChangeListener
super
();
createActions
();
Composite
composite
=
UIUtils
.
createPlaceholder
(
parent
,
1
);
Composite
planPresentationContainer
=
UIUtils
.
createPlaceholder
(
parent
,
2
);
planPresentationContainer
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
{
VerticalFolder
tabViewFolder
=
new
VerticalFolder
(
planPresentationContainer
,
SWT
.
LEFT
);
tabViewFolder
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_VERTICAL
));
VerticalButton
treeViewButton
=
new
VerticalButton
(
tabViewFolder
,
SWT
.
LEFT
);
treeViewButton
.
setText
(
"Simple"
);
treeViewButton
.
setImage
(
DBeaverIcons
.
getImage
(
UIIcon
.
SQL_PAGE_EXPLAIN_PLAN
));
treeViewButton
.
setLayoutData
(
new
GridData
(
GridData
.
VERTICAL_ALIGN_BEGINNING
));
//Composite ph = new Composite(tabViewFolder, SWT.NONE);
//ph.setLayoutData(new GridData(GridData.FILL_VERTICAL));
}
Composite
composite
=
UIUtils
.
createPlaceholder
(
planPresentationContainer
,
1
);
composite
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
this
.
planPanel
=
UIUtils
.
createPartDivider
(
workbenchPart
,
composite
,
SWT
.
HORIZONTAL
);
this
.
planPanel
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
...
...
@@ -172,7 +188,7 @@ public class ExplainPlanViewer implements IPropertyChangeListener
public
Control
getControl
()
{
return
planPanel
.
getParent
();
return
planPanel
.
getParent
()
.
getParent
()
;
}
public
Viewer
getViewer
()
...
...
@@ -180,11 +196,6 @@ public class ExplainPlanViewer implements IPropertyChangeListener
return
planTree
.
getItemsViewer
();
}
@Override
public
void
propertyChange
(
PropertyChangeEvent
event
)
{
}
public
void
explainQueryPlan
(
DBCExecutionContext
executionContext
,
SQLQuery
query
)
throws
DBCException
{
this
.
executionContext
=
executionContext
;
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/
Rotating
Button.java
→
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/
Vertical
Button.java
浏览文件 @
43a225ae
...
...
@@ -18,73 +18,55 @@ package org.jkiss.dbeaver.ui.controls;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.*
;
import
org.eclipse.swt.graphics.Point
;
import
org.eclipse.swt.graphics.Rectangle
;
import
org.eclipse.swt.graphics.Transform
;
import
org.eclipse.swt.graphics.*
;
import
org.eclipse.swt.widgets.Canvas
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Event
;
import
org.jkiss.dbeaver.ui.UIUtils
;
public
class
VerticalButton
extends
Canvas
{
public
static
final
int
BORDER_MARGIN
=
2
;
public
static
final
int
VERT_INDENT
=
8
;
public
class
RotatingButton
extends
Canvas
{
private
int
mouse
=
0
;
private
boolean
hit
=
false
;
private
String
text
=
"Button"
;
float
rotatingAngle
=
0
f
;
float
[]
angles
=
{
0
,
90
,
180
,
270
};
int
index
=
0
;
p
ublic
RotatingButton
(
Composite
parent
,
int
style
)
{
super
(
parent
,
style
)
;
p
rivate
String
text
=
""
;
private
Image
image
=
null
;
this
.
addListener
(
SWT
.
MouseUp
,
e
->
{
index
++
;
index
=
index
>
3
?
0
:
index
;
Rectangle
r
=
getBounds
()
;
private
float
rotatingAngle
=
-
90
;
private
boolean
isHover
;
//float[] angles = {0, 90, 180, 270}
;
//int index = 0
;
setBounds
(
r
.
x
,
r
.
y
,
r
.
height
,
r
.
width
);
public
VerticalButton
(
Composite
parent
,
int
style
)
{
super
(
parent
,
style
);
rotatingAngle
=
angles
[
index
];
redraw
();
});
this
.
addPaintListener
(
this
::
paint
);
this
.
addMouseMoveListener
(
e
->
{
if
(!
hit
)
return
;
mouse
=
2
;
if
(
e
.
x
<
0
||
e
.
y
<
0
||
e
.
x
>
getBounds
().
width
||
e
.
y
>
getBounds
().
height
)
{
mouse
=
0
;
}
redraw
();
});
this
.
addMouseTrackListener
(
new
MouseTrackAdapter
()
{
public
void
mouseEnter
(
MouseEvent
e
)
{
mouse
=
1
;
isHover
=
true
;
redraw
();
}
public
void
mouseExit
(
MouseEvent
e
)
{
mouse
=
0
;
isHover
=
false
;
redraw
();
}
});
this
.
addMouseListener
(
new
MouseAdapter
()
{
public
void
mouseDown
(
MouseEvent
e
)
{
hit
=
true
;
mouse
=
2
;
redraw
();
}
public
void
mouseUp
(
MouseEvent
e
)
{
hit
=
false
;
mouse
=
1
;
if
(
e
.
x
<
0
||
e
.
y
<
0
||
e
.
x
>
getBounds
().
width
||
e
.
y
>
getBounds
().
height
)
{
mouse
=
0
;
}
redraw
();
if
(
mouse
==
1
)
if
(
hit
)
{
notifyListeners
(
SWT
.
Selection
,
new
Event
());
}
}
});
this
.
addKeyListener
(
new
KeyAdapter
()
{
...
...
@@ -102,19 +84,53 @@ public class RotatingButton extends Canvas {
redraw
();
}
public
void
setImage
(
Image
image
)
{
this
.
image
=
image
;
redraw
();
}
@Override
public
Point
computeSize
(
int
wHint
,
int
hHint
,
boolean
changed
)
{
GC
gc
=
new
GC
(
this
);
Point
textSize
=
gc
.
stringExtent
(
text
);
gc
.
dispose
();
Point
iconSize
=
new
Point
(
0
,
0
);
if
(
image
!=
null
)
{
Rectangle
imageBounds
=
image
.
getBounds
();
iconSize
.
x
=
imageBounds
.
width
+
BORDER_MARGIN
;
iconSize
.
y
=
imageBounds
.
height
+
BORDER_MARGIN
*
2
;
}
return
new
Point
(
Math
.
max
(
iconSize
.
y
,
textSize
.
y
+
BORDER_MARGIN
*
2
),
textSize
.
x
+
(
BORDER_MARGIN
+
VERT_INDENT
)
*
2
+
iconSize
.
x
);
}
public
void
paint
(
PaintEvent
e
)
{
if
(
isHover
)
{
Color
curBackground
=
e
.
gc
.
getBackground
();
// Make bg a bit darker
RGB
buttonHoverRGB
=
UIUtils
.
blend
(
curBackground
.
getRGB
(),
new
RGB
(
0
,
0
,
0
),
90
);
Color
buttonHoverColor
=
UIUtils
.
getSharedTextColors
().
getColor
(
buttonHoverRGB
);
e
.
gc
.
setBackground
(
buttonHoverColor
);
e
.
gc
.
fillRectangle
(
e
.
x
,
e
.
y
,
e
.
width
,
e
.
height
);
}
Transform
tr
=
new
Transform
(
e
.
display
);
Rectangle
r
=
getBounds
();
text
=
e
.
gc
.
stringExtent
(
text
)
+
""
;
e
.
gc
.
setAntialias
(
SWT
.
ON
);
Point
p
=
e
.
gc
.
stringExtent
(
text
);
int
w
=
e
.
width
;
int
h
=
e
.
height
;
tr
.
translate
(
w
/
2
,
h
/
2
);
tr
.
translate
(
0
,
e
.
height
);
tr
.
rotate
(
rotatingAngle
);
e
.
gc
.
setTransform
(
tr
);
e
.
gc
.
drawString
(
text
,
r
.
x
-
(
p
.
x
/
3
)
*
2
,
r
.
y
-
p
.
y
);
int
x
=
e
.
x
+
VERT_INDENT
;
if
(
image
!=
null
)
{
e
.
gc
.
drawImage
(
image
,
x
,
e
.
y
+
BORDER_MARGIN
);
x
+=
image
.
getBounds
().
width
+
BORDER_MARGIN
;
}
e
.
gc
.
drawString
(
text
,
x
,
e
.
y
+
BORDER_MARGIN
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/VerticalFolder.java
0 → 100644
浏览文件 @
43a225ae
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.controls
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Point
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Canvas
;
import
org.eclipse.swt.widgets.Composite
;
public
class
VerticalFolder
extends
Canvas
{
private
boolean
isLeft
;
public
VerticalFolder
(
Composite
parent
,
int
style
)
{
super
(
parent
,
style
);
this
.
isLeft
=
(
style
&
SWT
.
LEFT
)
==
SWT
.
LEFT
;
GridLayout
gl
=
new
GridLayout
(
1
,
true
);
gl
.
horizontalSpacing
=
0
;
gl
.
marginWidth
=
0
;
this
.
setLayout
(
gl
);
}
public
boolean
isLeft
()
{
return
isLeft
;
}
@Override
public
Point
computeSize
(
int
wHint
,
int
hHint
,
boolean
changed
)
{
Point
size
=
super
.
computeSize
(
wHint
,
hHint
,
changed
);
return
size
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录