Search in sources :

Example 1 with TraceConnectionsManager

use of org.talend.designer.runprocess.trace.TraceConnectionsManager in project tdi-studio-se by Talend.

the class ClearTraceAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    //
    final TraceConnectionsManager traceConnectionsManager = new TraceConnectionsManager(process);
    traceConnectionsManager.init();
    Set<IConnection> doneConnections = new HashSet<IConnection>();
    IConnection connection = null;
    for (Iterator<? extends INode> i = process.getGraphicalNodes().iterator(); connection == null && i.hasNext(); ) {
        INode psNode = i.next();
        if (psNode instanceof Node) {
            Node node = (Node) psNode;
            //$NON-NLS-1$
            node.getNodeProgressBar().updateState("UPDATE_STATUS", new Double(0));
            node.setErrorFlag(false);
            node.setCompareFlag(false);
            node.setErrorInfo(null);
            //$NON-NLS-1$
            node.getNodeError().updateState("UPDATE_STATUS", false);
            //$NON-NLS-1$
            node.setErrorInfoChange("ERRORINFO", false);
        }
        for (IConnection connec : psNode.getOutgoingConnections()) {
            if (!doneConnections.contains(connec)) {
                connec.setTraceData(null);
                doneConnections.add(connec);
            }
            // get the related shadow connections
            IConnection[] shadowconns = traceConnectionsManager.getShadowConnenctions(connec.getUniqueName());
            if (shadowconns != null) {
                for (IConnection sc : shadowconns) {
                    if (!doneConnections.contains(sc)) {
                        sc.setTraceData(null);
                        doneConnections.add(sc);
                    }
                }
            }
        }
        // currently, only for joblet when expanded.
        IConnection[] nonShadowDataConnections = traceConnectionsManager.getNonShadowDataConnections(psNode);
        if (nonShadowDataConnections != null) {
            for (IConnection conn : nonShadowDataConnections) {
                if (!doneConnections.contains(conn)) {
                    conn.setTraceData(null);
                    doneConnections.add(conn);
                }
            }
        }
    }
}
Also used : INode(org.talend.core.model.process.INode) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) IConnection(org.talend.core.model.process.IConnection) TraceConnectionsManager(org.talend.designer.runprocess.trace.TraceConnectionsManager) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 IConnection (org.talend.core.model.process.IConnection)1 INode (org.talend.core.model.process.INode)1 Node (org.talend.designer.core.ui.editor.nodes.Node)1 TraceConnectionsManager (org.talend.designer.runprocess.trace.TraceConnectionsManager)1