WorkflowCell source = (WorkflowCell)((WorkflowPort)firstPort.getCell()).getParent(); WorkflowCell target = (WorkflowCell)((WorkflowPort)port.getCell()).getParent();
WorkflowPort sourcePort = (WorkflowPort)firstPort.getCell(); WorkflowCell source = (WorkflowCell)sourcePort.getParent(); WorkflowPort targetPort = (WorkflowPort)port.getCell(); WorkflowCell target = (WorkflowCell)targetPort.getParent(); source.setSelectedPort(source.getIndex(sourcePort)); target.setSelectedPort(target.getIndex(targetPort));
  public void mouseReleased(MouseEvent e)  {    // If Valid Event, Current and First Port    // first connect first is OK    if(e != null && !e.isConsumed() && port != null && firstPort != null && readyToConnect)    {      readyToConnect = false;      // Then Establish Connection      WorkflowCell source = (WorkflowCell)((WorkflowPort)firstPort.getCell()).getParent();      WorkflowCell target = (WorkflowCell)((WorkflowPort)port.getCell()).getParent();      //      System.out.println("connect " + source + "->" + target);      ConnectHelper.connect(source, target, (WorkflowGraphModel)graph.getModel());      //		System.out.println("connectable "+ ConnectHelper.connect(source, target, (WorkflowGraphModel)graph.getModel()));      //				connect((Port) firstPort.getCell(), (Port) port.getCell());      // Consume Event      e.consume();    }    graph.repaint();    // Reset Global Vars    firstPort = port = null;    start = current = null;    // Call Superclass    super.mouseReleased(e);  }