protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
            {
                if (myIsSerialized)
                {
                    AttributeUtil.RemoveAttributeFromAllDeclarations(myFieldDeclaration, KnownTypes.SerializeField);
                    if (myFieldDeclaration.GetAccessRights() == AccessRights.PUBLIC)
                    {
                        AttributeUtil.AddAttributeToEntireDeclaration(myMultipleFieldDeclaration,
                                                                      PredefinedType.NONSERIALIZED_ATTRIBUTE_CLASS, EmptyArray <AttributeValue> .Instance, myModule,
                                                                      myElementFactory);
                    }
                }
                else
                {
                    if (myFieldDeclaration.IsStatic)
                    {
                        ModifiersUtil.SetStatic(myMultipleFieldDeclaration, false);
                    }
                    if (myFieldDeclaration.IsReadonly)
                    {
                        ModifiersUtil.SetReadonly(myMultipleFieldDeclaration, false);
                    }

                    AttributeUtil.RemoveAttributeFromAllDeclarations(myFieldDeclaration,
                                                                     PredefinedType.NONSERIALIZED_ATTRIBUTE_CLASS);
                    if (myFieldDeclaration.GetAccessRights() != AccessRights.PUBLIC)
                    {
                        AttributeUtil.AddAttributeToEntireDeclaration(myMultipleFieldDeclaration,
                                                                      KnownTypes.SerializeField, EmptyArray <AttributeValue> .Instance, myModule, myElementFactory);
                    }
                }

                return(null);
            }
예제 #2
0
        public UnionCasePart([NotNull] INestedTypeUnionCaseDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder)
            : base(declaration, ModifiersUtil.GetDecoration(declaration),
                   TreeNodeCollection <ITypeParameterOfTypeDeclaration> .Empty, cacheBuilder)
        {
            var unionShortName = declaration.GetContainingNode <IUnionDeclaration>()?.ShortName;

            ExtendsListShortNames =
                unionShortName != null
          ? new[] { cacheBuilder.Intern(unionShortName) }
          : EmptyArray <string> .Instance;
        }
예제 #3
0
        private void FixReferencedMemberAccess(AccessRights memberAccessRights)
        {
            var declaration =
                _highlighting.LessVisibleReferencedMember.DeclaredElement
                .GetDeclarations().FirstOrDefault();

            Contract.Assert(declaration != null);

            ModifiersUtil.SetAccessRights(
                declaration,
                memberAccessRights);
        }
예제 #4
0
        protected FSharpTypeMembersOwnerTypePart([NotNull] IFSharpTypeOldDeclaration declaration,
                                                 [NotNull] ICacheBuilder cacheBuilder)
            : base(declaration, ModifiersUtil.GetDecoration(declaration.AccessModifier, declaration.Attributes),
                   declaration.TypeParameters, cacheBuilder)
        {
            var extendListShortNames = new FrugalLocalHashSet <string>();

            extendListShortNames = ProcessMembers(declaration.TypeMembersEnumerable, extendListShortNames);

            if (declaration is IFSharpTypeDeclaration {
                TypeRepresentation : IObjectModelTypeRepresentation repr
            })
예제 #5
0
        private void FixReferencedTypeAccess(AccessRights newTypeAccess)
        {
            var declaration =
                _highlighting.LessVisibleReferencedMember.DeclaredElement
                .With(x => x.GetContainingType())
                .With(x => x.GetDeclarations().FirstOrDefault());

            Contract.Assert(declaration != null);

            ModifiersUtil.SetAccessRights(
                declaration,
                newTypeAccess);
        }
예제 #6
0
        protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            var declaration =
                _highlighting.ExceptionClass.GetDeclarations().FirstOrDefault();

            Contract.Assert(declaration != null);

            ModifiersUtil.SetAccessRights(
                declaration,
                _highlighting.PreconditionContainer.TypeAccessRights);

            return(null);
        }
        /// <summary>
        /// The execute transaction inner.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="textControl">
        /// The text control.
        /// </param>
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            IElement element = Utils.GetElementAtCaret(solution, textControl);

            IElement containingElement = (IElement)element.GetContainingElement <IFieldDeclarationNode>(true)
                                         ?? element.GetContainingElement <IMultipleDeclarationNode>(true);

            if (containingElement == null)
            {
                ITreeNode treeNode = (ITreeNode)element;

                containingElement = treeNode.PrevSibling;
            }

            ModifiersUtil.SetAccessRights(containingElement, AccessRights.PRIVATE);
        }
예제 #8
0
 public UnionCasePart([NotNull] INestedTypeUnionCaseDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder)
     : base(declaration, ModifiersUtil.GetDecoration(declaration),
            TreeNodeCollection <ITypeParameterOfTypeDeclaration> .Empty, cacheBuilder) =>
예제 #9
0
 public NestedModulePart([NotNull] INestedModuleDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder)
     : base(declaration, declaration.GetNestedModuleShortName(cacheBuilder),
            ModifiersUtil.GetDecoration(declaration.AccessModifiers, declaration.AttributesEnumerable), cacheBuilder)
 {
 }
 public override AccessRights GetAccessRights() => ModifiersUtil.GetAccessRights(AccessModifier);
예제 #11
0
 public UnionCasePart([NotNull] IUnionCaseDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder,
                      bool isHiddenCase) : base(declaration, ModifiersUtil.GetDecoration(declaration),
                                                TreeNodeCollection <ITypeParameterOfTypeDeclaration> .Empty, cacheBuilder)
 {
     myIsHiddenCase = isHiddenCase;
 }
예제 #12
0
 public HiddenTypePart([NotNull] IFSharpTypeDeclaration declaration, [NotNull] ICacheBuilder cacheBuilder)
     : base(declaration, ModifiersUtil.GetDecoration(declaration.AccessModifiers, declaration.AttributesEnumerable),
            declaration.TypeParameters, cacheBuilder)
 {
 }
예제 #13
0
 protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
 {
     ModifiersUtil.SetReadonly(myFieldDeclarations, false);
     return(null);
 }