Search in sources :

Example 11 with NodeContainerPart

use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.

the class ComponentChooseDialog method createQuery.

private void createQuery(Object dragModel, EditPart targetEditPart) {
    if (!(dragModel instanceof RepositoryNode && targetEditPart instanceof NodeContainerPart)) {
        return;
    }
    RepositoryNode dragNode = (RepositoryNode) dragModel;
    NodeContainerPart nodePart = (NodeContainerPart) targetEditPart;
    if (dragNode.getObject().getProperty().getItem() instanceof ConnectionItem) {
        ConnectionItem connectionItem = (ConnectionItem) dragNode.getObject().getProperty().getItem();
        Command command = getChangeQueryCommand(dragNode, (Node) nodePart.getNodePart().getModel(), connectionItem);
        if (command != null) {
            execCommandStack(command);
        }
    }
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) ConnectionCreateCommand(org.talend.designer.core.ui.editor.cmd.ConnectionCreateCommand) RepositoryChangeMetadataForSAPCommand(org.talend.core.ui.metadata.command.RepositoryChangeMetadataForSAPCommand) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) CreateNodeContainerCommand(org.talend.designer.core.ui.editor.cmd.CreateNodeContainerCommand) RepositoryChangeQueryCommand(org.talend.designer.core.ui.editor.cmd.RepositoryChangeQueryCommand) ConnectionReconnectCommand(org.talend.designer.core.ui.editor.cmd.ConnectionReconnectCommand) RepositoryChangeMetadataCommand(org.talend.designer.core.ui.editor.cmd.RepositoryChangeMetadataCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) Command(org.eclipse.gef.commands.Command) RepositoryChangeMetadataForEBCDICCommand(org.talend.core.ui.metadata.command.RepositoryChangeMetadataForEBCDICCommand) QueryGuessCommand(org.talend.designer.core.ui.editor.cmd.QueryGuessCommand) RepositoryChangeMetadataForHL7Command(org.talend.core.ui.metadata.command.RepositoryChangeMetadataForHL7Command) ValidationRulesConnectionItem(org.talend.core.model.properties.ValidationRulesConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) MDMConnectionItem(org.talend.core.model.properties.MDMConnectionItem) SAPConnectionItem(org.talend.core.model.properties.SAPConnectionItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) EbcdicConnectionItem(org.talend.core.model.properties.EbcdicConnectionItem) HL7ConnectionItem(org.talend.core.model.properties.HL7ConnectionItem) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 12 with NodeContainerPart

use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.

the class CreateComponentOnLinkHelper method unselectAllConnections.

public static void unselectAllConnections(SubjobContainerPart containerPart) {
    List children = containerPart.getChildren();
    for (int i = 0; i < children.size(); i++) {
        Object object = children.get(i);
        if (object instanceof NodeContainerPart) {
            NodeContainerPart nodeContainerPart = (NodeContainerPart) object;
            Object nodePart = nodeContainerPart.getChildren().get(0);
            if (nodePart instanceof NodePart) {
                List sourceConnections = ((NodePart) nodePart).getSourceConnections();
                for (int j = 0; j < sourceConnections.size(); j++) {
                    Object connectionPart = sourceConnections.get(j);
                    if (connectionPart instanceof ConnectionPart) {
                        ConnectionPart connPart = (ConnectionPart) connectionPart;
                        org.talend.designer.core.ui.editor.connections.Connection conn = (org.talend.designer.core.ui.editor.connections.Connection) connPart.getModel();
                        ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
                        if (fig.getLineWidth() != 1) {
                            fig.setLineWidth(1);
                            connPart.refresh();
                        }
                    }
                }
            }
        }
    }
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure) IConnection(org.talend.core.model.process.IConnection) PolylineConnection(org.eclipse.draw2d.PolylineConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) Point(org.eclipse.draw2d.geometry.Point) Connection(org.talend.designer.core.ui.editor.connections.Connection) ArrayList(java.util.ArrayList) PointList(org.eclipse.draw2d.geometry.PointList) List(java.util.List) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 13 with NodeContainerPart

use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.

the class CreateComponentOnLinkHelper method getConnectionParts.

public static List<ConnectionPart> getConnectionParts(ProcessPart processPart, Point point, Node node) {
    List<ConnectionPart> connectionParts = new ArrayList<ConnectionPart>();
    for (Object child : processPart.getChildren()) {
        if (child instanceof SubjobContainerPart) {
            SubjobContainerPart subJobPart = (SubjobContainerPart) child;
            for (Object sChilde : subJobPart.getChildren()) {
                if (sChilde instanceof NodeContainerPart) {
                    NodeContainerPart nodeCPart = (NodeContainerPart) sChilde;
                    for (Object nChild : nodeCPart.getChildren()) {
                        if (nChild instanceof NodePart) {
                            for (Object conn : ((NodePart) nChild).getTargetConnections()) {
                                if (conn instanceof ConnectionPart && canCreateNodeOnLink((Connection) ((ConnectionPart) conn).getModel(), node)) {
                                    ConnectionPart connPart = (ConnectionPart) conn;
                                    // if (connPart.getFigure() != null &&
                                    // connPart.getFigure().getBounds().contains(point)) {
                                    connectionParts.add((ConnectionPart) conn);
                                // }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return connectionParts;
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) PolylineConnection(org.eclipse.draw2d.PolylineConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 14 with NodeContainerPart

use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.

the class CreateComponentOnLinkHelper method selectConnection.

public static void selectConnection(Connection connection, SubjobContainerPart containerPart) {
    List children = containerPart.getChildren();
    for (int i = 0; i < children.size(); i++) {
        Object object = children.get(i);
        if (object instanceof NodeContainerPart) {
            NodeContainerPart nodeContainerPart = (NodeContainerPart) object;
            Object nodePart = nodeContainerPart.getChildren().get(0);
            if (nodePart instanceof NodePart) {
                List sourceConnections = ((NodePart) nodePart).getSourceConnections();
                for (int j = 0; j < sourceConnections.size(); j++) {
                    Object connectionPart = sourceConnections.get(j);
                    if (connectionPart instanceof ConnectionPart) {
                        ConnectionPart connPart = (ConnectionPart) connectionPart;
                        org.talend.designer.core.ui.editor.connections.Connection conn = (org.talend.designer.core.ui.editor.connections.Connection) connPart.getModel();
                        if (conn.equals(connection)) {
                            ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
                            if (fig.getLineWidth() != 2) {
                                fig.setLineWidth(2);
                                connPart.refresh();
                            }
                        } else {
                            ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
                            if (fig.getLineWidth() != 1) {
                                fig.setLineWidth(1);
                                connPart.refresh();
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure) IConnection(org.talend.core.model.process.IConnection) PolylineConnection(org.eclipse.draw2d.PolylineConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) Point(org.eclipse.draw2d.geometry.Point) Connection(org.talend.designer.core.ui.editor.connections.Connection) ArrayList(java.util.ArrayList) PointList(org.eclipse.draw2d.geometry.PointList) List(java.util.List) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 15 with NodeContainerPart

use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tesb-studio-se by Talend.

the class CamelEditorDropTargetListener method handleDrop.

@Override
protected void handleDrop() {
    if (!checkSelectionSource()) {
        return;
    }
    updateTargetRequest();
    updateTargetEditPart();
    if (selectSourceList.get(0) instanceof PaletteEditPart && getTargetRequest() instanceof CreateRequest) {
        if (getTargetEditPart() instanceof ProcessPart) {
            Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
            if (newObject != null) {
                Command command = getCommand();
                if (command != null) {
                    execCommandStack(command);
                }
            }
        }
        return;
    }
    if (isContextSource) {
        createContext();
    } else {
        if (!(getTargetEditPart() instanceof NodeContainerPart)) {
            try {
                createNewComponent(getCurrentEvent());
            } catch (OperationCanceledException e) {
                return;
            }
        }
    }
    // in case after drag/drop the editor is dirty but can not get focus
    if (editor.isDirty()) {
        editor.setFocus();
    }
    this.eraseTargetFeedback();
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) CreateNodeContainerCommand(org.talend.designer.core.ui.editor.cmd.CreateNodeContainerCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) CreateRequest(org.eclipse.gef.requests.CreateRequest) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) PaletteEditPart(org.eclipse.gef.ui.palette.editparts.PaletteEditPart)

Aggregations

NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)27 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)17 List (java.util.List)15 ArrayList (java.util.ArrayList)14 SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)14 Node (org.talend.designer.core.ui.editor.nodes.Node)13 EditPart (org.eclipse.gef.EditPart)11 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)9 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)8 ConnectionPart (org.talend.designer.core.ui.editor.connections.ConnectionPart)8 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)8 INode (org.talend.core.model.process.INode)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 NoteEditPart (org.talend.designer.core.ui.editor.notes.NoteEditPart)7 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 RepositoryNode (org.talend.repository.model.RepositoryNode)7 Command (org.eclipse.gef.commands.Command)6 IExternalNode (org.talend.core.model.process.IExternalNode)6 PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)6 Connection (org.talend.designer.core.ui.editor.connections.Connection)6