Search in sources :

Example 6 with ConnectionEditPart

use of org.eclipse.gef.ConnectionEditPart in project cubrid-manager by CUBRID.

the class BrokerMonitorPart method refreshTargetConnections.

/**
	 * refresh Target Connections
	 */
protected void refreshTargetConnections() {
    super.refreshTargetConnections();
    for (Object obj : getTargetConnections()) {
        ConnectionEditPart ep = (ConnectionEditPart) obj;
        ep.refresh();
    }
}
Also used : ConnectionEditPart(org.eclipse.gef.ConnectionEditPart)

Example 7 with ConnectionEditPart

use of org.eclipse.gef.ConnectionEditPart in project tdi-studio-se by Talend.

the class NodePart method refreshTargetConnections.

@Override
protected void refreshTargetConnections() {
    int i;
    ConnectionEditPart editPart;
    Object model;
    Map mapModelToEditPart = new HashMap();
    List connections = getTargetConnections();
    for (i = 0; i < connections.size(); i++) {
        editPart = (ConnectionEditPart) connections.get(i);
        mapModelToEditPart.put(editPart.getModel(), editPart);
    }
    List modelObjects = getModelTargetConnections();
    if (modelObjects == null) {
        modelObjects = new ArrayList();
    }
    for (i = 0; i < modelObjects.size(); i++) {
        model = modelObjects.get(i);
        if (model instanceof IConnection) {
            INode sourcenode = ((IConnection) model).getSource();
            INode targetnode = ((IConnection) model).getSource();
            String connectorName = ((IConnection) model).getConnectorName();
            if (sourcenode.getConnectorFromName(connectorName) == null && targetnode.getConnectorFromName(connectorName) == null) {
                return;
            }
        }
        if (i < connections.size() && ((EditPart) connections.get(i)).getModel() == model) {
            continue;
        }
        editPart = (ConnectionEditPart) mapModelToEditPart.get(model);
        if (editPart != null) {
            reorderTargetConnection(editPart, i);
        } else {
            editPart = createOrFindConnection(model);
            addTargetConnection(editPart, i);
        }
    }
    // Remove the remaining Connection EditParts
    List trash = new ArrayList();
    for (; i < connections.size(); i++) {
        trash.add(connections.get(i));
    }
    for (i = 0; i < trash.size(); i++) {
        removeTargetConnection((ConnectionEditPart) trash.get(i));
    }
}
Also used : INode(org.talend.core.model.process.INode) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) RootEditPart(org.eclipse.gef.RootEditPart) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) NodeEditPart(org.eclipse.gef.NodeEditPart) List(java.util.List) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) Map(java.util.Map) HashMap(java.util.HashMap) Point(org.eclipse.draw2d.geometry.Point)

Example 8 with ConnectionEditPart

use of org.eclipse.gef.ConnectionEditPart in project tdi-studio-se by Talend.

the class NodePart method refreshSourceConnections.

@Override
protected void refreshSourceConnections() {
    int i;
    ConnectionEditPart editPart;
    Object model;
    Map modelToEditPart = new HashMap();
    List editParts = getSourceConnections();
    for (i = 0; i < editParts.size(); i++) {
        editPart = (ConnectionEditPart) editParts.get(i);
        modelToEditPart.put(editPart.getModel(), editPart);
    }
    List modelObjects = getModelSourceConnections();
    // List<? extends INodeConnector> connList = node.getListConnector();
    if (modelObjects == null) {
        modelObjects = new ArrayList();
    }
    for (i = 0; i < modelObjects.size(); i++) {
        model = modelObjects.get(i);
        if (model instanceof IConnection) {
            INode sourcenode = ((IConnection) model).getSource();
            INode targetnode = ((IConnection) model).getSource();
            String connectorName = ((IConnection) model).getConnectorName();
            if (sourcenode.getConnectorFromName(connectorName) == null && targetnode.getConnectorFromName(connectorName) == null) {
                return;
            }
        }
        if (i < editParts.size() && ((EditPart) editParts.get(i)).getModel() == model) {
            continue;
        }
        editPart = (ConnectionEditPart) modelToEditPart.get(model);
        if (editPart != null) {
            reorderSourceConnection(editPart, i);
        } else {
            editPart = createOrFindConnection(model);
            addSourceConnection(editPart, i);
        }
    }
    // Remove the remaining EditParts
    List trash = new ArrayList();
    for (; i < editParts.size(); i++) {
        trash.add(editParts.get(i));
    }
    for (i = 0; i < trash.size(); i++) {
        removeSourceConnection((ConnectionEditPart) trash.get(i));
    }
}
Also used : INode(org.talend.core.model.process.INode) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) RootEditPart(org.eclipse.gef.RootEditPart) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) NodeEditPart(org.eclipse.gef.NodeEditPart) List(java.util.List) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) Map(java.util.Map) HashMap(java.util.HashMap) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)8 List (java.util.List)4 EditPart (org.eclipse.gef.EditPart)4 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)4 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 Point (org.eclipse.draw2d.geometry.Point)2 NodeEditPart (org.eclipse.gef.NodeEditPart)2 RootEditPart (org.eclipse.gef.RootEditPart)2 ERDObject (org.jkiss.dbeaver.ext.erd.model.ERDObject)2 DBPNamedObject (org.jkiss.dbeaver.model.DBPNamedObject)2 IConnection (org.talend.core.model.process.IConnection)2 INode (org.talend.core.model.process.INode)2