Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
ac0e92c2
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,发现更多精彩内容 >>
提交
ac0e92c2
编写于
7月 18, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Context activation refactoring
上级
f7032c95
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
65 deletion
+43
-65
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/AbstractPresentation.java
...s/dbeaver/ui/controls/resultset/AbstractPresentation.java
+5
-21
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/BaseValueEditor.java
...rc/org/jkiss/dbeaver/ui/data/editors/BaseValueEditor.java
+2
-21
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/EditorUtils.java
...er.core/src/org/jkiss/dbeaver/ui/editors/EditorUtils.java
+32
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
....core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
...e/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
+2
-21
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/AbstractPresentation.java
浏览文件 @
ac0e92c2
...
...
@@ -25,10 +25,10 @@ import org.eclipse.jface.viewers.*;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.FocusEvent
;
import
org.eclipse.swt.events.FocusListener
;
import
org.eclipse.swt.events.MouseEvent
;
import
org.eclipse.swt.events.MouseWheelListener
;
import
org.eclipse.swt.graphics.Point
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Menu
;
import
org.eclipse.ui.IWorkbenchPartSite
;
import
org.eclipse.ui.contexts.IContextActivation
;
import
org.eclipse.ui.contexts.IContextService
;
...
...
@@ -36,6 +36,7 @@ import org.eclipse.ui.themes.IThemeManager;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.data.DBDAttributeBinding
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -189,24 +190,7 @@ public abstract class AbstractPresentation implements IResultSetPresentation, IS
UIUtils
.
addFocusTracker
(
site
,
PRESENTATION_CONTROL_ID
,
control
);
// RSV control context
final
IContextService
contextService
=
site
.
getService
(
IContextService
.
class
);
if
(
contextService
!=
null
)
{
control
.
addFocusListener
(
new
FocusListener
()
{
IContextActivation
activation
;
@Override
public
void
focusGained
(
FocusEvent
e
)
{
if
(
activation
==
null
)
{
activation
=
contextService
.
activateContext
(
RESULTS_CONTROL_CONTEXT_ID
);
}
}
@Override
public
void
focusLost
(
FocusEvent
e
)
{
contextService
.
deactivateContext
(
activation
);
activation
=
null
;
}
});
}
control
.
addDisposeListener
(
e
->
UIUtils
.
removeFocusTracker
(
site
,
control
));
EditorUtils
.
trackControlContext
(
site
,
control
,
RESULTS_CONTROL_CONTEXT_ID
);
// Enable horizontal scrolling
control
.
addMouseWheelListener
(
e
->
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/BaseValueEditor.java
浏览文件 @
ac0e92c2
...
...
@@ -25,8 +25,6 @@ import org.eclipse.swt.events.FocusListener;
import
org.eclipse.swt.events.TraverseEvent
;
import
org.eclipse.swt.events.TraverseListener
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.ui.contexts.IContextActivation
;
import
org.eclipse.ui.contexts.IContextService
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
...
...
@@ -37,6 +35,7 @@ import org.jkiss.dbeaver.ui.UIUtils;
import
org.jkiss.dbeaver.ui.data.IMultiController
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.data.IValueEditor
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
/**
* BaseValueEditor
...
...
@@ -87,25 +86,7 @@ public abstract class BaseValueEditor<T extends Control> implements IValueEditor
// inlineControl.setBackground(valueController.getEditPlaceholder().getBackground());
// }
final
IContextService
contextService
=
valueController
.
getValueSite
().
getService
(
IContextService
.
class
);
inlineControl
.
addFocusListener
(
new
FocusListener
()
{
private
IContextActivation
activationEditor
;
@Override
public
void
focusGained
(
FocusEvent
e
)
{
if
(
contextService
!=
null
)
{
activationEditor
=
contextService
.
activateContext
(
RESULTS_EDIT_CONTEXT_ID
);
}
}
@Override
public
void
focusLost
(
FocusEvent
e
)
{
contextService
.
deactivateContext
(
activationEditor
);
activationEditor
=
null
;
}
});
inlineControl
.
addDisposeListener
(
e
->
{
control
=
null
;
});
EditorUtils
.
trackControlContext
(
valueController
.
getValueSite
(),
inlineControl
,
RESULTS_EDIT_CONTEXT_ID
);
if
(
isInline
)
{
inlineControl
.
setFont
(
valueController
.
getEditPlaceholder
().
getFont
());
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/EditorUtils.java
浏览文件 @
ac0e92c2
...
...
@@ -28,7 +28,12 @@ import org.eclipse.core.runtime.QualifiedName;
import
org.eclipse.core.runtime.jobs.Job
;
import
org.eclipse.core.runtime.preferences.InstanceScope
;
import
org.eclipse.jface.preference.IPreferenceStore
;
import
org.eclipse.swt.events.FocusEvent
;
import
org.eclipse.swt.events.FocusListener
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.ui.*
;
import
org.eclipse.ui.contexts.IContextActivation
;
import
org.eclipse.ui.contexts.IContextService
;
import
org.eclipse.ui.ide.FileStoreEditorInput
;
import
org.eclipse.ui.ide.IDE
;
import
org.eclipse.ui.preferences.ScopedPreferenceStore
;
...
...
@@ -40,6 +45,7 @@ import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import
org.jkiss.dbeaver.model.DBPExternalFileManager
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.registry.DataSourceRegistry
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.navigator.NavigatorUtils
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -263,4 +269,30 @@ public class EditorUtils {
return
new
ScopedPreferenceStore
(
InstanceScope
.
INSTANCE
,
"org.eclipse.ui.editors"
);
}
public
static
void
trackControlContext
(
IWorkbenchSite
site
,
Control
control
,
String
contextId
)
{
final
IContextService
contextService
=
site
.
getService
(
IContextService
.
class
);
if
(
contextService
!=
null
)
{
control
.
addFocusListener
(
new
FocusListener
()
{
IContextActivation
activation
;
@Override
public
void
focusGained
(
FocusEvent
e
)
{
if
(
activation
==
null
)
{
activation
=
contextService
.
activateContext
(
contextId
);
}
}
@Override
public
void
focusLost
(
FocusEvent
e
)
{
if
(
activation
!=
null
)
{
contextService
.
deactivateContext
(
activation
);
activation
=
null
;
}
}
});
}
control
.
addDisposeListener
(
e
->
UIUtils
.
removeFocusTracker
(
site
,
control
));
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
ac0e92c2
...
...
@@ -1267,8 +1267,8 @@ public class SQLEditor extends SQLEditorBase implements
final
CTabItem
item
=
new
CTabItem
(
resultTabs
,
SWT
.
CLOSE
);
item
.
setControl
(
planView
.
getControl
());
item
.
setText
(
"Exec. Plan"
);
item
.
setToolTipText
(
"Execution plan for\n"
+
sqlQuery
.
getText
()
);
item
.
setText
(
CoreMessages
.
editors_sql_error_execution_plan_title
);
item
.
setToolTipText
(
CoreMessages
.
editors_sql_error_execution_plan_title
);
item
.
setImage
(
IMG_EXPLAIN_PLAN
);
item
.
setData
(
planView
);
UIUtils
.
disposeControlOnItemDispose
(
item
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorBase.java
浏览文件 @
ac0e92c2
...
...
@@ -58,6 +58,7 @@ import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.*
;
import
org.jkiss.dbeaver.ui.*
;
import
org.jkiss.dbeaver.ui.editors.EditorUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.syntax.SQLCharacterPairMatcher
;
import
org.jkiss.dbeaver.ui.editors.sql.syntax.SQLPartitionScanner
;
import
org.jkiss.dbeaver.ui.editors.sql.syntax.SQLRuleManager
;
...
...
@@ -250,27 +251,7 @@ public abstract class SQLEditorBase extends BaseTextEditor implements IErrorVisu
{
// Context listener
StyledText
control
=
getViewer
().
getTextWidget
();
final
IContextService
contextService
=
getSite
().
getService
(
IContextService
.
class
);
if
(
contextService
!=
null
)
{
control
.
addFocusListener
(
new
FocusListener
()
{
IContextActivation
activation
;
@Override
public
void
focusGained
(
FocusEvent
e
)
{
if
(
activation
==
null
)
{
activation
=
contextService
.
activateContext
(
SQL_CONTROL_CONTEXT_ID
);
}
}
@Override
public
void
focusLost
(
FocusEvent
e
)
{
contextService
.
deactivateContext
(
activation
);
activation
=
null
;
}
});
}
control
.
addDisposeListener
(
e
->
UIUtils
.
removeFocusTracker
(
getSite
(),
control
));
EditorUtils
.
trackControlContext
(
getSite
(),
getViewer
().
getTextWidget
(),
SQL_CONTROL_CONTEXT_ID
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录