use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class AbstractBasicPart method handleChildChange.
protected void handleChildChange(PropertyChangeEvent evt) {
Object newValue = evt.getNewValue();
Object oldValue = evt.getOldValue();
if ((oldValue == null) && (newValue == null)) {
throw new IllegalStateException(Messages.errOldNewValueBothNull);
}
if (oldValue != null) {
List children = getChildren();
EditPart partToRemove = null;
for (Iterator iter = children.iterator(); iter.hasNext(); ) {
EditPart part = (EditPart) iter.next();
if (part.getModel() instanceof PropertyChangeProvider && oldValue instanceof PropertyChangeProvider) {
PropertyChangeProvider model = (PropertyChangeProvider) part.getModel();
PropertyChangeProvider old = (PropertyChangeProvider) oldValue;
PropertyChangeProvider newV = (PropertyChangeProvider) newValue;
if (newV != null && model.getName().equals(newV.getName())) {
return;
}
if (model.getName().equals(old.getName())) {
partToRemove = part;
break;
}
} else if (part.getModel().equals(oldValue)) {
partToRemove = part;
break;
}
}
if (partToRemove != null) {
removeChild(partToRemove);
}
}
if (newValue != null) {
EditPart editPart = createChild(newValue);
int modelIndex = getModelChildren().indexOf(newValue);
addChild(editPart, modelIndex);
}
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class AbstractSelectionAction method getSelectedNode.
/**
* Get the first selected node.
*
* @return
*/
protected PropertyChangeProvider getSelectedNode() {
List objects = getSelectedObjects();
if (objects.isEmpty()) {
return null;
}
if (!(objects.get(0) instanceof EditPart)) {
return null;
}
EditPart part = (EditPart) objects.get(0);
return (PropertyChangeProvider) part.getModel();
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class SchemaDiagramPart method handleRelationMapChange.
/* (non-Javadoc)
* @see com.cubrid.common.ui.er.part.BasicPart#handleRelationMapChange(java.beans.PropertyChangeEvent)
*/
@Override
protected void handleRelationMapChange(PropertyChangeEvent evt) {
List<EditPart> children = getChildren();
for (EditPart part : children) {
if (part instanceof TablePart) {
TablePart tablePart = (TablePart) part;
tablePart.handleRelationMapChange(evt);
}
}
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class TablePart method setRelationLinesSyncColor.
/**
* Set all relation line same color by the table border color,if the table
* border color is not its default.
*
* @param checkRelatedSelectedTable if it is true, the line color should be
* effected by related table border color.
*/
public void setRelationLinesSyncColor(boolean checkRelatedSelectedTable) {
List<EditPart> sourceConnPartList = (List<EditPart>) getSourceConnections();
for (EditPart connPart : sourceConnPartList) {
RelationshipPart linePart = (RelationshipPart) connPart;
linePart.setSyncColorWithTable(this);
if (checkRelatedSelectedTable) {
linePart.setSelectedTableColor();
}
}
List<EditPart> targetConnPartList = (List<EditPart>) getTargetConnections();
for (EditPart connPart : targetConnPartList) {
RelationshipPart linePart = (RelationshipPart) connPart;
linePart.setSyncColorWithTable(this);
if (checkRelatedSelectedTable) {
linePart.setSelectedTableColor();
}
}
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class TablePart method setRelationLinesFocus.
/**
* If the checkRelatedTableState is true, then check other end table whether
* is selected, if selected, the connection line should not be set "false"
* focus.
*
* @param connPartList
* @param focus
* @param checkRelatedSelectedTable
*/
private void setRelationLinesFocus(List<EditPart> connPartList, boolean focus, boolean checkRelatedSelectedTable) {
for (EditPart connPart : connPartList) {
RelationshipPart linePart = (RelationshipPart) connPart;
if (linePart.getSource() == null || linePart.getTarget() == null) {
continue;
}
connPart.setFocus(focus);
if (!focus && checkRelatedSelectedTable) {
if (((TablePart) linePart.getSource()).isSelected() || ((TablePart) linePart.getTarget()).isSelected()) {
continue;
}
}
linePart.setRelationColumnProtrude(focus);
}
}
Aggregations