@Override
    public void mousePressed(MouseEvent me) {
      if (me.getSource() instanceof ExpandCollapseFigure) {
        ExpandCollapseFigure ecFigure = (ExpandCollapseFigure) me.getSource();
        EntitySelectManager manager = EntitySelectManager.getManager();
        if (ecFigure.getParent().getParent() instanceof TableEntityElement) {
          TableEntityElement rowFigure = (TableEntityElement) ecFigure.getParent().getParent();
          manager.setSelection(rowFigure); // select first
          TableTreeEntityFigure treeNodeFigure = ecFigure.getParent().getEntityFigure();
          if (treeNodeFigure != null) {
            expanded = treeNodeFigure.isExpanded();
            treeNodeFigure.doExpandCollapse();
          }
        }
      }

      MapperTablePart tablePart = MapperUtils.getMapperTablePart((TableEntityPart) getHost());
      if (tablePart instanceof OutputTablePart) {
        TableEntityPart host = (TableEntityPart) getHost();
        host.refreshChildrenTargetConnections(host, expanded);
      } else if (getHost() instanceof InputTablePart) {
        TableEntityPart host = (TableEntityPart) getHost();
        host.refreshChildrenSourceConnections(host, expanded);
      }
    }
 @Override
 public void deactivate() {
   TableEntityPart host = (TableEntityPart) getHost();
   if (host.getFigure() instanceof TableTreeEntityFigure) {
     TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
     if (treeNodeFigure.getTreeBranch() != null) {
       ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
       if (ecFigure != null) {
         ecFigure.removeMouseListener(l);
       }
     }
   }
   super.deactivate();
 }