Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
见谅
dbeaver
提交
d7d614ef
D
dbeaver
项目概览
见谅
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
6
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,体验更适合开发者的 AI 搜索 >>
提交
d7d614ef
编写于
8月 20, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GraphML format support
上级
8b5929e7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
65 addition
and
25 deletion
+65
-25
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/ERDExportGraphML.java
...rc/org/jkiss/dbeaver/ext/erd/editor/ERDExportGraphML.java
+45
-11
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDAssociation.java
...d/src/org/jkiss/dbeaver/ext/erd/model/ERDAssociation.java
+16
-0
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/part/AssociationPart.java
...d/src/org/jkiss/dbeaver/ext/erd/part/AssociationPart.java
+4
-14
未找到文件。
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/editor/ERDExportGraphML.java
浏览文件 @
d7d614ef
...
...
@@ -17,6 +17,7 @@
*/
package
org.jkiss.dbeaver.ext.erd.editor
;
import
org.eclipse.draw2d.Bendpoint
;
import
org.eclipse.draw2d.geometry.Rectangle
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.FontData
;
...
...
@@ -27,6 +28,7 @@ import org.jkiss.dbeaver.ext.erd.model.ERDAssociation;
import
org.jkiss.dbeaver.ext.erd.model.ERDEntity
;
import
org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute
;
import
org.jkiss.dbeaver.ext.erd.model.EntityDiagram
;
import
org.jkiss.dbeaver.ext.erd.part.AssociationPart
;
import
org.jkiss.dbeaver.ext.erd.part.DiagramPart
;
import
org.jkiss.dbeaver.ext.erd.part.EntityPart
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
...
...
@@ -72,6 +74,12 @@ public class ERDExportGraphML
xml
.
addAttribute
(
"yfiles.type"
,
"nodegraphics"
);
xml
.
endElement
();
xml
.
startElement
(
"key"
);
xml
.
addAttribute
(
"for"
,
"edge"
);
xml
.
addAttribute
(
"id"
,
"edgegraph"
);
xml
.
addAttribute
(
"yfiles.type"
,
"edgegraphics"
);
xml
.
endElement
();
xml
.
startElement
(
"graph"
);
xml
.
addAttribute
(
"edgedefault"
,
"directed"
);
xml
.
addAttribute
(
"id"
,
"G"
);
...
...
@@ -90,6 +98,7 @@ public class ERDExportGraphML
// Graph data
xml
.
startElement
(
"data"
);
xml
.
addAttribute
(
"key"
,
"nodegraph"
);
{
// Generic node
EntityPart
part
=
diagramPart
.
getEntityPart
(
entity
);
...
...
@@ -194,17 +203,6 @@ public class ERDExportGraphML
xml
.
endElement
();
xml
.
endElement
();
// <y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="48.103515625" modelName="custom" textColor="#000000" visible="true" width="57.3671875" x="2.0" y="30.701171875">attribute 1
// attribute 2
// attribute 3<y:LabelModel>
// <y:ErdAttributesNodeLabelModel/>
// </y:LabelModel>
// <y:ModelParameter>
// <y:ErdAttributesNodeLabelModelParameter/>
// </y:ModelParameter>
// </y:NodeLabel>
}
xml
.
endElement
();
...
...
@@ -218,7 +216,14 @@ public class ERDExportGraphML
int
edgeNum
=
0
;
for
(
ERDEntity
entity
:
diagram
.
getEntities
())
{
EntityPart
entityPart
=
diagramPart
.
getEntityPart
(
entity
);
for
(
ERDAssociation
association
:
entity
.
getForeignKeyRelationships
())
{
AssociationPart
associationPart
=
entityPart
.
getConnectionPart
(
association
,
true
);
if
(
associationPart
==
null
)
{
log
.
debug
(
"Association part not found"
);
continue
;
}
edgeNum
++;
String
edgeId
=
"e"
+
edgeNum
;
...
...
@@ -226,6 +231,35 @@ public class ERDExportGraphML
xml
.
addAttribute
(
"id"
,
edgeId
);
xml
.
addAttribute
(
"source"
,
entityMap
.
get
(
entity
));
xml
.
addAttribute
(
"target"
,
entityMap
.
get
(
association
.
getPrimaryKeyEntity
()));
xml
.
startElement
(
"data"
);
xml
.
addAttribute
(
"key"
,
"edgegraph"
);
xml
.
startElement
(
"y:PolyLineEdge"
);
xml
.
startElement
(
"y:Path"
);
// sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
for
(
Bendpoint
bp
:
associationPart
.
getBendpoints
())
{
xml
.
startElement
(
"y:Point"
);
xml
.
addAttribute
(
"x"
,
bp
.
getLocation
().
x
);
xml
.
addAttribute
(
"y"
,
bp
.
getLocation
().
x
);
xml
.
endElement
();
}
xml
.
endElement
();
xml
.
startElement
(
"y:LineStyle"
);
xml
.
addAttribute
(
"color"
,
"#000000"
);
xml
.
addAttribute
(
"type"
,
!
association
.
isIdentifying
()
||
association
.
isLogical
()
?
"dashed"
:
"line"
);
xml
.
addAttribute
(
"width"
,
"1.0"
);
xml
.
endElement
();
xml
.
startElement
(
"y:Arrows"
);
String
sourceStyle
=
!
association
.
isIdentifying
()
?
"white_diamond"
:
"none"
;
xml
.
addAttribute
(
"source"
,
sourceStyle
);
xml
.
addAttribute
(
"target"
,
"circle"
);
xml
.
endElement
();
xml
.
startElement
(
"y:BendStyle"
);
xml
.
addAttribute
(
"smoothed"
,
"false"
);
xml
.
endElement
();
xml
.
endElement
();
xml
.
endElement
();
xml
.
endElement
();
}
}
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDAssociation.java
浏览文件 @
d7d614ef
...
...
@@ -22,6 +22,9 @@ package org.jkiss.dbeaver.ext.erd.model;
import
org.eclipse.draw2d.geometry.Point
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSEntityAssociation
;
import
java.util.List
;
...
...
@@ -37,6 +40,7 @@ public class ERDAssociation extends ERDObject<DBSEntityAssociation>
private
ERDEntity
primaryKeyEntity
;
private
ERDEntity
foreignKeyEntity
;
private
List
<
Point
>
initBends
;
private
Boolean
identifying
;
/**
* Constructor for logical association
...
...
@@ -117,6 +121,18 @@ public class ERDAssociation extends ERDObject<DBSEntityAssociation>
this
.
initBends
=
bends
;
}
public
boolean
isIdentifying
()
{
if
(
identifying
==
null
)
{
identifying
=
false
;
try
{
identifying
=
DBUtils
.
isIdentifyingAssociation
(
VoidProgressMonitor
.
INSTANCE
,
getObject
());
}
catch
(
DBException
e
)
{
log
.
debug
(
e
);
}
}
return
identifying
;
}
@Override
public
String
toString
()
{
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/part/AssociationPart.java
浏览文件 @
d7d614ef
...
...
@@ -20,7 +20,6 @@
*/
package
org.jkiss.dbeaver.ext.erd.part
;
import
org.jkiss.dbeaver.Log
;
import
org.eclipse.draw2d.*
;
import
org.eclipse.draw2d.geometry.Dimension
;
import
org.eclipse.draw2d.geometry.Point
;
...
...
@@ -31,17 +30,16 @@ import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.widgets.Display
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.erd.model.ERDAssociation
;
import
org.jkiss.dbeaver.ext.erd.policy.AssociationBendEditPolicy
;
import
org.jkiss.dbeaver.ext.erd.policy.AssociationEditPolicy
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSEntityAssociation
;
import
org.jkiss.dbeaver.model.struct.DBSEntityAttribute
;
import
org.jkiss.dbeaver.model.struct.DBSEntityConstraintType
;
import
org.jkiss.dbeaver.model.struct.DBSEntityReferrer
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -53,7 +51,6 @@ import java.util.*;
* @author Serge Rieder
*/
public
class
AssociationPart
extends
PropertyAwareConnectionPart
{
static
final
Log
log
=
Log
.
getLog
(
AssociationPart
.
class
);
public
AssociationPart
()
{
...
...
@@ -88,13 +85,6 @@ public class AssociationPart extends PropertyAwareConnectionPart {
protected
IFigure
createFigure
()
{
ERDAssociation
association
=
(
ERDAssociation
)
getModel
();
boolean
identifying
=
false
;
try
{
identifying
=
DBUtils
.
isIdentifyingAssociation
(
VoidProgressMonitor
.
INSTANCE
,
association
.
getObject
());
}
catch
(
DBException
e
)
{
log
.
debug
(
e
);
}
PolylineConnection
conn
=
(
PolylineConnection
)
super
.
createFigure
();
//conn.setLineJoin(SWT.JOIN_ROUND);
//conn.setConnectionRouter(new BendpointConnectionRouter());
...
...
@@ -115,7 +105,7 @@ public class AssociationPart extends PropertyAwareConnectionPart {
targetDecor
.
setBackgroundColor
(
getParent
().
getViewer
().
getControl
().
getForeground
());
//dec.setBackgroundColor(getParent().getViewer().getControl().getBackground());
conn
.
setTargetDecoration
(
targetDecor
);
if
(!
identifying
)
{
if
(!
association
.
isIdentifying
()
)
{
final
RhombusDecoration
sourceDecor
=
new
RhombusDecoration
();
sourceDecor
.
setBackgroundColor
(
getParent
().
getViewer
().
getControl
().
getBackground
());
//dec.setBackgroundColor(getParent().getViewer().getControl().getBackground());
...
...
@@ -123,7 +113,7 @@ public class AssociationPart extends PropertyAwareConnectionPart {
}
}
if
(!
identifying
||
association
.
isLogical
())
{
if
(!
association
.
isIdentifying
()
||
association
.
isLogical
())
{
conn
.
setLineStyle
(
SWT
.
LINE_CUSTOM
);
conn
.
setLineDash
(
new
float
[]
{
5
}
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录