コード例 #1
0
        /// <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)
        {
            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            ITreeNode containingElement = element.GetContainingNode <IFieldDeclaration>(true)
                                          ?? element.GetContainingNode <IMultipleDeclaration>(true) ?? element.PrevSibling;

            ModifiersUtil.SetAccessRights(containingElement, AccessRights.PRIVATE);
        }
コード例 #2
0
        private void FixReferencedMemberAccess(AccessRights memberAccessRights)
        {
            var declaration =
                _highlighting.LessVisibleReferencedMember.DeclaredElement
                .GetDeclarations().FirstOrDefault();

            Contract.Assert(declaration != null);

            ModifiersUtil.SetAccessRights(
                declaration,
                memberAccessRights);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
        protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            if (_changeVisibility)
            {
                Contract.Assert(_highlighing.ReferingFieldOrProperty != null);
                ModifiersUtil.SetAccessRights(_highlighing.ReferingFieldOrProperty, AccessRights.PUBLIC);
            }

            if (_generateProperty)
            {
                Contract.Assert(_highlighing.ReferingFieldOrProperty == null);
                GenerateRefereingProperty();
            }
            return(null);
        }
コード例 #6
0
        /// <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);
        }