Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
f87ad545
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,发现更多精彩内容 >>
提交
f87ad545
编写于
12月 27, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Code styling
Former-commit-id:
6375bab2
上级
f953d376
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
83 addition
and
83 deletion
+83
-83
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/edit/DBECommandListener.java
.../src/org/jkiss/dbeaver/model/edit/DBECommandListener.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/edit/DBECommandAdapter.java
.../org/jkiss/dbeaver/model/impl/edit/DBECommandAdapter.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVEntity.java
....model/src/org/jkiss/dbeaver/model/virtual/DBVEntity.java
+2
-9
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/EntityEditor.java
...src/org/jkiss/dbeaver/ui/editors/entity/EntityEditor.java
+5
-5
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/properties/TabbedFolderPageForm.java
...er/ui/editors/entity/properties/TabbedFolderPageForm.java
+35
-31
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/finder/AdvancedList.java
...rc/org/jkiss/dbeaver/ui/controls/finder/AdvancedList.java
+30
-24
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/finder/AdvancedListItem.java
...rg/jkiss/dbeaver/ui/controls/finder/AdvancedListItem.java
+1
-1
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/finder/viewer/AdvancedListViewer.java
...dbeaver/ui/controls/finder/viewer/AdvancedListViewer.java
+2
-3
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/folders/TabbedFolderList.java
...g/jkiss/dbeaver/ui/controls/folders/TabbedFolderList.java
+2
-4
未找到文件。
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/edit/DBECommandListener.java
浏览文件 @
f87ad545
...
...
@@ -22,14 +22,14 @@ package org.jkiss.dbeaver.model.edit;
*/
public
interface
DBECommandListener
{
void
onCommandChange
(
DBECommand
command
);
void
onCommandChange
(
DBECommand
<?>
command
);
void
onSave
();
void
onReset
();
void
onCommandDo
(
DBECommand
command
);
void
onCommandDo
(
DBECommand
<?>
command
);
void
onCommandUndo
(
DBECommand
command
);
void
onCommandUndo
(
DBECommand
<?>
command
);
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/edit/DBECommandAdapter.java
浏览文件 @
f87ad545
...
...
@@ -25,7 +25,7 @@ import org.jkiss.dbeaver.model.edit.DBECommandListener;
public
abstract
class
DBECommandAdapter
implements
DBECommandListener
{
@Override
public
void
onCommandChange
(
DBECommand
command
)
public
void
onCommandChange
(
DBECommand
<?>
command
)
{
}
...
...
@@ -40,12 +40,12 @@ public abstract class DBECommandAdapter implements DBECommandListener {
}
@Override
public
void
onCommandDo
(
DBECommand
command
)
public
void
onCommandDo
(
DBECommand
<?>
command
)
{
}
@Override
public
void
onCommandUndo
(
DBECommand
command
)
public
void
onCommandUndo
(
DBECommand
<?>
command
)
{
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVEntity.java
浏览文件 @
f87ad545
...
...
@@ -501,9 +501,7 @@ public class DBVEntity extends DBVObject implements DBSEntity, DBPQualifiedObjec
return
result
;
}
public
static
String
getDefaultDescriptionColumn
(
DBRProgressMonitor
monitor
,
DBSEntityAttribute
keyColumn
)
throws
DBException
{
assert
keyColumn
.
getParentObject
()
!=
null
;
public
static
String
getDefaultDescriptionColumn
(
DBRProgressMonitor
monitor
,
DBSEntityAttribute
keyColumn
)
throws
DBException
{
Collection
<?
extends
DBSEntityAttribute
>
allColumns
=
keyColumn
.
getParentObject
().
getAttributes
(
monitor
);
if
(
allColumns
==
null
||
allColumns
.
isEmpty
())
{
...
...
@@ -572,12 +570,7 @@ public class DBVEntity extends DBVObject implements DBSEntity, DBPQualifiedObjec
if
(
colorOverrides
==
null
)
{
colorOverrides
=
new
ArrayList
<>();
}
else
{
for
(
Iterator
<
DBVColorOverride
>
iterator
=
colorOverrides
.
iterator
();
iterator
.
hasNext
();
)
{
DBVColorOverride
c
=
iterator
.
next
();
if
(
c
.
matches
(
attrName
,
DBCLogicalOperator
.
EQUALS
,
co
.
getAttributeValues
()))
{
iterator
.
remove
();
}
}
colorOverrides
.
removeIf
(
c
->
c
.
matches
(
attrName
,
DBCLogicalOperator
.
EQUALS
,
co
.
getAttributeValues
()));
}
colorOverrides
.
add
(
co
);
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/EntityEditor.java
浏览文件 @
f87ad545
...
...
@@ -480,10 +480,11 @@ public class EntityEditor extends MultiPageDatabaseEditor
Map
<
String
,
Object
>
options
=
new
HashMap
<>();
options
.
put
(
DBPScriptObject
.
OPTION_OBJECT_SAVE
,
true
);
DBPDataSource
dataSource
=
getDatabaseObject
().
getDataSource
();
try
{
DBEPersistAction
[]
persistActions
=
command
.
getPersistActions
(
monitor
,
options
);
script
.
append
(
SQLUtils
.
generateScript
(
commandContext
.
getExecutionContext
().
getDataSource
()
,
dataSource
,
persistActions
,
false
));
}
catch
(
DBException
e
)
{
...
...
@@ -543,7 +544,7 @@ public class EntityEditor extends MultiPageDatabaseEditor
// Command listener
commandListener
=
new
DBECommandAdapter
()
{
@Override
public
void
onCommandChange
(
DBECommand
command
)
public
void
onCommandChange
(
DBECommand
<?>
command
)
{
UIUtils
.
syncExec
(()
->
firePropertyChange
(
IEditorPart
.
PROP_DIRTY
));
}
...
...
@@ -828,12 +829,11 @@ public class EntityEditor extends MultiPageDatabaseEditor
}
}
private
void
addActionsContributor
(
IEditorPart
editor
,
Class
<?
extends
IEditorActionBarContributor
>
contributorClass
)
throws
InstantiationException
,
IllegalAccessException
{
private
void
addActionsContributor
(
IEditorPart
editor
,
Class
<?
extends
IEditorActionBarContributor
>
contributorClass
)
throws
Exception
{
GlobalContributorManager
contributorManager
=
GlobalContributorManager
.
getInstance
();
IEditorActionBarContributor
contributor
=
contributorManager
.
getContributor
(
contributorClass
);
if
(
contributor
==
null
)
{
contributor
=
contributorClass
.
newInstance
();
contributor
=
contributorClass
.
getDeclaredConstructor
().
newInstance
();
}
contributorManager
.
addContributor
(
contributor
,
editor
);
actionContributors
.
put
(
editor
,
contributor
);
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/properties/TabbedFolderPageForm.java
浏览文件 @
f87ad545
...
...
@@ -40,6 +40,7 @@ import org.jkiss.dbeaver.model.DBUtils;
import
org.jkiss.dbeaver.model.DBValueFormatting
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.model.edit.DBECommand
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEObjectRenamer
;
import
org.jkiss.dbeaver.model.edit.prop.DBECommandProperty
;
import
org.jkiss.dbeaver.model.impl.edit.DBECommandAdapter
;
...
...
@@ -61,7 +62,6 @@ import org.jkiss.dbeaver.utils.GeneralUtils;
import
org.jkiss.utils.BeanUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.List
;
import
java.util.*
;
...
...
@@ -109,34 +109,37 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
curPropertySource
=
input
.
getPropertySource
();
input
.
getCommandContext
().
addCommandListener
(
new
DBECommandAdapter
()
{
@Override
public
void
onCommandChange
(
DBECommand
command
)
{
UIUtils
.
asyncExec
(()
->
{
updateEditButtonsState
();
if
(
command
instanceof
DBECommandProperty
)
{
// We need to exclude current prop from update
// Simple value compare on update is not enough because value can be transformed (e.g. uppercased)
// and it will differ from the value in edit control
Object
propId
=
((
DBECommandProperty
)
command
).
getHandler
().
getId
();
updateOtherPropertyValues
(
propId
);
}
});
}
DBECommandContext
commandContext
=
input
.
getCommandContext
();
if
(
commandContext
!=
null
)
{
commandContext
.
addCommandListener
(
new
DBECommandAdapter
()
{
@Override
public
void
onCommandChange
(
DBECommand
<?>
command
)
{
UIUtils
.
asyncExec
(()
->
{
updateEditButtonsState
();
if
(
command
instanceof
DBECommandProperty
)
{
// We need to exclude current prop from update
// Simple value compare on update is not enough because value can be transformed (e.g. uppercased)
// and it will differ from the value in edit control
Object
propId
=
((
DBECommandProperty
<?>)
command
).
getHandler
().
getId
();
updateOtherPropertyValues
(
propId
);
}
});
}
@Override
public
void
onSave
()
{
UIUtils
.
asyncExec
(()
->
updateEditButtonsState
());
}
@Override
public
void
onSave
()
{
UIUtils
.
asyncExec
(()
->
updateEditButtonsState
());
}
@Override
public
void
onReset
()
{
UIUtils
.
asyncExec
(()
->
{
refreshProperties
();
updateEditButtonsState
();
});
}
});
@Override
public
void
onReset
()
{
UIUtils
.
asyncExec
(()
->
{
refreshProperties
();
updateEditButtonsState
();
});
}
});
}
propertiesGroup
.
addDisposeListener
(
e
->
dispose
());
...
...
@@ -147,7 +150,8 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
if
(
saveButton
==
null
||
saveButton
.
isDisposed
())
{
return
;
}
boolean
isDirty
=
input
.
getCommandContext
().
isDirty
();
DBECommandContext
commandContext
=
input
.
getCommandContext
();
boolean
isDirty
=
commandContext
!=
null
&&
commandContext
.
isDirty
();
saveButton
.
setEnabled
(
isDirty
);
revertButton
.
setEnabled
(
isDirty
);
scriptButton
.
setEnabled
(
isDirty
);
...
...
@@ -352,7 +356,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
LoadingJob
.
createService
(
new
DatabaseLoadService
<
Map
<
DBPPropertyDescriptor
,
Object
>>(
"Load main properties"
,
databaseObject
.
getDataSource
())
{
@Override
public
Map
<
DBPPropertyDescriptor
,
Object
>
evaluate
(
DBRProgressMonitor
monitor
)
throws
InvocationTargetException
,
InterruptedException
{
public
Map
<
DBPPropertyDescriptor
,
Object
>
evaluate
(
DBRProgressMonitor
monitor
)
{
DBPPropertySource
propertySource
=
TabbedFolderPageForm
.
this
.
curPropertySource
;
monitor
.
beginTask
(
"Load '"
+
DBValueFormatting
.
getDefaultValueDisplayString
(
propertySource
.
getEditableValue
(),
DBDDisplayFormat
.
UI
)
+
"' properties"
,
allProps
.
size
());
Map
<
DBPPropertyDescriptor
,
Object
>
propValues
=
new
HashMap
<>();
...
...
@@ -666,7 +670,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
final
Object
[]
enumConstants
=
propertyType
.
getEnumConstants
();
final
String
[]
strings
=
new
String
[
enumConstants
.
length
];
for
(
int
i
=
0
,
itemsLength
=
enumConstants
.
length
;
i
<
itemsLength
;
i
++)
{
strings
[
i
]
=
((
Enum
)
enumConstants
[
i
]).
name
();
strings
[
i
]
=
((
Enum
<?>
)
enumConstants
[
i
]).
name
();
}
combo
.
setItems
(
strings
);
}
...
...
@@ -692,7 +696,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
if
(
value
instanceof
DBPNamedObject
)
{
return
((
DBPNamedObject
)
value
).
getName
();
}
else
if
(
value
instanceof
Enum
)
{
return
((
Enum
)
value
).
name
();
return
((
Enum
<?>
)
value
).
name
();
}
else
{
return
DBValueFormatting
.
getDefaultValueDisplayString
(
value
,
DBDDisplayFormat
.
EDIT
);
}
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/finder/AdvancedList.java
浏览文件 @
f87ad545
...
...
@@ -18,7 +18,10 @@ package org.jkiss.dbeaver.ui.controls.finder;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.custom.ScrolledComposite
;
import
org.eclipse.swt.events.*
;
import
org.eclipse.swt.events.FocusAdapter
;
import
org.eclipse.swt.events.FocusEvent
;
import
org.eclipse.swt.events.KeyEvent
;
import
org.eclipse.swt.events.SelectionListener
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.GC
;
import
org.eclipse.swt.graphics.Point
;
...
...
@@ -26,7 +29,10 @@ import org.eclipse.swt.graphics.RGB;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.swt.widgets.Canvas
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Event
;
import
org.eclipse.swt.widgets.TypedListener
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ui.UIStyles
;
import
org.jkiss.dbeaver.ui.UIUtils
;
...
...
@@ -66,7 +72,28 @@ public class AdvancedList extends ScrolledComposite {
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
}
this
.
container
=
new
Canvas
(
this
,
SWT
.
NONE
);
this
.
container
=
new
Canvas
(
this
,
SWT
.
NONE
)
{
@Override
public
Point
computeSize
(
int
wHint
,
int
hHint
)
{
return
computeSize
(
wHint
,
hHint
,
true
);
}
@Override
public
Point
computeSize
(
int
wHint
,
int
hHint
,
boolean
changed
)
{
if
(
wHint
==
SWT
.
DEFAULT
&&
hHint
==
SWT
.
DEFAULT
)
{
return
new
Point
(
100
,
100
);
}
return
super
.
computeSize
(
wHint
,
hHint
,
changed
);
/*
// Do not calc real size because RowLayout will fill to maximum screen width
if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
//return getParent().getSize();
return super.computeSize(wHint, hHint, changed);
}
return new Point(wHint, hHint);
*/
}
};
this
.
setContent
(
this
.
container
);
this
.
setExpandHorizontal
(
true
);
...
...
@@ -178,27 +205,6 @@ public class AdvancedList extends ScrolledComposite {
return
textSize
;
}
@Override
public
Point
computeSize
(
int
wHint
,
int
hHint
)
{
return
computeSize
(
wHint
,
hHint
,
false
);
}
@Override
public
Point
computeSize
(
int
wHint
,
int
hHint
,
boolean
changed
)
{
if
(
wHint
==
SWT
.
DEFAULT
&&
hHint
==
SWT
.
DEFAULT
)
{
return
new
Point
(
100
,
100
);
}
return
super
.
computeSize
(
wHint
,
hHint
,
changed
);
/*
// Do not calc real size because RowLayout will fill to maximum screen width
if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
//return getParent().getSize();
return super.computeSize(wHint, hHint, changed);
}
return new Point(wHint, hHint);
*/
}
public
Canvas
getContainer
()
{
return
container
;
}
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/finder/AdvancedListItem.java
浏览文件 @
f87ad545
...
...
@@ -40,7 +40,7 @@ public class AdvancedListItem extends Canvas {
final
TextLayout
textLayout
;
public
AdvancedListItem
(
AdvancedList
list
,
Object
item
,
ILabelProvider
labelProvider
)
{
super
(
list
.
getContainer
(),
SWT
.
DOUBLE_BUFFERED
);
super
(
list
.
getContainer
(),
SWT
.
NONE
);
this
.
labelProvider
=
labelProvider
;
this
.
list
=
list
;
this
.
list
.
addItem
(
this
);
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/finder/viewer/AdvancedListViewer.java
浏览文件 @
f87ad545
...
...
@@ -97,14 +97,13 @@ public class AdvancedListViewer extends StructuredViewer {
IStructuredContentProvider
contentProvider
=
(
IStructuredContentProvider
)
getContentProvider
();
ILabelProvider
labelProvider
=
(
ILabelProvider
)
getLabelProvider
();
IToolTipProvider
toolTipProvider
=
labelProvider
instanceof
IToolTipProvider
?
(
IToolTipProvider
)
labelProvider
:
null
;
//
IToolTipProvider toolTipProvider = labelProvider instanceof IToolTipProvider ? (IToolTipProvider) labelProvider : null;
Object
[]
elements
=
contentProvider
.
getElements
(
element
);
for
(
ViewerFilter
filter
:
getFilters
())
{
elements
=
filter
.
filter
(
this
,
(
Object
)
null
,
elements
);
}
for
(
Object
item
:
elements
)
{
AdvancedListItem
listItem
=
new
AdvancedListItem
(
control
,
item
,
labelProvider
);
listItem
.
setData
(
item
);
new
AdvancedListItem
(
control
,
item
,
labelProvider
);
}
if
(
true
)
{
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/folders/TabbedFolderList.java
浏览文件 @
f87ad545
/*
******************************************************************************
/*
* Copyright (c) 2001, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -783,9 +783,7 @@ public class TabbedFolderList extends Composite {
* that the navigation elements fit.
*/
int
ret
=
getBounds
().
height
-
20
;
return
(
ret
>
tabHeight
)
?
tabHeight
:
(
ret
<
5
)
?
5
:
ret
;
return
(
ret
>
tabHeight
)
?
tabHeight
:
Math
.
max
(
ret
,
5
);
}
return
tabHeight
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录