Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
94dae6ca
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,发现更多精彩内容 >>
提交
94dae6ca
编写于
6月 24, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1652 Check selected attributes in join
Former-commit-id:
a4c41917
上级
056d0708
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
127 addition
and
72 deletion
+127
-72
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/command/AttributeCheckCommand.java
.../jkiss/dbeaver/ext/erd/command/AttributeCheckCommand.java
+52
-0
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/figures/AttributeItemFigure.java
...rg/jkiss/dbeaver/ext/erd/figures/AttributeItemFigure.java
+13
-1
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/figures/CustomCheckBoxFigure.java
...g/jkiss/dbeaver/ext/erd/figures/CustomCheckBoxFigure.java
+6
-8
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDEntityAttribute.java
...c/org/jkiss/dbeaver/ext/erd/model/ERDEntityAttribute.java
+18
-0
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/part/AttributePart.java
...erd/src/org/jkiss/dbeaver/ext/erd/part/AttributePart.java
+13
-10
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/policy/ColumnDirectEditPolicy.java
.../jkiss/dbeaver/ext/erd/policy/ColumnDirectEditPolicy.java
+0
-10
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/policy/EntityDirectEditPolicy.java
.../jkiss/dbeaver/ext/erd/policy/EntityDirectEditPolicy.java
+25
-40
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/policy/NoteDirectEditPolicy.java
...rg/jkiss/dbeaver/ext/erd/policy/NoteDirectEditPolicy.java
+0
-3
未找到文件。
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/command/AttributeCheckCommand.java
0 → 100644
浏览文件 @
94dae6ca
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.erd.command
;
import
org.eclipse.gef.commands.Command
;
import
org.jkiss.dbeaver.ext.erd.figures.NoteFigure
;
import
org.jkiss.dbeaver.ext.erd.part.AttributePart
;
/**
* Change attribute checked state
*/
public
class
AttributeCheckCommand
extends
Command
{
private
AttributePart
attr
;
private
boolean
newValue
;
private
boolean
oldValue
;
public
AttributeCheckCommand
(
AttributePart
attr
,
boolean
newValue
)
{
super
(
"Set note text"
);
this
.
attr
=
attr
;
this
.
oldValue
=
this
.
attr
.
getAttribute
().
isChecked
();
this
.
newValue
=
newValue
;
}
@Override
public
void
execute
()
{
attr
.
getAttribute
().
setChecked
(
newValue
);
attr
.
getFigure
().
getCheckBox
().
setSelected
(
newValue
);
}
@Override
public
void
undo
()
{
attr
.
getAttribute
().
setChecked
(
oldValue
);
attr
.
getFigure
().
getCheckBox
().
setSelected
(
oldValue
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/figures/AttributeItemFigure.java
浏览文件 @
94dae6ca
...
...
@@ -22,6 +22,7 @@ package org.jkiss.dbeaver.ext.erd.figures;
import
org.eclipse.draw2d.*
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.ext.erd.command.AttributeCheckCommand
;
import
org.jkiss.dbeaver.ext.erd.editor.ERDViewStyle
;
import
org.jkiss.dbeaver.ext.erd.model.ERDDecorator
;
import
org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute
;
...
...
@@ -48,6 +49,8 @@ public class AttributeItemFigure extends Figure
super
();
this
.
part
=
part
;
ERDEntityAttribute
attribute
=
part
.
getAttribute
();
ToolbarLayout
layout
=
new
ToolbarLayout
(
true
);
setLayoutManager
(
layout
);
...
...
@@ -57,9 +60,18 @@ public class AttributeItemFigure extends Figure
boolean
showCheckboxes
=
diagram
.
getDecorator
().
showCheckboxes
();
if
(
showCheckboxes
)
{
CustomCheckBoxFigure
attrCheckbox
=
new
CustomCheckBoxFigure
();
attrCheckbox
.
setSelected
(
attribute
.
isChecked
());
attrCheckbox
.
addChangeListener
(
changeEvent
->
{
boolean
oldChecked
=
attribute
.
isChecked
();
boolean
newChecked
=
attrCheckbox
.
isSelected
();
if
(
oldChecked
!=
newChecked
)
{
part
.
getDiagramPart
().
getViewer
().
getEditDomain
().
getCommandStack
().
execute
(
new
AttributeCheckCommand
(
part
,
attrCheckbox
.
isSelected
())
);
}
});
add
(
attrCheckbox
);
}
ERDEntityAttribute
attribute
=
part
.
getAttribute
();
String
attributeLabel
=
ERDUtils
.
getAttributeLabel
(
diagram
,
attribute
);
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/figures/CustomCheckBoxFigure.java
浏览文件 @
94dae6ca
...
...
@@ -23,8 +23,8 @@ public final class CustomCheckBoxFigure extends Toggle {
}
public
CustomCheckBoxFigure
(
String
text
)
{
this
.
label
=
n
ull
;
this
.
setContents
(
this
.
label
=
new
Label
(
text
,
UNCHECKED
)
);
this
.
label
=
n
ew
Label
(
text
,
UNCHECKED
)
;
this
.
setContents
(
this
.
label
);
}
protected
void
handleSelectionChanged
()
{
...
...
@@ -38,13 +38,11 @@ public final class CustomCheckBoxFigure extends Toggle {
protected
void
init
()
{
super
.
init
();
this
.
addChangeListener
(
new
ChangeListener
()
{
public
void
handleStateChanged
(
ChangeEvent
changeEvent
)
{
if
(
changeEvent
.
getPropertyName
().
equals
(
"selected"
))
{
CustomCheckBoxFigure
.
this
.
handleSelectionChanged
();
}
this
.
addChangeListener
(
changeEvent
->
{
if
(
changeEvent
.
getPropertyName
().
equals
(
"selected"
))
{
CustomCheckBoxFigure
.
this
.
handleSelectionChanged
();
}
});
}
}
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/model/ERDEntityAttribute.java
浏览文件 @
94dae6ca
...
...
@@ -30,8 +30,10 @@ import org.jkiss.dbeaver.model.struct.DBSEntityAttribute;
* @author Serge Rider
*/
public
class
ERDEntityAttribute
extends
ERDObject
<
DBSEntityAttribute
>
{
private
boolean
isChecked
;
private
boolean
inPrimaryKey
;
private
boolean
inForeignKey
;
private
String
alias
;
public
ERDEntityAttribute
(
DBSEntityAttribute
attribute
,
boolean
inPrimaryKey
)
{
super
(
attribute
);
...
...
@@ -46,6 +48,22 @@ public class ERDEntityAttribute extends ERDObject<DBSEntityAttribute> {
return
DBValueFormatting
.
getObjectImage
(
object
);
}
public
boolean
isChecked
()
{
return
isChecked
;
}
public
void
setChecked
(
boolean
checked
)
{
isChecked
=
checked
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
boolean
isInPrimaryKey
()
{
return
inPrimaryKey
;
}
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/part/AttributePart.java
浏览文件 @
94dae6ca
...
...
@@ -38,6 +38,7 @@ import org.jkiss.dbeaver.ext.erd.editor.ERDGraphicalViewer;
import
org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure
;
import
org.jkiss.dbeaver.ext.erd.figures.EditableLabel
;
import
org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute
;
import
org.jkiss.dbeaver.ext.erd.model.ERDObject
;
import
org.jkiss.dbeaver.ext.erd.model.ERDUtils
;
import
java.beans.PropertyChangeEvent
;
...
...
@@ -49,7 +50,10 @@ import java.beans.PropertyChangeEvent;
*/
public
class
AttributePart
extends
PropertyAwarePart
{
protected
DirectEditManager
manager
;
public
static
final
String
PROP_CHECKED
=
"NAME"
;
public
AttributePart
()
{
}
@Override
public
boolean
isSelectable
()
{
...
...
@@ -112,17 +116,16 @@ public class AttributePart extends PropertyAwarePart {
}
protected
void
performDirectEdit
()
{
if
(
manager
==
null
)
{
ERDGraphicalViewer
viewer
=
(
ERDGraphicalViewer
)
getViewer
();
ValidationMessageHandler
handler
=
viewer
.
getValidationHandler
();
ERDGraphicalViewer
viewer
=
(
ERDGraphicalViewer
)
getViewer
();
ValidationMessageHandler
handler
=
viewer
.
getValidationHandler
();
Label
l
=
getFigure
().
getLabel
();
ColumnNameTypeCellEditorValidator
columnNameTypeCellEditorValidator
=
new
ColumnNameTypeCellEditorValidator
(
handler
);
Label
l
=
getFigure
().
getLabel
();
ColumnNameTypeCellEditorValidator
columnNameTypeCellEditorValidator
=
new
ColumnNameTypeCellEditorValidator
(
handler
);
DirectEditManager
manager
=
new
ExtendedDirectEditManager
(
this
,
TextCellEditor
.
class
,
new
LabelCellEditorLocator
(
l
),
l
,
columnNameTypeCellEditorValidator
);
manager
=
new
ExtendedDirectEditManager
(
this
,
TextCellEditor
.
class
,
new
LabelCellEditorLocator
(
l
),
l
,
columnNameTypeCellEditorValidator
);
}
manager
.
show
();
}
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/policy/ColumnDirectEditPolicy.java
浏览文件 @
94dae6ca
...
...
@@ -54,9 +54,6 @@ public class ColumnDirectEditPolicy extends DirectEditPolicy
return
null
;
}
/**
* @see DirectEditPolicy#showCurrentEditValue(org.eclipse.gef.requests.DirectEditRequest)
*/
@Override
protected
void
showCurrentEditValue
(
DirectEditRequest
request
)
{
...
...
@@ -65,10 +62,6 @@ public class ColumnDirectEditPolicy extends DirectEditPolicy
attributePart
.
handleNameChange
(
value
);
}
/**
* @param to
* Revert request
*/
@Override
protected
void
storeOldEditValue
(
DirectEditRequest
request
)
{
...
...
@@ -76,9 +69,6 @@ public class ColumnDirectEditPolicy extends DirectEditPolicy
oldValue
=
(
String
)
cellEditor
.
getValue
();
}
/**
* @param request
*/
@Override
protected
void
revertOldEditValue
(
DirectEditRequest
request
)
{
...
...
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/policy/EntityDirectEditPolicy.java
浏览文件 @
94dae6ca
...
...
@@ -27,22 +27,17 @@ import org.jkiss.dbeaver.ext.erd.part.EntityPart;
/**
* EditPolicy for the direct editing of table names
*
*
* @author Serge Rider
*/
public
class
EntityDirectEditPolicy
extends
DirectEditPolicy
{
public
class
EntityDirectEditPolicy
extends
DirectEditPolicy
{
private
String
oldValue
;
private
String
oldValue
;
/**
* @see DirectEditPolicy#getDirectEditCommand(org.eclipse.gef.requests.DirectEditRequest)
*/
@Override
protected
Command
getDirectEditCommand
(
DirectEditRequest
request
)
{
@Override
protected
Command
getDirectEditCommand
(
DirectEditRequest
request
)
{
/*
EntityRenameCommand cmd = new EntityRenameCommand();
EntityRenameCommand cmd = new EntityRenameCommand();
ERDEntity table = (ERDEntity) getHost().getModel();
cmd.setTable(table);
cmd.setOldName(table.getName());
...
...
@@ -51,36 +46,26 @@ public class EntityDirectEditPolicy extends DirectEditPolicy
return cmd;
*/
return
null
;
}
}
/**
* @see DirectEditPolicy#showCurrentEditValue(org.eclipse.gef.requests.DirectEditRequest)
*/
@Override
protected
void
showCurrentEditValue
(
DirectEditRequest
request
)
{
String
value
=
(
String
)
request
.
getCellEditor
().
getValue
();
EntityPart
entityPart
=
(
EntityPart
)
getHost
();
entityPart
.
handleNameChange
(
value
);
}
@Override
protected
void
showCurrentEditValue
(
DirectEditRequest
request
)
{
String
value
=
(
String
)
request
.
getCellEditor
().
getValue
();
EntityPart
entityPart
=
(
EntityPart
)
getHost
();
entityPart
.
handleNameChange
(
value
);
}
@Override
protected
void
storeOldEditValue
(
DirectEditRequest
request
)
{
CellEditor
cellEditor
=
request
.
getCellEditor
();
oldValue
=
(
String
)
cellEditor
.
getValue
();
}
@Override
protected
void
storeOldEditValue
(
DirectEditRequest
request
)
{
CellEditor
cellEditor
=
request
.
getCellEditor
();
oldValue
=
(
String
)
cellEditor
.
getValue
();
}
/**
* @param request
*/
@Override
protected
void
revertOldEditValue
(
DirectEditRequest
request
)
{
CellEditor
cellEditor
=
request
.
getCellEditor
();
cellEditor
.
setValue
(
oldValue
);
EntityPart
entityPart
=
(
EntityPart
)
getHost
();
entityPart
.
revertNameChange
();
}
@Override
protected
void
revertOldEditValue
(
DirectEditRequest
request
)
{
CellEditor
cellEditor
=
request
.
getCellEditor
();
cellEditor
.
setValue
(
oldValue
);
EntityPart
entityPart
=
(
EntityPart
)
getHost
();
entityPart
.
revertNameChange
();
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/policy/NoteDirectEditPolicy.java
浏览文件 @
94dae6ca
...
...
@@ -57,9 +57,6 @@ public class NoteDirectEditPolicy extends DirectEditPolicy {
oldValue
=
(
String
)
cellEditor
.
getValue
();
}
/**
* @param request
*/
@Override
protected
void
revertOldEditValue
(
DirectEditRequest
request
)
{
CellEditor
cellEditor
=
request
.
getCellEditor
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录