Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
37dd0763
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,发现更多精彩内容 >>
提交
37dd0763
编写于
6月 05, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Properties model refactoring
Former-commit-id:
a31a71be
上级
22b4970d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
14 deletion
+56
-14
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/DBPPropertySource.java
...r.core/src/org/jkiss/dbeaver/model/DBPPropertySource.java
+19
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceAbstract.java
...g/jkiss/dbeaver/ui/properties/PropertySourceAbstract.java
+22
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceCustom.java
...org/jkiss/dbeaver/ui/properties/PropertySourceCustom.java
+9
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java
...c/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java
+6
-5
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/
ui/properties/IPropertySourceEx
.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/
model/DBPPropertySource
.java
浏览文件 @
37dd0763
...
...
@@ -15,19 +15,31 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.ui.properties
;
import
org.eclipse.ui.views.properties.IPropertySource2
;
package
org.jkiss.dbeaver.model
;
/**
* Property source
which supports default property values
* Property source
*/
public
interface
IPropertySourceEx
extends
IPropertySource2
{
public
interface
DBPPropertySource
{
public
Object
getEditableValue
();
public
DBPPropertyDescriptor
[]
getPropertyDescriptors2
();
public
Object
getPropertyValue
(
Object
id
);
public
boolean
isPropertySet
(
Object
id
);
boolean
isPropertyResettable
(
Object
id
);
public
void
resetPropertyValue
(
Object
id
);
void
resetPropertyValueToDefault
(
Object
id
);
public
void
setPropertyValue
(
Object
id
,
Object
value
);
boolean
isDirty
(
Object
id
);
boolean
hasDefaultValue
(
Object
id
);
void
resetPropertyValueToDefault
(
Object
id
);
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceAbstract.java
浏览文件 @
37dd0763
...
...
@@ -26,6 +26,8 @@ import org.eclipse.ui.views.properties.IPropertySource;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBPContextProvider
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
...
...
@@ -43,7 +45,7 @@ import java.util.*;
/**
* PropertyCollector
*/
public
abstract
class
PropertySourceAbstract
implements
IPropertySourceMulti
public
abstract
class
PropertySourceAbstract
implements
DBPPropertySource
,
IPropertySourceMulti
{
static
final
Log
log
=
Log
.
getLog
(
PropertySourceAbstract
.
class
);
...
...
@@ -102,6 +104,11 @@ public abstract class PropertySourceAbstract implements IPropertySourceMulti
return
props
.
isEmpty
();
}
@Override
public
boolean
isDirty
(
Object
id
)
{
return
false
;
}
public
Object
getSourceObject
()
{
return
sourceObject
;
...
...
@@ -119,6 +126,10 @@ public abstract class PropertySourceAbstract implements IPropertySourceMulti
return
props
.
toArray
(
new
IPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
DBPPropertyDescriptor
[]
getPropertyDescriptors2
()
{
return
props
.
toArray
(
new
DBPPropertyDescriptor
[
props
.
size
()]);
}
/*
public IPropertyDescriptor getPropertyDescriptor(final Object id)
{
...
...
@@ -252,6 +263,16 @@ public abstract class PropertySourceAbstract implements IPropertySourceMulti
throw
new
UnsupportedOperationException
(
"Cannot reset property in non-editable property source"
);
}
@Override
public
void
resetPropertyValueToDefault
(
Object
id
)
{
throw
new
UnsupportedOperationException
(
"Cannot reset property in non-editable property source"
);
}
@Override
public
boolean
hasDefaultValue
(
Object
id
)
{
return
false
;
}
@Override
public
final
void
setPropertyValue
(
Object
id
,
Object
value
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceCustom.java
浏览文件 @
37dd0763
...
...
@@ -18,7 +18,10 @@
package
org.jkiss.dbeaver.ui.properties
;
import
org.eclipse.ui.views.properties.IPropertyDescriptor
;
import
org.eclipse.ui.views.properties.IPropertySource
;
import
org.eclipse.ui.views.properties.IPropertySource2
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -27,7 +30,7 @@ import java.util.*;
/**
* Simple property source which store properties in map
*/
public
class
PropertySourceCustom
implements
IPropertySourceEx
{
public
class
PropertySourceCustom
implements
DBPPropertySource
,
IPropertySource2
{
private
List
<
DBPPropertyDescriptor
>
props
=
new
ArrayList
<
DBPPropertyDescriptor
>();
...
...
@@ -99,6 +102,11 @@ public class PropertySourceCustom implements IPropertySourceEx {
return
this
;
}
@Override
public
DBPPropertyDescriptor
[]
getPropertyDescriptors2
()
{
return
props
.
toArray
(
new
DBPPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
IPropertyDescriptor
[]
getPropertyDescriptors
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java
浏览文件 @
37dd0763
...
...
@@ -35,6 +35,7 @@ import org.eclipse.ui.views.properties.IPropertySource2;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPObject
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabaseNode
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
...
...
@@ -276,8 +277,8 @@ public class PropertyTreeViewer extends TreeViewer {
{
if
(
node
instanceof
TreeNode
)
{
TreeNode
treeNode
=
(
TreeNode
)
node
;
if
(
treeNode
.
propertySource
instanceof
IPropertySourceEx
)
{
((
IPropertySourceEx
)
treeNode
.
propertySource
).
resetPropertyValueToDefault
(
treeNode
.
property
.
getId
());
if
(
treeNode
.
propertySource
instanceof
DBPPropertySource
)
{
((
DBPPropertySource
)
treeNode
.
propertySource
).
resetPropertyValueToDefault
(
treeNode
.
property
.
getId
());
}
else
{
treeNode
.
propertySource
.
resetPropertyValue
(
treeNode
.
property
.
getId
());
}
...
...
@@ -489,7 +490,7 @@ public class PropertyTreeViewer extends TreeViewer {
}
else
{
manager
.
add
(
new
ActionResetProperty
(
prop
,
false
));
if
(!
isCustomProperty
(
prop
.
property
)
&&
prop
.
propertySource
instanceof
IPropertySourceEx
)
{
prop
.
propertySource
instanceof
DBPPropertySource
)
{
manager
.
add
(
new
ActionResetProperty
(
prop
,
true
));
}
}
...
...
@@ -805,8 +806,8 @@ public class PropertyTreeViewer extends TreeViewer {
@Override
public
void
run
()
{
if
(
toDefault
&&
prop
.
propertySource
instanceof
IPropertySourceEx
)
{
((
IPropertySourceEx
)
prop
.
propertySource
).
resetPropertyValueToDefault
(
prop
.
property
.
getId
());
if
(
toDefault
&&
prop
.
propertySource
instanceof
DBPPropertySource
)
{
((
DBPPropertySource
)
prop
.
propertySource
).
resetPropertyValueToDefault
(
prop
.
property
.
getId
());
}
else
{
prop
.
propertySource
.
resetPropertyValue
(
prop
.
property
.
getId
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录