@Override
  protected Object run(final Presentation context) {
    final SapphireDiagramEditorPagePart page = (SapphireDiagramEditorPagePart) getPart();

    for (ISapphirePart selectedPart : page.getSelections()) {
      if (selectedPart instanceof DiagramConnectionPart) {
        ((DiagramConnectionPart) selectedPart).removeAllBendpoints();
      }
    }

    return null;
  }
  @Override
  public boolean isEnabled() {
    final SapphireDiagramEditorPagePart page = (SapphireDiagramEditorPagePart) getPart();

    for (ISapphirePart selectedPart : page.getSelections()) {
      if (selectedPart instanceof DiagramConnectionPart) {
        if (!((DiagramConnectionPart) selectedPart).getBendpoints().isEmpty()) {
          return true;
        }
      }
    }

    return false;
  }
  private void refreshConnectionPartsListener() {
    for (DiagramConnectionPart connPart : this.selectedConnectionParts) {
      connPart.detach(this.connectionPartListener);
    }

    SapphireDiagramEditorPagePart pagePart = (SapphireDiagramEditorPagePart) getPart();
    List<DiagramConnectionPart> newSelectedParts = new ArrayList<DiagramConnectionPart>();
    for (ISapphirePart part : pagePart.getSelections()) {
      if (part instanceof DiagramConnectionPart) {
        newSelectedParts.add((DiagramConnectionPart) part);
        ((DiagramConnectionPart) part).attach(this.connectionPartListener);
      }
    }
    this.selectedConnectionParts.clear();
    this.selectedConnectionParts.addAll(newSelectedParts);
  }