private void RemoveExistingAttributesWithNewName(IFieldDeclaration fieldDeclaration)
        {
            var attributes = GetExistingFormerlySerializedAsAttributes(fieldDeclaration, NewName);

            foreach (var attribute in attributes)
            {
                fieldDeclaration.RemoveAttribute(attribute);
            }
        }
Esempio n. 2
0
        public static void RemoveAttributeFromSingleDeclaration([CanBeNull] IFieldDeclaration fieldDeclaration,
                                                                IClrTypeName attributeTypeName)
        {
            var attribute = GetAttribute(fieldDeclaration, attributeTypeName);

            if (attribute != null)
            {
                fieldDeclaration.RemoveAttribute(attribute);
            }
        }
Esempio n. 3
0
        public static void RemoveAttributeFromSingleDeclaration([CanBeNull] IFieldDeclaration fieldDeclaration,
                                                                IClrTypeName attributeTypeName)
        {
            var attribute = GetAttribute(fieldDeclaration, attributeTypeName);

            if (attribute != null)
            {
                // This will split a multiple declaration, if necessary
                fieldDeclaration.RemoveAttribute(attribute);
            }
        }
Esempio n. 4
0
            protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution,
                                                                           IProgressIndicator progress)
            {
                if (myExistingAttribute != null)
                {
                    myFieldDeclaration.RemoveAttribute(myExistingAttribute);
                }
                else
                {
                    AttributeUtil.AddAttributeToSingleDeclaration(myFieldDeclaration, KnownTypes.HideInInspector,
                                                                  myPsiModule, myElementFactory);
                }

                return(null);
            }
            protected override Action <ITextControl> ExecutePsiTransaction(
                ISolution solution, IProgressIndicator progress)
            {
                if (mySelectedFieldDeclaration != null)
                {
                    // This will split any multiple field declarations
                    mySelectedFieldDeclaration.RemoveAttribute(myExistingAttribute);
                }
                else
                {
                    var fieldDeclaration = (IFieldDeclaration)myMultipleFieldDeclaration.Declarators[0];
                    CSharpSharedImplUtil.RemoveAttribute(fieldDeclaration, myExistingAttribute);
                }

                return(null);
            }
Esempio n. 6
0
 public void RemoveAttribute(IAttribute attribute)
 {
     _fieldDeclaration.RemoveAttribute(attribute);
 }