コード例 #1
0
        public override bool IsAvailable(IUserDataHolder cache)
        {
            if (_range == null || !ValidUtils.Valid(_range.First) || !ValidUtils.Valid(_range.Last))
            {
                return(false);
            }
            var treeRange = AdjustTreeRange(_range);

            if (treeRange != null)
            {
                return(treeRange.First.Parent == treeRange.Last.Parent);
            }
            return(false);
        }
        protected override ICreationTarget GetTarget()
        {
            if (!ValidUtils.Valid(Reference))
            {
                return(null);
            }

            var node   = Reference.GetTreeNode();
            var @class = node.GetContainingNode <IClassLikeDeclaration>()?.DeclaredElement;

            if (@class == null)
            {
                return(null);
            }

            return(new TypeTarget(@class, node));
        }
コード例 #3
0
        public IEnumerable <IntentionAction> CreateBulbItems()
        {
            var api             = myAttribute.GetSolution().GetComponent <UnityApi>();
            var typeDeclaration = myAttribute.GetContainingTypeDeclaration();
            var field           = myAttribute.GetFieldsByAttribute().FirstOrDefault();

            if (field == null)
            {
                return(EmptyList <IntentionAction> .Enumerable);
            }

            if (ValidUtils.Valid(typeDeclaration) &&
                typeDeclaration.DeclaredName != SharedImplUtil.MISSING_DECLARATION_NAME &&
                !api.IsUnityType(typeDeclaration.DeclaredElement) &&
                CouldBeSerializedField(field))
            {
                return(new MakeSerializable(typeDeclaration).ToQuickFixIntentions());
            }

            return(EmptyList <IntentionAction> .Enumerable);
        }
コード例 #4
0
 public override bool IsAvailable(IUserDataHolder cache)
 {
     return(ValidUtils.Valid(myMethodDeclaration));
 }
 public override bool IsAvailable(IUserDataHolder cache) => ValidUtils.Valid(myWarningCreationExpression);
コード例 #6
0
 public override bool IsAvailable(IUserDataHolder cache)
 {
     return(ValidUtils.Valid(myExpression));
 }
 public override bool IsAvailable(IUserDataHolder cache) => ValidUtils.Valid(myLiteral);
コード例 #8
0
 public override bool IsAvailable(IUserDataHolder cache)
 {
     return(ValidUtils.Valid(myInvocationExpression) && (IsExpressionStatement() || IsInvocationInitializer()) &&
            !myExpression.ContainsPreprocessorDirectives());
 }
コード例 #9
0
 public bool IsAvailable(IUserDataHolder cache) => ValidUtils.Valid(myAttribute);
コード例 #10
0
 public override bool IsAvailable(IUserDataHolder cache)
 {
     return(myIsValid && ValidUtils.Valid(myLiteral));
 }
コード例 #11
0
 public override bool IsAvailable(IUserDataHolder cache)
 {
     return(myNewArgument != null && ValidUtils.Valid(myInvocation) && ValidUtils.Valid(myNewArgument));
 }
コード例 #12
0
        public override bool IsAvailable(IUserDataHolder cache)
        {
            var treeNode = TryGetContextTreeNode();

            return(treeNode != null?ValidUtils.Valid(treeNode) : base.IsAvailable(cache));
        }
コード例 #13
0
 public override bool IsAvailable(IUserDataHolder cache) =>
 myNewArgument != null && base.IsAvailable(cache) && ValidUtils.Valid(myNewArgument);
コード例 #14
0
 public bool IsAvailable(IUserDataHolder cache) => ValidUtils.Valid(myMethodDeclaration);