code: /*--------------------------------------------------------------*
    Copyright (C) 2006-2015 OpenSim Ltd.
  
    This file is distributed WITHOUT ANY WARRANTY. See the file
    'License' for details on this and other legal matters.
  *--------------------------------------------------------------*/
  
  package org.omnetpp.ned.editor.graph.parts.policies;
  
  import org.eclipse.gef.commands.Command;
  import org.eclipse.gef.commands.UnexecutableCommand;
  import org.eclipse.gef.editpolicies.ConnectionEditPolicy;
  import org.eclipse.gef.requests.GroupRequest;
  import org.omnetpp.ned.editor.graph.commands.DeleteCommand;
  import org.omnetpp.ned.editor.graph.parts.EditPartUtil;
  import org.omnetpp.ned.model.INedElement;
  
  /**
   * Generally this contains only the delete command for the connections
   *
   * @author rhornig
   */
  public class NedConnectionEditPolicy extends ConnectionEditPolicy {
  
      @Override
      protected Command getDeleteCommand(GroupRequest request) {
          // do not allow delete if we are read only components
          if (!EditPartUtil.isEditable(getHost()))
              return UnexecutableCommand.INSTANCE;
  
          return new DeleteCommand((INedElement)getHost().getModel());
      }
  
  }