Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
413c23d1
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,发现更多精彩内容 >>
提交
413c23d1
编写于
6月 05, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Properties model refactoring
上级
3dfa8ff3
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
196 addition
and
196 deletion
+196
-196
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/meta/Property.java
...eaver.core/src/org/jkiss/dbeaver/model/meta/Property.java
+0
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/navigator/DBNAdapterFactory.java
.../org/jkiss/dbeaver/model/navigator/DBNAdapterFactory.java
+9
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
.../src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
+1
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+2
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/IPropertySourceMulti.java
...org/jkiss/dbeaver/ui/properties/IPropertySourceMulti.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/ObjectPropertyDescriptor.java
...jkiss/dbeaver/ui/properties/ObjectPropertyDescriptor.java
+1
-87
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyDescriptorDelegate.java
...iss/dbeaver/ui/properties/PropertyDescriptorDelegate.java
+86
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyDescriptorEx.java
...org/jkiss/dbeaver/ui/properties/PropertyDescriptorEx.java
+2
-41
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceAbstract.java
...g/jkiss/dbeaver/ui/properties/PropertySourceAbstract.java
+0
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceCollection.java
...jkiss/dbeaver/ui/properties/PropertySourceCollection.java
+3
-39
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceCustom.java
...org/jkiss/dbeaver/ui/properties/PropertySourceCustom.java
+1
-10
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceDelegate.java
...g/jkiss/dbeaver/ui/properties/PropertySourceDelegate.java
+78
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java
...c/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java
+0
-1
plugins/org.jkiss.dbeaver.erd/plugin.xml
plugins/org.jkiss.dbeaver.erd/plugin.xml
+1
-1
plugins/org.jkiss.dbeaver.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDObject.java
...er.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDObject.java
+2
-2
plugins/org.jkiss.dbeaver.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDObjectAdapter.java
...src/org/jkiss/dbeaver/ext/erd/model/ERDObjectAdapter.java
+8
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/meta/Property.java
浏览文件 @
413c23d1
...
...
@@ -95,8 +95,6 @@ public @interface Property
String
helpContextId
()
default
""
;
//NON-NLS-1
Class
<?
extends
ILabelProvider
>
labelProvider
()
default
ILabelProvider
.
class
;
Class
<?
extends
IPropertyValueTransformer
>
valueTransformer
()
default
IPropertyValueTransformer
.
class
;
Class
<?
extends
IPropertyValueListProvider
>
listProvider
()
default
IPropertyValueListProvider
.
class
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/model/navigator/DBNAdapterFactory.java
浏览文件 @
413c23d1
...
...
@@ -31,6 +31,7 @@ import org.jkiss.dbeaver.core.CoreMessages;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.ui.properties.PropertyCollector
;
import
org.jkiss.dbeaver.ui.properties.PropertySourceDelegate
;
/**
* Navigator AdapterFactory
...
...
@@ -104,11 +105,18 @@ public class DBNAdapterFactory implements IAdapterFactory
if
(
dbObject
instanceof
IPropertySource
)
{
return
dbObject
;
}
if
(
dbObject
instanceof
DBPPropertySource
)
{
return
new
PropertySourceDelegate
((
DBPPropertySource
)
dbObject
);
}
if
(
dbObject
instanceof
IAdaptable
)
{
Object
adapter
=
((
IAdaptable
)
dbObject
).
getAdapter
(
IPropertySource
.
class
);
if
(
adapter
!=
null
)
{
return
adapter
;
}
adapter
=
((
IAdaptable
)
dbObject
).
getAdapter
(
DBPPropertySource
.
class
);
if
(
adapter
!=
null
)
{
return
new
PropertySourceDelegate
((
DBPPropertySource
)
adapter
);
}
}
if
(
dbObject
!=
null
)
{
PropertyCollector
props
=
new
PropertyCollector
(
adaptableObject
,
dbObject
,
true
);
...
...
@@ -119,7 +127,7 @@ public class DBNAdapterFactory implements IAdapterFactory
props
.
addProperty
(
null
,
"name"
,
CoreMessages
.
model_navigator_Name
,
meta
.
getName
());
//$NON-NLS-1$
props
.
addProperty
(
null
,
"desc"
,
CoreMessages
.
model_navigator_Description
,
meta
.
getDescription
());
//$NON-NLS-1$
}
return
props
;
return
new
PropertySourceDelegate
(
props
)
;
}
}
else
if
(
adapterType
==
IWorkbenchAdapter
.
class
)
{
// Workbench adapter
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
浏览文件 @
413c23d1
...
...
@@ -23,7 +23,6 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.ui.ISaveablePart
;
import
org.eclipse.ui.IWorkbenchWindow
;
import
org.eclipse.ui.views.properties.IPropertySource
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
...
...
@@ -1014,7 +1013,7 @@ public class DataSourceDescriptor
{
if
(
DBSDataSourceContainer
.
class
.
isAssignableFrom
(
adapter
))
{
return
this
;
}
else
if
(
adapter
==
I
PropertySource
.
class
)
{
}
else
if
(
adapter
==
DBP
PropertySource
.
class
)
{
PropertyCollector
coll
=
new
PropertyCollector
(
this
,
true
);
coll
.
collectProperties
();
if
(
dataSource
!=
null
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
413c23d1
...
...
@@ -90,6 +90,7 @@ import org.jkiss.dbeaver.ui.controls.lightgrid.IGridLabelProvider;
import
org.jkiss.dbeaver.ui.controls.resultset.*
;
import
org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog
;
import
org.jkiss.dbeaver.ui.properties.PropertyCollector
;
import
org.jkiss.dbeaver.ui.properties.PropertySourceDelegate
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -946,7 +947,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
PropertyCollector
props
=
new
PropertyCollector
(
valueController
.
getBinding
().
getAttribute
(),
false
);
props
.
collectProperties
();
valueController
.
getValueHandler
().
contributeProperties
(
props
,
valueController
);
return
props
;
return
new
PropertySourceDelegate
(
props
)
;
}
return
null
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/IPropertySourceMulti.java
浏览文件 @
413c23d1
...
...
@@ -18,12 +18,12 @@
package
org.jkiss.dbeaver.ui.properties
;
import
org.
eclipse.ui.views.properties.IPropertySource2
;
import
org.
jkiss.dbeaver.model.DBPPropertySource
;
/**
* Property source which allows editing of multiple objects.
*/
public
interface
IPropertySourceMulti
extends
IPropertySource2
{
public
interface
IPropertySourceMulti
extends
DBPPropertySource
{
boolean
isPropertySet
(
Object
object
,
ObjectPropertyDescriptor
id
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/ObjectPropertyDescriptor.java
浏览文件 @
413c23d1
...
...
@@ -18,23 +18,13 @@
package
org.jkiss.dbeaver.ui.properties
;
import
org.eclipse.core.runtime.Platform
;
import
org.eclipse.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.IFontProvider
;
import
org.eclipse.jface.viewers.ILabelProvider
;
import
org.eclipse.jface.viewers.LabelProvider
;
import
org.eclipse.swt.graphics.Font
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.views.properties.IPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPersistedObject
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.model.meta.IPropertyValueTransformer
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.BeanUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.osgi.framework.Bundle
;
...
...
@@ -47,13 +37,12 @@ import java.util.ResourceBundle;
/**
* ObjectPropertyDescriptor
*/
public
class
ObjectPropertyDescriptor
extends
ObjectAttributeDescriptor
implements
DBPPropertyDescriptor
,
IProperty
Descriptor
,
IProperty
ValueListProvider
<
Object
>
public
class
ObjectPropertyDescriptor
extends
ObjectAttributeDescriptor
implements
DBPPropertyDescriptor
,
IPropertyValueListProvider
<
Object
>
{
private
final
Property
propInfo
;
private
final
String
propName
;
private
final
String
propDescription
;
private
Method
setter
;
private
ILabelProvider
labelProvider
;
private
IPropertyValueTransformer
valueTransformer
;
private
final
Class
<?>
declaringClass
;
...
...
@@ -78,19 +67,6 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
}
}
// Obtain label provider
Class
<?
extends
ILabelProvider
>
labelProviderClass
=
propInfo
.
labelProvider
();
if
(
labelProviderClass
!=
null
&&
labelProviderClass
!=
ILabelProvider
.
class
)
{
try
{
this
.
labelProvider
=
labelProviderClass
.
newInstance
();
}
catch
(
Throwable
e
)
{
log
.
warn
(
e
);
}
}
if
(
this
.
labelProvider
==
null
)
{
this
.
labelProvider
=
new
DefaultLabelProvider
();
}
// Obtain value transformer
Class
<?
extends
IPropertyValueTransformer
>
valueTransformerClass
=
propInfo
.
valueTransformer
();
if
(
valueTransformerClass
!=
null
&&
valueTransformerClass
!=
IPropertyValueTransformer
.
class
)
{
...
...
@@ -138,12 +114,6 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
return
valueTransformer
;
}
@Override
public
CellEditor
createPropertyEditor
(
Composite
parent
)
{
return
UIUtils
.
createPropertyEditor
(
parent
,
getSource
(),
this
);
}
@Override
public
boolean
isEditable
(
Object
object
)
{
...
...
@@ -183,31 +153,6 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
return
propName
;
}
@Override
public
String
[]
getFilterFlags
()
{
return
null
;
}
@Override
public
Object
getHelpContextIds
()
{
return
propInfo
.
helpContextId
();
}
@Override
public
ILabelProvider
getLabelProvider
()
{
return
this
.
labelProvider
;
}
@Override
public
boolean
isCompatibleWith
(
IPropertyDescriptor
anotherProperty
)
{
return
anotherProperty
instanceof
ObjectPropertyDescriptor
&&
((
ObjectPropertyDescriptor
)
anotherProperty
).
propInfo
==
propInfo
;
}
public
Object
readValue
(
Object
object
,
DBRProgressMonitor
progressMonitor
)
throws
IllegalAccessException
,
IllegalArgumentException
,
InvocationTargetException
{
...
...
@@ -363,36 +308,5 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
return
string
;
}
private
class
DefaultLabelProvider
extends
LabelProvider
implements
IFontProvider
{
@Override
public
Image
getImage
(
Object
element
)
{
// if (getSource() instanceof IPropertySourceEditable) {
// if (isReadOnly()) {
// return DBIcon.BULLET_GREEN.getImage();
// } else {
// return DBIcon.BULLET_BLACK.getImage();
// }
// }
return
null
;
}
@Override
public
String
getText
(
Object
element
)
{
return
element
==
null
?
""
:
element
instanceof
DBSObject
?
((
DBSObject
)
element
).
getName
()
:
element
.
toString
();
}
@Override
public
Font
getFont
(
Object
element
)
{
return
null
;
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyDescriptorDelegate.java
0 → 100644
浏览文件 @
413c23d1
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.ILabelProvider
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.views.properties.IPropertyDescriptor
;
import
org.eclipse.ui.views.properties.IPropertySource2
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.ui.UIUtils
;
/**
* PropertyDescriptorDelegate
*/
public
class
PropertyDescriptorDelegate
implements
IPropertyDescriptor
{
private
final
DBPPropertySource
propSource
;
private
final
DBPPropertyDescriptor
source
;
public
PropertyDescriptorDelegate
(
DBPPropertySource
propSource
,
DBPPropertyDescriptor
source
)
{
this
.
propSource
=
propSource
;
this
.
source
=
source
;
}
@Override
public
CellEditor
createPropertyEditor
(
Composite
parent
)
{
return
UIUtils
.
createCellEditor
(
parent
,
propSource
,
source
);
}
@Override
public
String
getCategory
()
{
return
source
.
getCategory
();
}
@Override
public
String
getDescription
()
{
return
source
.
getDescription
();
}
@Override
public
String
getDisplayName
()
{
return
source
.
getDisplayName
();
}
@Override
public
String
[]
getFilterFlags
()
{
return
null
;
}
@Override
public
Object
getHelpContextIds
()
{
return
null
;
}
@Override
public
Object
getId
()
{
return
source
.
getId
();
}
@Override
public
ILabelProvider
getLabelProvider
()
{
return
null
;
}
@Override
public
boolean
isCompatibleWith
(
IPropertyDescriptor
anotherProperty
)
{
return
false
;
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyDescriptorEx.java
浏览文件 @
413c23d1
...
...
@@ -17,17 +17,12 @@
*/
package
org.jkiss.dbeaver.ui.properties
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.ILabelProvider
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.views.properties.IPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -37,7 +32,7 @@ import java.util.List;
/**
* PropertyDescriptorEx
*/
public
class
PropertyDescriptorEx
implements
DBPPropertyDescriptor
,
IProperty
Descriptor
,
IProperty
ValueListProvider
<
Object
>
public
class
PropertyDescriptorEx
implements
DBPPropertyDescriptor
,
IPropertyValueListProvider
<
Object
>
{
static
final
Log
log
=
Log
.
getLog
(
PropertyDescriptorEx
.
class
);
...
...
@@ -121,15 +116,6 @@ public class PropertyDescriptorEx implements DBPPropertyDescriptor, IPropertyDes
this
.
editable
=
editable
;
}
@Override
public
CellEditor
createPropertyEditor
(
Composite
parent
)
{
if
(!
editable
)
{
return
null
;
}
return
UIUtils
.
createCellEditor
(
parent
,
null
,
this
);
}
@Nullable
@Override
public
String
getCategory
()
...
...
@@ -144,19 +130,6 @@ public class PropertyDescriptorEx implements DBPPropertyDescriptor, IPropertyDes
return
id
;
}
@Override
public
ILabelProvider
getLabelProvider
()
{
return
null
;
}
@Override
public
boolean
isCompatibleWith
(
IPropertyDescriptor
anotherProperty
)
{
return
CommonUtils
.
equalObjects
(
category
,
anotherProperty
.
getCategory
())
&&
CommonUtils
.
equalObjects
(
id
,
anotherProperty
.
getId
());
}
@NotNull
@Override
public
String
getDisplayName
()
...
...
@@ -164,18 +137,6 @@ public class PropertyDescriptorEx implements DBPPropertyDescriptor, IPropertyDes
return
name
;
}
@Override
public
String
[]
getFilterFlags
()
{
return
new
String
[
0
];
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public
Object
getHelpContextIds
()
{
return
null
;
}
@Override
public
String
getDescription
()
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceAbstract.java
浏览文件 @
413c23d1
...
...
@@ -21,7 +21,6 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import
org.eclipse.core.runtime.jobs.JobChangeAdapter
;
import
org.eclipse.jface.viewers.IFilter
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.ui.views.properties.IPropertyDescriptor
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.core.Log
;
import
org.jkiss.dbeaver.model.DBPContextProvider
;
...
...
@@ -119,12 +118,6 @@ public abstract class PropertySourceAbstract implements DBPPropertySource, IProp
return
object
;
}
@Override
public
IPropertyDescriptor
[]
getPropertyDescriptors
()
{
return
props
.
toArray
(
new
IPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
DBPPropertyDescriptor
[]
getPropertyDescriptors2
()
{
return
props
.
toArray
(
new
DBPPropertyDescriptor
[
props
.
size
()]);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceCollection.java
浏览文件 @
413c23d1
...
...
@@ -17,11 +17,6 @@
*/
package
org.jkiss.dbeaver.ui.properties
;
import
org.eclipse.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.ILabelProvider
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.ui.views.properties.IPropertyDescriptor
;
import
org.eclipse.ui.views.properties.IPropertySource
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.model.DBUtils
;
...
...
@@ -33,9 +28,9 @@ import java.util.List;
/**
* Simple property source which store properties in map
*/
public
class
PropertySourceCollection
implements
DBPPropertySource
,
IPropertySource
{
public
class
PropertySourceCollection
implements
DBPPropertySource
{
private
List
<
IPropertyDescriptor
>
props
=
new
ArrayList
<
I
PropertyDescriptor
>();
private
List
<
DBPPropertyDescriptor
>
props
=
new
ArrayList
<
DBP
PropertyDescriptor
>();
private
List
<
Object
>
items
;
...
...
@@ -59,12 +54,6 @@ public class PropertySourceCollection implements DBPPropertySource, IPropertySou
return
props
.
toArray
(
new
DBPPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
IPropertyDescriptor
[]
getPropertyDescriptors
()
{
return
props
.
toArray
(
new
IPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
Object
getPropertyValue
(
Object
id
)
{
...
...
@@ -108,7 +97,7 @@ public class PropertySourceCollection implements DBPPropertySource, IPropertySou
return
false
;
}
private
class
ItemPropertyDescriptor
implements
DBPPropertyDescriptor
,
IPropertyDescriptor
{
private
class
ItemPropertyDescriptor
implements
DBPPropertyDescriptor
{
private
Integer
id
;
private
Object
item
;
...
...
@@ -117,11 +106,6 @@ public class PropertySourceCollection implements DBPPropertySource, IPropertySou
this
.
item
=
item
;
}
@Override
public
CellEditor
createPropertyEditor
(
Composite
composite
)
{
return
null
;
}
@Override
public
String
getCategory
()
{
return
null
;
...
...
@@ -157,29 +141,9 @@ public class PropertySourceCollection implements DBPPropertySource, IPropertySou
return
DBUtils
.
getObjectShortName
(
item
);
}
@Override
public
String
[]
getFilterFlags
()
{
return
null
;
}
@Override
public
Object
getHelpContextIds
()
{
return
null
;
}
@Override
public
Object
getId
()
{
return
id
;
}
@Override
public
ILabelProvider
getLabelProvider
()
{
return
null
;
}
@Override
public
boolean
isCompatibleWith
(
IPropertyDescriptor
prop
)
{
return
this
.
equals
(
prop
);
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceCustom.java
浏览文件 @
413c23d1
...
...
@@ -17,9 +17,6 @@
*/
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
;
...
...
@@ -30,7 +27,7 @@ import java.util.*;
/**
* Simple property source which store properties in map
*/
public
class
PropertySourceCustom
implements
DBPPropertySource
,
IPropertySource2
{
public
class
PropertySourceCustom
implements
DBPPropertySource
{
private
List
<
DBPPropertyDescriptor
>
props
=
new
ArrayList
<
DBPPropertyDescriptor
>();
...
...
@@ -107,12 +104,6 @@ public class PropertySourceCustom implements DBPPropertySource, IPropertySource2
return
props
.
toArray
(
new
DBPPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
IPropertyDescriptor
[]
getPropertyDescriptors
()
{
return
props
.
toArray
(
new
IPropertyDescriptor
[
props
.
size
()]);
}
@Override
public
Object
getPropertyValue
(
Object
id
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertySourceDelegate.java
0 → 100644
浏览文件 @
413c23d1
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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.IPropertyDescriptor
;
import
org.eclipse.ui.views.properties.IPropertySource2
;
import
org.jkiss.dbeaver.model.DBPPropertyDescriptor
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
/**
* PropertySourceDelegate
*/
public
class
PropertySourceDelegate
implements
IPropertySource2
{
private
final
DBPPropertySource
source
;
public
PropertySourceDelegate
(
DBPPropertySource
source
)
{
this
.
source
=
source
;
}
@Override
public
boolean
isPropertyResettable
(
Object
id
)
{
return
source
.
isPropertyResettable
(
id
);
}
@Override
public
Object
getEditableValue
()
{
return
source
.
getEditableValue
();
}
@Override
public
IPropertyDescriptor
[]
getPropertyDescriptors
()
{
DBPPropertyDescriptor
[]
src
=
source
.
getPropertyDescriptors2
();
if
(
src
==
null
)
{
return
null
;
}
IPropertyDescriptor
[]
dst
=
new
IPropertyDescriptor
[
src
.
length
];
for
(
int
i
=
0
;
i
<
src
.
length
;
i
++)
{
dst
[
i
]
=
new
PropertyDescriptorDelegate
(
source
,
src
[
i
]);
}
return
dst
;
}
@Override
public
Object
getPropertyValue
(
Object
id
)
{
return
source
.
getPropertyValue
(
id
);
}
@Override
public
boolean
isPropertySet
(
Object
id
)
{
return
source
.
isPropertySet
(
id
);
}
@Override
public
void
resetPropertyValue
(
Object
id
)
{
source
.
resetPropertyValue
(
id
);
}
@Override
public
void
setPropertyValue
(
Object
id
,
Object
value
)
{
source
.
setPropertyValue
(
id
,
value
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/properties/PropertyTreeViewer.java
浏览文件 @
413c23d1
...
...
@@ -78,7 +78,6 @@ public class PropertyTreeViewer extends TreeViewer {
//this.setLayoutData(gd);
super
.
setContentProvider
(
new
PropsContentProvider
());
//super.setLabelProvider(labelProvider);
final
Tree
treeControl
=
super
.
getTree
();
if
(
parent
.
getLayout
()
instanceof
GridLayout
)
{
GridData
gd
=
new
GridData
(
GridData
.
FILL_BOTH
);
...
...
plugins/org.jkiss.dbeaver.erd/plugin.xml
浏览文件 @
413c23d1
...
...
@@ -55,7 +55,7 @@
<adapter
type=
"org.jkiss.dbeaver.model.DBPQualifiedObject"
/>
<adapter
type=
"org.jkiss.dbeaver.model.struct.DBSObject"
/>
<adapter
type=
"org.jkiss.dbeaver.model.struct.DBSEntity"
/>
<adapter
type=
"org.
eclipse.ui.views.properties.I
PropertySource"
/>
<adapter
type=
"org.
jkiss.dbeaver.model.DBP
PropertySource"
/>
</factory>
<factory
adaptableType=
"org.eclipse.swt.widgets.Control"
class=
"org.jkiss.dbeaver.ext.erd.editor.ERDEditorAdapter"
>
<adapter
type=
"org.jkiss.dbeaver.ext.erd.editor.ERDEditorPart"
/>
...
...
plugins/org.jkiss.dbeaver.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDObject.java
浏览文件 @
413c23d1
...
...
@@ -23,10 +23,10 @@ package org.jkiss.dbeaver.ext.erd.model;
import
org.jkiss.dbeaver.core.Log
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.ui.PlatformUI
;
import
org.eclipse.ui.views.properties.IPropertySource
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPNamedObject
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.model.navigator.DBNDatabaseNode
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
...
...
@@ -119,7 +119,7 @@ public abstract class ERDObject<OBJECT> implements IAdaptable, DBPNamedObject
@Override
public
Object
getAdapter
(
Class
adapter
)
{
if
(
adapter
==
I
PropertySource
.
class
)
{
if
(
adapter
==
DBP
PropertySource
.
class
)
{
return
getPropertyCollector
();
}
return
null
;
...
...
plugins/org.jkiss.dbeaver.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDObjectAdapter.java
浏览文件 @
413c23d1
...
...
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IAdapterFactory;
import
org.eclipse.gef.EditPart
;
import
org.jkiss.dbeaver.model.DBPNamedObject
;
import
org.jkiss.dbeaver.model.DBPObject
;
import
org.jkiss.dbeaver.model.DBPPropertySource
;
import
org.jkiss.dbeaver.model.DBPQualifiedObject
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
...
...
@@ -48,6 +49,13 @@ public class ERDObjectAdapter implements IAdapterFactory {
}
}
}
}
else
if
(
DBPPropertySource
.
class
.
isAssignableFrom
(
adapterType
))
{
if
(
adaptableObject
instanceof
EditPart
)
{
Object
model
=
((
EditPart
)
adaptableObject
).
getModel
();
if
(
model
instanceof
ERDObject
)
{
return
((
ERDObject
)
model
).
getAdapter
(
adapterType
);
}
}
}
return
null
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录