public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion) { if (candidateTarget is global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.AtributoRelacion) { global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion sourceRelacion = (global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion)candidateSource; global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.AtributoRelacion targetAtributoRelacion = (global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.AtributoRelacion)candidateTarget; if (targetAtributoRelacion == null || global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.RelacionReferencesAtributoRelacion.GetLinkToRelacion(targetAtributoRelacion) != null) { return(false); } if (targetAtributoRelacion == null || sourceRelacion == null || global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.RelacionReferencesAtributoRelacion.GetLinks(sourceRelacion, targetAtributoRelacion).Count > 0) { return(false); } return(true); } } } return(false); }