/*
  * (non-Javadoc)
  *
  * @see org.eclipse.papyrus.layout.LayouttoolInterface#getSource(org.eclipse.gef.EditPart)
  */
 public EditPart getSource(EditPart element) {
   if (element.getModel() instanceof Edge) {
     Edge edge = (Edge) element.getModel();
     removeBendPoints(edge);
     AbstractConnectionEditPart acep = (AbstractConnectionEditPart) element;
     return acep.getSource();
   }
   return null;
 }
 public void deactivateFigure() {
   if (getRelation().getRelation() instanceof Changeable) {
     Changeable changeable = (Changeable) getRelation().getRelation();
     changeable.removeChangeListener(this);
   }
   super.deactivateFigure();
 }
 public void activateFigure() {
   super.activateFigure();
   if (getRelation().getRelation() instanceof Changeable) {
     Changeable changeable = (Changeable) getRelation().getRelation();
     changeable.addChangeListener(this);
   }
 }
 @Override
 public void deactivate() {
   if (isActive()) {
     ((NPNSymbolArcSN) getModel()).eAdapters().remove(adapter);
     ((NPNSymbolArcSN) getModel()).getModel().eAdapters().remove(adapter);
   }
   super.deactivate();
 }
 @Override
 public void activate() {
   if (!isActive()) {
     ((NPNSymbolArcSN) getModel()).eAdapters().add(adapter);
     ((NPNSymbolArcSN) getModel()).getModel().eAdapters().add(adapter);
   }
   super.activate();
 }
  /** @see org.eclipse.gef.EditPart#setSelected(int) */
  public void setSelected(int value) {
    super.setSelected(value);

    if (getCastedModel().getConnectionLabel() != null) {
      ConnLabelEditPart part = (ConnLabelEditPart) children.get(0);
      if (part.getSelected() != value) part.setSelected(value);
    }
  }
  /** @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals() */
  protected void refreshVisuals() {
    super.refreshVisuals();

    PolylineConnection fig = (PolylineConnection) getFigure();
    Object constraint = getCastedModel().getBendpoints();
    fig.setRoutingConstraint(constraint);

    // Effettuo il refresh della ConnectionLabel associata
    if (!getChildren().isEmpty()) {
      ConnLabelEditPart connEP = (ConnLabelEditPart) getChildren().get(0);
      connEP.refreshVisuals();
    }
  }
 /** Upon deactivation, detach from the model element as a property change listener. */
 public void deactivate() {
   if (isActive()) {
     super.deactivate();
     ((Notifier) getModel()).eAdapters().remove(modelListener);
   }
 }
 /** Upon activation, attach to the model element as a property change listener. */
 public void activate() {
   if (!isActive()) {
     super.activate();
     ((Notifier) getModel()).eAdapters().add(modelListener);
   }
 }
 public void deactivate() {
   super.deactivate();
   if (getSource() != null) {
     getSource().removeEditPartListener(this);
   }
 }
 public void activate() {
   super.activate();
   if (getSource() != null) {
     getSource().addEditPartListener(this);
   }
 }