Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d37b3795
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,发现更多精彩内容 >>
提交
d37b3795
编写于
7月 01, 2021
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#11533 Extra panels layout (menu and toolbar)
上级
fefe0eb3
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
205 addition
and
27 deletion
+205
-27
plugins/org.jkiss.dbeaver.ui.editors.sql/OSGI-INF/l10n/bundle.properties
...ss.dbeaver.ui.editors.sql/OSGI-INF/l10n/bundle.properties
+3
-0
plugins/org.jkiss.dbeaver.ui.editors.sql/plugin.xml
plugins/org.jkiss.dbeaver.ui.editors.sql/plugin.xml
+31
-3
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
...s.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
+111
-24
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorOutputConsoleViewer.java
.../dbeaver/ui/editors/sql/SQLEditorOutputConsoleViewer.java
+4
-0
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLPreferenceConstants.java
.../jkiss/dbeaver/ui/editors/sql/SQLPreferenceConstants.java
+4
-0
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/handlers/SQLEditorHandlerToggleExtraPanels.java
...itors/sql/handlers/SQLEditorHandlerToggleExtraPanels.java
+52
-0
未找到文件。
plugins/org.jkiss.dbeaver.ui.editors.sql/OSGI-INF/l10n/bundle.properties
浏览文件 @
d37b3795
...
@@ -95,6 +95,8 @@ command.org.jkiss.dbeaver.ui.editors.sql.show.log.name=Show execution log
...
@@ -95,6 +95,8 @@ command.org.jkiss.dbeaver.ui.editors.sql.show.log.name=Show execution log
command.org.jkiss.dbeaver.ui.editors.sql.show.log.description
=
Show SQL execution log
command.org.jkiss.dbeaver.ui.editors.sql.show.log.description
=
Show SQL execution log
command.org.jkiss.dbeaver.ui.editors.sql.show.variables.name
=
Show SQL variables
command.org.jkiss.dbeaver.ui.editors.sql.show.variables.name
=
Show SQL variables
command.org.jkiss.dbeaver.ui.editors.sql.show.variables.description
=
Show active SQL variables
command.org.jkiss.dbeaver.ui.editors.sql.show.variables.description
=
Show active SQL variables
command.org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanel.name
=
Show panels in result tabs
command.org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanel.description
=
Show panels in result tabs instead of SQL editor pane
command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.name
=
Toggle results panel
command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.name
=
Toggle results panel
command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.description
=
Show/hide results panel
command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.description
=
Show/hide results panel
...
@@ -143,6 +145,7 @@ menu.sqleditor=&SQL Editor
...
@@ -143,6 +145,7 @@ menu.sqleditor=&SQL Editor
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.execute.label
=
Execute
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.execute.label
=
Execute
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.file.label
=
File
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.file.label
=
File
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.layout.label
=
Layout
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.layout.label
=
Layout
menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.extraPanels.label
=
Panels
themeElementCategory.org.jkiss.dbeaver.ui.presentation.sql.label
=
SQL Editor
themeElementCategory.org.jkiss.dbeaver.ui.presentation.sql.label
=
SQL Editor
themeElementCategory.org.jkiss.dbeaver.ui.presentation.sql.description
=
SQL Editor
themeElementCategory.org.jkiss.dbeaver.ui.presentation.sql.description
=
SQL Editor
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/plugin.xml
浏览文件 @
d37b3795
...
@@ -234,9 +234,12 @@
...
@@ -234,9 +234,12 @@
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.run.expression"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.run.expression.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.run.expression.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.run.expression"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.run.expression.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.run.expression.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.query.next"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.next.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.next.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.query.next"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.next.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.next.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.query.prev"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.prev.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.prev.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.query.prev"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.prev.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.query.prev.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.show.output"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.output.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.output.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.show.output"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.output.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.output.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.show.log"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.log.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.log.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.show.log"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.log.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.log.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.show.variables"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.variables.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.variables.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.show.variables"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.variables.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.show.variables.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanels"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.switch.panel"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.switch.panel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.switch.panel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
<command
id=
"org.jkiss.dbeaver.ui.editors.sql.switch.panel"
name=
"%command.org.jkiss.dbeaver.ui.editors.sql.switch.panel.name"
description=
"%command.org.jkiss.dbeaver.ui.editors.sql.switch.panel.description"
categoryId=
"org.jkiss.dbeaver.core.sql"
/>
...
@@ -462,6 +465,10 @@
...
@@ -462,6 +465,10 @@
<handler
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.variables"
class=
"org.jkiss.dbeaver.ui.editors.sql.handlers.SQLEditorHandlerSwitchPanel"
>
<handler
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.variables"
class=
"org.jkiss.dbeaver.ui.editors.sql.handlers.SQLEditorHandlerSwitchPanel"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.ui.sql.editor"
/></enabledWhen>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.ui.sql.editor"
/></enabledWhen>
</handler>
</handler>
<handler
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanels"
class=
"org.jkiss.dbeaver.ui.editors.sql.handlers.SQLEditorHandlerToggleExtraPanels"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.ui.sql.editor"
/></enabledWhen>
</handler>
<handler
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
class=
"org.jkiss.dbeaver.ui.editors.sql.handlers.SQLEditorHandlerToggleResultsPanel"
>
<handler
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
class=
"org.jkiss.dbeaver.ui.editors.sql.handlers.SQLEditorHandlerToggleResultsPanel"
>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.ui.sql.editor"
/></enabledWhen>
<enabledWhen><reference
definitionId=
"org.jkiss.dbeaver.core.ui.sql.editor"
/></enabledWhen>
</handler>
</handler>
...
@@ -837,11 +844,23 @@
...
@@ -837,11 +844,23 @@
</with>
</with>
</visibleWhen>
</visibleWhen>
</command>
</command>
<separator
name=
"layout"
visible=
"true"
/>
<separator
name=
"layout"
visible=
"true"
/>
<menu
label=
"%menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.extraPanels.label"
>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.output"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.log"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.variables"
/>
<separator
name=
"panels_config"
visible=
"true"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanels"
style=
"toggle"
/>
</menu>
<menu
label=
"%menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.layout.label"
>
<dynamic
id=
"org.jkiss.dbeaver.ui.editors.sql.SQLEditor.layout.resultSet.orientation"
class=
"org.jkiss.dbeaver.ui.editors.sql.SQLEditor$ResultSetOrientationMenuContributor"
/>
<separator
name=
"layout_toggles"
visible=
"true"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.result.panel"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel"
style=
"push
"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.maximize.result.panel
"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.switch.panel"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.switch.panel"
/>
</menu>
<separator
name=
"context"
visible=
"true"
/>
<separator
name=
"context"
visible=
"true"
/>
...
@@ -896,6 +915,15 @@
...
@@ -896,6 +915,15 @@
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.switch.panel"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.switch.panel"
/>
</menu>
</menu>
</menuContribution>
</menuContribution>
<menuContribution
allPopups=
"false"
locationURI=
"popup:org.jkiss.dbeaver.ui.editors.sql.SQLEditor.EditorContext?after=sql.extras"
>
<menu
id=
"org.jkiss.dbeaver.ui.editors.sql.SQLEditor.extraPanels"
label=
"%menu.org.jkiss.dbeaver.ui.editors.sql.SQLEditor.extraPanels.label"
>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.output"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.log"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.show.variables"
/>
<separator
name=
"panels_config"
visible=
"true"
/>
<command
commandId=
"org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanels"
style=
"toggle"
/>
</menu>
</menuContribution>
<menuContribution
allPopups=
"false"
locationURI=
"popup:org.jkiss.dbeaver.ui.editors.sql.SQLEditor.EditorContext?after=group.copy"
>
<menuContribution
allPopups=
"false"
locationURI=
"popup:org.jkiss.dbeaver.ui.editors.sql.SQLEditor.EditorContext?after=group.copy"
>
<command
commandId=
"org.jkiss.dbeaver.core.edit.copy.special"
/>
<command
commandId=
"org.jkiss.dbeaver.core.edit.copy.special"
/>
</menuContribution>
</menuContribution>
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
d37b3795
...
@@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.*;
...
@@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.*;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.actions.CompoundContributionItem
;
import
org.eclipse.ui.actions.CompoundContributionItem
;
import
org.eclipse.ui.ide.FileStoreEditorInput
;
import
org.eclipse.ui.ide.FileStoreEditorInput
;
import
org.eclipse.ui.menus.CommandContributionItem
;
import
org.eclipse.ui.texteditor.DefaultRangeIndicator
;
import
org.eclipse.ui.texteditor.DefaultRangeIndicator
;
import
org.eclipse.ui.texteditor.ITextEditorActionConstants
;
import
org.eclipse.ui.texteditor.ITextEditorActionConstants
;
import
org.eclipse.ui.texteditor.rulers.IColumnSupport
;
import
org.eclipse.ui.texteditor.rulers.IColumnSupport
;
...
@@ -1084,10 +1085,7 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1084,10 +1085,7 @@ public class SQLEditor extends SQLEditorBase implements
});
});
// Extra views
// Extra views
//planView = new ExplainPlanViewer(this, resultTabs);
createExtraViewControls
();
logViewer
=
new
SQLLogPanel
(
sqlExtraPanelFolder
,
this
);
variablesViewer
=
new
SQLVariablesPanel
(
sqlExtraPanelFolder
,
this
);
outputViewer
=
new
SQLEditorOutputConsoleViewer
(
getSite
(),
sqlExtraPanelFolder
,
SWT
.
NONE
);
// Create results tab
// Create results tab
createQueryProcessor
(
true
,
true
);
createQueryProcessor
(
true
,
true
);
...
@@ -1272,25 +1270,111 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1272,25 +1270,111 @@ public class SQLEditor extends SQLEditorBase implements
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// Panels
// Panels
public
void
toggleExtraPanelsLayout
()
{
CTabItem
outTab
=
getExtraViewTab
(
outputViewer
.
getControl
());
CTabItem
logTab
=
getExtraViewTab
(
logViewer
);
CTabItem
varTab
=
getExtraViewTab
(
variablesViewer
);
if
(
outTab
!=
null
)
outTab
.
dispose
();
if
(
logTab
!=
null
)
logTab
.
dispose
();
if
(
varTab
!=
null
)
varTab
.
dispose
();
IPreferenceStore
preferenceStore
=
getPreferenceStore
();
String
epLocation
=
getExtraPanelsLocation
();
if
(
SQLPreferenceConstants
.
LOCATION_RESULTS
.
equals
(
epLocation
))
{
epLocation
=
SQLPreferenceConstants
.
LOCATION_RIGHT
;
}
else
{
epLocation
=
SQLPreferenceConstants
.
LOCATION_RESULTS
;
}
preferenceStore
.
setValue
(
SQLPreferenceConstants
.
EXTRA_PANEL_LOCATION
,
epLocation
);
createExtraViewControls
();
if
(
outTab
!=
null
)
showOutputPanel
();
if
(
logTab
!=
null
)
showExecutionLogPanel
();
if
(
varTab
!=
null
)
showVariablesPanel
();
}
public
String
getExtraPanelsLocation
()
{
return
getPreferenceStore
().
getString
(
SQLPreferenceConstants
.
EXTRA_PANEL_LOCATION
);
}
private
void
createExtraViewControls
()
{
if
(
logViewer
!=
null
)
{
logViewer
.
dispose
();
logViewer
=
null
;
}
if
(
variablesViewer
!=
null
)
{
variablesViewer
.
dispose
();
variablesViewer
=
null
;
}
if
(
outputViewer
!=
null
)
{
outputViewer
.
dispose
();
outputViewer
=
null
;
}
if
(
sqlExtraPanelFolder
!=
null
)
{
for
(
CTabItem
ti
:
sqlExtraPanelFolder
.
getItems
())
{
ti
.
dispose
();
}
}
//planView = new ExplainPlanViewer(this, resultTabs);
CTabFolder
folder
=
getFolderForExtraPanels
();
logViewer
=
new
SQLLogPanel
(
folder
,
this
);
variablesViewer
=
new
SQLVariablesPanel
(
folder
,
this
);
outputViewer
=
new
SQLEditorOutputConsoleViewer
(
getSite
(),
folder
,
SWT
.
NONE
);
if
(
getFolderForExtraPanels
()
!=
sqlExtraPanelFolder
)
{
sqlExtraPanelSash
.
setMaximizedControl
(
sqlExtraPanelSash
.
getChildren
()[
0
]);
}
}
private
CTabFolder
getFolderForExtraPanels
()
{
CTabFolder
folder
=
this
.
sqlExtraPanelFolder
;
String
epLocation
=
getExtraPanelsLocation
();
if
(
SQLPreferenceConstants
.
LOCATION_RESULTS
.
equals
(
epLocation
))
{
folder
=
resultTabs
;
}
return
folder
;
}
private
CTabItem
getExtraViewTab
(
Control
control
)
{
CTabFolder
tabFolder
=
this
.
getFolderForExtraPanels
();
for
(
CTabItem
item
:
tabFolder
.
getItems
())
{
if
(
item
.
getData
()
==
control
)
{
return
item
;
}
}
return
null
;
}
private
void
showExtraView
(
final
String
commandId
,
String
name
,
String
toolTip
,
Image
image
,
Control
view
,
IActionContributor
actionContributor
)
{
private
void
showExtraView
(
final
String
commandId
,
String
name
,
String
toolTip
,
Image
image
,
Control
view
,
IActionContributor
actionContributor
)
{
VerticalButton
viewItem
=
getViewToolItem
(
commandId
);
VerticalButton
viewItem
=
getViewToolItem
(
commandId
);
if
(
viewItem
==
null
)
{
if
(
viewItem
==
null
)
{
log
.
warn
(
"Tool item for command "
+
commandId
+
" not found"
);
log
.
warn
(
"Tool item for command "
+
commandId
+
" not found"
);
return
;
return
;
}
}
for
(
CTabItem
item
:
sqlExtraPanelFolder
.
getItems
())
{
CTabFolder
tabFolder
=
this
.
getFolderForExtraPanels
();
if
(
item
.
getData
()
==
view
)
{
CTabItem
curItem
=
getExtraViewTab
(
view
);
if
(
curItem
!=
null
)
{
// Close tab if it is already open
// Close tab if it is already open
viewItem
.
setChecked
(
false
);
viewItem
.
setChecked
(
false
);
viewItem
.
redraw
();
viewItem
.
redraw
();
i
tem
.
dispose
();
curI
tem
.
dispose
();
return
;
return
;
}
}
}
boolean
isTabsToTheRight
=
tabFolder
==
sqlExtraPanelFolder
;
if
(
isTabsToTheRight
)
{
if
(
sqlExtraPanelSash
.
getMaximizedControl
()
!=
null
)
{
if
(
sqlExtraPanelSash
.
getMaximizedControl
()
!=
null
)
{
sqlExtraPanelSash
.
setMaximizedControl
(
null
);
sqlExtraPanelSash
.
setMaximizedControl
(
null
);
}
}
}
else
{
sqlExtraPanelSash
.
setMaximizedControl
(
sqlExtraPanelSash
.
getChildren
()[
0
]);
// Show results
showResultsPanel
();
}
if
(
view
==
outputViewer
.
getControl
())
{
if
(
view
==
outputViewer
.
getControl
())
{
updateOutputViewerIcon
(
false
);
updateOutputViewerIcon
(
false
);
...
@@ -1299,7 +1383,7 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1299,7 +1383,7 @@ public class SQLEditor extends SQLEditorBase implements
// Create new tab
// Create new tab
viewItem
.
setChecked
(
true
);
viewItem
.
setChecked
(
true
);
CTabItem
item
=
new
CTabItem
(
sqlExtraPanel
Folder
,
SWT
.
CLOSE
);
CTabItem
item
=
new
CTabItem
(
tab
Folder
,
SWT
.
CLOSE
);
item
.
setControl
(
view
);
item
.
setControl
(
view
);
item
.
setText
(
name
);
item
.
setText
(
name
);
item
.
setToolTipText
(
toolTip
);
item
.
setToolTipText
(
toolTip
);
...
@@ -1312,15 +1396,17 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1312,15 +1396,17 @@ public class SQLEditor extends SQLEditorBase implements
viewItem
.
setChecked
(
false
);
viewItem
.
setChecked
(
false
);
viewItem
.
redraw
();
viewItem
.
redraw
();
}
}
if
(
sqlExtraPanel
Folder
.
getItemCount
()
==
0
)
{
if
(
tab
Folder
.
getItemCount
()
==
0
)
{
sqlExtraPanelSash
.
setMaximizedControl
(
sqlExtraPanelSash
.
getChildren
()[
0
]);
sqlExtraPanelSash
.
setMaximizedControl
(
sqlExtraPanelSash
.
getChildren
()[
0
]);
}
}
});
});
sqlExtraPanel
Folder
.
setSelection
(
item
);
tab
Folder
.
setSelection
(
item
);
viewItem
.
redraw
();
viewItem
.
redraw
();
if
(
isTabsToTheRight
)
{
updateExtraViewToolbar
(
actionContributor
);
updateExtraViewToolbar
(
actionContributor
);
}
}
}
private
void
updateExtraViewToolbar
(
IActionContributor
actionContributor
)
{
private
void
updateExtraViewToolbar
(
IActionContributor
actionContributor
)
{
// Update toolbar
// Update toolbar
...
@@ -1328,6 +1414,11 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1328,6 +1414,11 @@ public class SQLEditor extends SQLEditorBase implements
if
(
actionContributor
!=
null
)
{
if
(
actionContributor
!=
null
)
{
actionContributor
.
contributeActions
(
sqlExtraPanelToolbar
);
actionContributor
.
contributeActions
(
sqlExtraPanelToolbar
);
}
}
sqlExtraPanelToolbar
.
add
(
ActionUtils
.
makeCommandContribution
(
getSite
(),
"org.jkiss.dbeaver.ui.editors.sql.toggle.extraPanels"
,
CommandContributionItem
.
STYLE_CHECK
,
UIIcon
.
ARROW_DOWN
));
sqlExtraPanelToolbar
.
update
(
true
);
sqlExtraPanelToolbar
.
update
(
true
);
}
}
...
@@ -1362,9 +1453,7 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1362,9 +1453,7 @@ public class SQLEditor extends SQLEditorBase implements
SQLEditorMessages
.
editors_sql_output_tip
,
SQLEditorMessages
.
editors_sql_output_tip
,
IMG_OUTPUT
,
IMG_OUTPUT
,
outputViewer
.
getControl
(),
outputViewer
.
getControl
(),
manager
->
{
manager
->
manager
.
add
(
new
OutputAutoShowToggleAction
()));
manager
.
add
(
new
OutputAutoShowToggleAction
());
});
}
}
public
void
showExecutionLogPanel
()
{
public
void
showExecutionLogPanel
()
{
...
@@ -1385,9 +1474,7 @@ public class SQLEditor extends SQLEditorBase implements
...
@@ -1385,9 +1474,7 @@ public class SQLEditor extends SQLEditorBase implements
IMG_VARIABLES
,
IMG_VARIABLES
,
variablesViewer
,
variablesViewer
,
null
);
null
);
UIUtils
.
asyncExec
(()
->
{
UIUtils
.
asyncExec
(()
->
variablesViewer
.
refreshVariables
());
variablesViewer
.
refreshVariables
();
});
}
}
public
<
T
>
T
getExtraPresentationPanel
(
Class
<
T
>
panelClass
)
{
public
<
T
>
T
getExtraPresentationPanel
(
Class
<
T
>
panelClass
)
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorOutputConsoleViewer.java
浏览文件 @
d37b3795
...
@@ -82,6 +82,10 @@ public class SQLEditorOutputConsoleViewer extends TextConsoleViewer {
...
@@ -82,6 +82,10 @@ public class SQLEditorOutputConsoleViewer extends TextConsoleViewer {
writer
=
new
PrintWriter
(
out
,
true
);
writer
=
new
PrintWriter
(
out
,
true
);
}
}
public
void
dispose
()
{
this
.
getControl
().
dispose
();
}
public
boolean
isDisposed
()
{
public
boolean
isDisposed
()
{
return
this
.
getControl
().
isDisposed
();
return
this
.
getControl
().
isDisposed
();
}
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLPreferenceConstants.java
浏览文件 @
d37b3795
...
@@ -116,6 +116,7 @@ public class SQLPreferenceConstants
...
@@ -116,6 +116,7 @@ public class SQLPreferenceConstants
public
final
static
String
RESULT_SET_ORIENTATION
=
"SQLEditor.resultSet.orientation"
;
public
final
static
String
RESULT_SET_ORIENTATION
=
"SQLEditor.resultSet.orientation"
;
public
static
final
String
RESULTS_PANEL_RATIO
=
"SQLEditor.resultSet.ratio"
;
public
static
final
String
RESULTS_PANEL_RATIO
=
"SQLEditor.resultSet.ratio"
;
public
static
final
String
EXTRA_PANEL_RATIO
=
"SQLEditor.extraPanels.ratio"
;
public
static
final
String
EXTRA_PANEL_RATIO
=
"SQLEditor.extraPanels.ratio"
;
public
static
final
String
EXTRA_PANEL_LOCATION
=
"SQLEditor.extraPanels.location"
;
public
static
final
String
OUTPUT_PANEL_AUTO_SHOW
=
"SQLEditor.outputPanel.autoShow"
;
public
static
final
String
OUTPUT_PANEL_AUTO_SHOW
=
"SQLEditor.outputPanel.autoShow"
;
public
static
final
String
SCRIPT_BIND_EMBEDDED_READ
=
"SQLEditor.script.bind.embedded.read"
;
//$NON-NLS-1$
public
static
final
String
SCRIPT_BIND_EMBEDDED_READ
=
"SQLEditor.script.bind.embedded.read"
;
//$NON-NLS-1$
...
@@ -144,5 +145,8 @@ public class SQLPreferenceConstants
...
@@ -144,5 +145,8 @@ public class SQLPreferenceConstants
public
static
final
String
DEFAULT_SQL_EDITOR_OPEN_COMMAND
=
"SQLEditor.defaultOpenCommand"
;
public
static
final
String
DEFAULT_SQL_EDITOR_OPEN_COMMAND
=
"SQLEditor.defaultOpenCommand"
;
public
static
final
String
LOCATION_RIGHT
=
"right"
;
public
static
final
String
LOCATION_BOTTOM
=
"bottom"
;
public
static
final
String
LOCATION_RESULTS
=
"results"
;
}
}
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/handlers/SQLEditorHandlerToggleExtraPanels.java
0 → 100644
浏览文件 @
d37b3795
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* 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.editors.sql.handlers
;
import
org.eclipse.core.commands.AbstractHandler
;
import
org.eclipse.core.commands.ExecutionEvent
;
import
org.eclipse.core.commands.ExecutionException
;
import
org.eclipse.ui.IEditorPart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.eclipse.ui.commands.IElementUpdater
;
import
org.eclipse.ui.handlers.HandlerUtil
;
import
org.eclipse.ui.menus.UIElement
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditor
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLPreferenceConstants
;
import
org.jkiss.dbeaver.utils.RuntimeUtils
;
import
java.util.Map
;
public
class
SQLEditorHandlerToggleExtraPanels
extends
AbstractHandler
implements
IElementUpdater
{
@Override
public
Object
execute
(
ExecutionEvent
event
)
throws
ExecutionException
{
SQLEditor
editor
=
RuntimeUtils
.
getObjectAdapter
(
HandlerUtil
.
getActiveEditor
(
event
),
SQLEditor
.
class
);
if
(
editor
!=
null
)
{
editor
.
toggleExtraPanelsLayout
();
}
return
null
;
}
@Override
public
void
updateElement
(
UIElement
element
,
Map
parameters
)
{
IWorkbenchWindow
workbenchWindow
=
element
.
getServiceLocator
().
getService
(
IWorkbenchWindow
.
class
);
IEditorPart
activeEditor
=
workbenchWindow
.
getActivePage
().
getActiveEditor
();
if
(
activeEditor
instanceof
SQLEditor
)
{
element
.
setChecked
(
SQLPreferenceConstants
.
LOCATION_RESULTS
.
equals
(((
SQLEditor
)
activeEditor
).
getExtraPanelsLocation
()));
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录