예제 #1
0
        private void AddContractClassForInterface(IClassDeclaration classDeclaration)
        {
            Contract.Assert(_addContractForAvailability.InterfaceDeclaration.DeclaredElement != null);
            var interfaceType = TypeFactory.CreateType(_addContractForAvailability.InterfaceDeclaration.DeclaredElement);

            classDeclaration.AddSuperInterface(interfaceType, false);

            //var interfaceDeclaration = _addContractForAvailability.InterfaceDeclaration;
            //IClassMemberDeclaration previousDeclaration = null;
            //foreach (var memberDeclaration in interfaceDeclaration.ClassMemberDeclarations)
            //{

            //    classDeclaration.AddClassMemberDeclarationAfter(memberDeclaration, previousDeclaration);

            //    previousDeclaration = memberDeclaration;
            //}
        }
예제 #2
0
 public void AddSuperInterface(IDeclaredType interfaceType, bool before)
 {
     _classDeclaration.AddSuperInterface(interfaceType, before);
 }
        private void AddContractClassForInterface(IClassDeclaration classDeclaration)
        {
            Contract.Assert(_addContractForAvailability.InterfaceDeclaration.DeclaredElement != null);
            var interfaceType = TypeFactory.CreateType(_addContractForAvailability.InterfaceDeclaration.DeclaredElement);
            
            classDeclaration.AddSuperInterface(interfaceType, false);

            //var interfaceDeclaration = _addContractForAvailability.InterfaceDeclaration;
            //IClassMemberDeclaration previousDeclaration = null;
            //foreach (var memberDeclaration in interfaceDeclaration.ClassMemberDeclarations)
            //{
                
            //    classDeclaration.AddClassMemberDeclarationAfter(memberDeclaration, previousDeclaration);

            //    previousDeclaration = memberDeclaration;
            //}

        }
        /// <summary>
        /// Adds the interface.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="classDeclaration">
        /// The class declaration.
        /// </param>
        private static void AddInterface(ISolution solution, IClassDeclaration classDeclaration)
        {
            var scope = DeclarationsScopeFactory.SolutionScope(solution, true);
              var cache = PsiManager.GetInstance(solution).GetDeclarationsCache(scope, true);

              var typeElement = cache.GetTypeElementByCLRName("System.Runtime.Serialization.ISerializable");
              if (typeElement == null)
              {
            return;
              }

              var declaredType = TypeFactory.CreateType(typeElement);

              classDeclaration.AddSuperInterface(declaredType, false);
        }