Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
58f4a591
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,发现更多精彩内容 >>
提交
58f4a591
编写于
4月 22, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3205 PostgreSQL: schema DDL, schema comments edit support
Former-commit-id:
63ebdf78
上级
65df2077
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
54 addition
and
12 deletion
+54
-12
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
+1
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreSchemaManager.java
...iss/dbeaver/ext/postgresql/edit/PostgreSchemaManager.java
+15
-1
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
...org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
+30
-2
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java
...er/ext/postgresql/ui/editors/PostgreSourceViewEditor.java
+8
-9
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
浏览文件 @
58f4a591
...
...
@@ -348,6 +348,7 @@
<objectType
name=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreExtension"
/>
<objectType
name=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreForeignServer"
/>
<objectType
name=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreForeignDataWrapper"
/>
<objectType
name=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema"
/>
</editor>
<editor
id=
"postgresql.source.ddl"
class=
"org.jkiss.dbeaver.ext.postgresql.ui.editors.PostgreSourceViewEditor"
label=
"%db.editor.ddl.name"
description=
"%db.editor.ddl.description"
icon=
"#sql_text"
position=
"additions_middle"
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreSchemaManager.java
浏览文件 @
58f4a591
...
...
@@ -20,8 +20,8 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreRole
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreDatabase
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreRole
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema
;
import
org.jkiss.dbeaver.ext.postgresql.ui.PostgreCreateSchemaDialog
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
...
...
@@ -34,6 +34,7 @@ import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction;
import
org.jkiss.dbeaver.model.impl.sql.edit.SQLObjectEditor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.dbeaver.ui.UITask
;
import
java.util.List
;
...
...
@@ -116,5 +117,18 @@ public class PostgreSchemaManager extends SQLObjectEditor<PostgreSchema, Postgre
processObjectRename
(
commandContext
,
schema
,
newName
);
}
protected
void
addObjectExtraActions
(
List
<
DBEPersistAction
>
actions
,
NestedObjectCommand
<
PostgreSchema
,
PropertyHandler
>
command
,
Map
<
String
,
Object
>
options
)
{
PostgreSchema
schema
=
command
.
getObject
();
String
comment
=
schema
.
getDescription
();
if
(
comment
!=
null
)
{
actions
.
add
(
new
SQLDatabasePersistAction
(
"Comment schema"
,
"COMMENT ON SCHEMA "
+
DBUtils
.
getQuotedIdentifier
(
schema
)
+
" IS "
+
SQLUtils
.
quoteString
(
schema
,
comment
)));
}
}
}
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
浏览文件 @
58f4a591
...
...
@@ -35,12 +35,14 @@ import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCStructLookupCache;
import
org.jkiss.dbeaver.model.meta.Association
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.dbeaver.model.struct.DBSDataType
;
import
org.jkiss.dbeaver.model.struct.DBSEntity
;
import
org.jkiss.dbeaver.model.struct.DBSEntityConstraintType
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedureContainer
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSSchema
;
import
org.jkiss.utils.CommonUtils
;
import
java.lang.reflect.Array
;
import
java.sql.ResultSet
;
...
...
@@ -54,7 +56,7 @@ import java.util.stream.Collectors;
/**
* PostgreSchema
*/
public
class
PostgreSchema
implements
DBSSchema
,
DBPNamedObject2
,
DBPSaveableObject
,
DBPRefreshableObject
,
DBPSystemObject
,
DBSProcedureContainer
,
PostgreObject
{
public
class
PostgreSchema
implements
DBSSchema
,
DBPNamedObject2
,
DBPSaveableObject
,
DBPRefreshableObject
,
DBPSystemObject
,
DBSProcedureContainer
,
PostgreObject
,
PostgreScriptObject
{
private
static
final
Log
log
=
Log
.
getLog
(
PostgreSchema
.
class
);
...
...
@@ -127,13 +129,17 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
return
PostgreUtils
.
getObjectById
(
monitor
,
database
.
roleCache
,
database
,
ownerId
);
}
@Property
(
viewable
=
true
,
order
=
100
)
@Property
(
viewable
=
true
,
editable
=
true
,
updatable
=
true
,
order
=
100
)
@Nullable
@Override
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
@Override
public
PostgreDatabase
getParentObject
()
{
...
...
@@ -338,6 +344,28 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
return
PostgreConstants
.
CATALOG_SCHEMA_NAME
.
equals
(
name
);
}
@Override
public
String
getObjectDefinitionText
(
DBRProgressMonitor
monitor
,
Map
<
String
,
Object
>
options
)
throws
DBException
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"-- DROP SCHEMA "
).
append
(
DBUtils
.
getQuotedIdentifier
(
this
)).
append
(
";\n\n"
);
sql
.
append
(
"CREATE SCHEMA "
).
append
(
DBUtils
.
getQuotedIdentifier
(
this
));
PostgreRole
owner
=
getOwner
(
monitor
);
if
(
owner
!=
null
)
{
sql
.
append
(
" AUTHORIZATION "
).
append
(
DBUtils
.
getQuotedIdentifier
(
owner
));
}
sql
.
append
(
";\n\n"
);
if
(!
CommonUtils
.
isEmpty
(
getDescription
()))
{
sql
.
append
(
"COMMENT ON SCHEMA "
).
append
(
DBUtils
.
getQuotedIdentifier
(
this
))
.
append
(
" IS "
).
append
(
SQLUtils
.
quoteString
(
this
,
getDescription
()));
}
return
sql
.
toString
();
}
@Override
public
void
setObjectDefinitionText
(
String
sourceText
)
throws
DBException
{
throw
new
DBException
(
"Schema DDL is read-only"
);
}
class
CollationCache
extends
JDBCObjectCache
<
PostgreSchema
,
PostgreCollation
>
{
@Override
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java
浏览文件 @
58f4a591
...
...
@@ -17,9 +17,6 @@
package
org.jkiss.dbeaver.ext.postgresql.ui.editors
;
import
java.util.Map
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.e4.core.services.events.IEventBroker
;
import
org.eclipse.jface.action.ControlContribution
;
import
org.eclipse.jface.action.IContributionManager
;
...
...
@@ -30,13 +27,9 @@ import org.eclipse.swt.widgets.Button;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.ui.IEditorInput
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreActivator
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreConstants
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgrePermissionsOwner
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedure
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreScriptObject
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreTableBase
;
import
org.jkiss.dbeaver.ext.postgresql.model.*
;
import
org.jkiss.dbeaver.model.DBPScriptObject
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.ui.UIUtils
;
...
...
@@ -46,6 +39,8 @@ import org.jkiss.dbeaver.utils.GeneralUtils;
import
org.osgi.service.event.Event
;
import
org.osgi.service.event.EventHandler
;
import
java.util.Map
;
/**
* PostgreSourceViewEditor
*/
...
...
@@ -98,8 +93,12 @@ public class PostgreSourceViewEditor extends SQLSourceViewer<PostgreScriptObject
@Override
protected
boolean
isReadOnly
()
{
PostgreScriptObject
sourceObject
=
getSourceObject
();
if
(
sourceObject
instanceof
PostgreProcedure
||
sourceObject
instanceof
PostgreTrigger
)
{
return
false
;
}
return
true
;
}
public
boolean
getShowPermissions
()
{
// By default permissions enabled only for tables
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录