Exemplo n.º 1
0
        protected override void LoadNewDeclarationBlocks()
        {
            if (_stateUDTField.IsExistingDeclaration)
            {
                return;
            }

            _stateUDTField.AddMembers(SelectedFields.Cast <IConvertToUDTMember>());

            AddContentBlock(NewContentTypes.TypeDeclarationBlock, _stateUDTField.TypeDeclarationBlock(_indenter));

            AddContentBlock(NewContentTypes.DeclarationBlock, _stateUDTField.FieldDeclarationBlock);
            return;
        }
Exemplo n.º 2
0
        protected override void ModifyFields(IRewriteSession refactorRewriteSession)
        {
            var rewriter = refactorRewriteSession.CheckOutModuleRewriter(_targetQMN);

            rewriter.RemoveVariables(SelectedFields.Select(f => f.Declaration)
                                     .Cast <VariableDeclaration>());

            if (_stateUDTField.IsExistingDeclaration)
            {
                _stateUDTField.AddMembers(SelectedFields.Cast <IConvertToUDTMember>());

                rewriter.Replace(_stateUDTField.AsTypeDeclaration, _stateUDTField.TypeDeclarationBlock(_indenter));
            }
        }