use of org.jkiss.dbeaver.erd.ui.part.AttributePart in project dbeaver by serge-rider.
the class AttributeConnectionEditPolicy method getAddCommand.
@Override
protected Command getAddCommand(GroupRequest request) {
List srcParts = request.getEditParts();
if (srcParts.size() != 1) {
// Can drop only one attribute
return null;
}
if (!(srcParts.get(0) instanceof AttributePart)) {
// Not attribute
return null;
}
AttributePart srcPart = (AttributePart) srcParts.get(0);
if (srcPart.getParent() == part.getParent()) {
// Can't drop attribute to the same parent
return null;
}
AssociationCreateCommand command = new AssociationCreateCommand();
command.setSourceEntity(srcPart.getEntity());
command.setTargetEntity(part.getEntity());
command.setAttributes(srcPart.getAttribute(), part.getAttribute());
return command;
}
use of org.jkiss.dbeaver.erd.ui.part.AttributePart in project dbeaver by dbeaver.
the class AttributeConnectionEditPolicy method getAddCommand.
@Override
protected Command getAddCommand(GroupRequest request) {
List srcParts = request.getEditParts();
if (srcParts.size() != 1) {
// Can drop only one attribute
return null;
}
if (!(srcParts.get(0) instanceof AttributePart)) {
// Not attribute
return null;
}
AttributePart srcPart = (AttributePart) srcParts.get(0);
if (srcPart.getParent() == part.getParent()) {
// Can't drop attribute to the same parent
return null;
}
AssociationCreateCommand command = new AssociationCreateCommand();
command.setSourceEntity(srcPart.getEntity());
command.setTargetEntity(part.getEntity());
command.setAttributes(srcPart.getAttribute(), part.getAttribute());
return command;
}
use of org.jkiss.dbeaver.erd.ui.part.AttributePart in project dbeaver by dbeaver.
the class AttributeDirectEditPolicy method showCurrentEditValue.
@Override
protected void showCurrentEditValue(DirectEditRequest request) {
String value = (String) request.getCellEditor().getValue();
AttributePart attributePart = (AttributePart) getHost();
attributePart.handleNameChange(value);
}
use of org.jkiss.dbeaver.erd.ui.part.AttributePart in project dbeaver by dbeaver.
the class AttributeDirectEditPolicy method revertOldEditValue.
@Override
protected void revertOldEditValue(DirectEditRequest request) {
CellEditor cellEditor = request.getCellEditor();
cellEditor.setValue(oldValue);
AttributePart attributePart = (AttributePart) getHost();
attributePart.revertNameChange(oldValue);
}
use of org.jkiss.dbeaver.erd.ui.part.AttributePart in project dbeaver by serge-rider.
the class AttributeDirectEditPolicy method revertOldEditValue.
@Override
protected void revertOldEditValue(DirectEditRequest request) {
CellEditor cellEditor = request.getCellEditor();
cellEditor.setValue(oldValue);
AttributePart attributePart = (AttributePart) getHost();
attributePart.revertNameChange(oldValue);
}
Aggregations