예제 #1
0
        public bool IsApplicable(BaseCodeCompletionContext context)
        {
            if(!context.IsAvalilableAttributeValueCompletion)
                return false;

            return GetAppenderRef(context) != null;
        }
        public bool IsApplicable(BaseCodeCompletionContext context)
        {
            if(!context.IsAvalilableAttributeValueCompletion)
                return false;

            return true;
        }
예제 #3
0
        public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
        {
            IParameterDescriptorProvider provider = GetParameterDescriptorProvider(context);

            ICollection<IParameterDescriptor> descriptors = provider.GetParameterDescriptors();

            // it's parameters conception hak, TODO fix conception
            IXmlTag tag = context.GetAttributeTag();
            Assert.CheckNotNull(tag);

            foreach (IParameterDescriptor descriptor in descriptors)
            {
                if (!descriptor.IsAttribute)
                    continue;

                // scipr declared attribjutes
                // it's parameters conception hak, TODO fix conception
                if(tag.GetAttribute(descriptor.Name) != null)
                    continue;

                LookupItemBase item = CreateItem(descriptor, context);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
        public bool IsApplicable(BaseCodeCompletionContext context)
        {
            if(context.IsAvalilableAttributeNameCompletion)
                return false;

            throw new System.NotImplementedException();
        }
예제 #5
0
 private IParameterDescriptorProvider GetParameterDescriptorProvider(BaseCodeCompletionContext context)
 {
     ITokenNode token = context.Token;
     if (token.GetTokenType() == context.GetTokenTypes().SPACE &&
         (token.GetPrevToken().GetTokenType() == context.GetTokenTypes().TAG_START
         /*|| token.GetPrevToken().GetTokenType() == context.GetTokenTypes().IDENTIFIER*/))
         return token.Parent as IParameterDescriptorProvider;
     else
         return token.Parent.Parent as IParameterDescriptorProvider;
 }
        public override bool IsApplicable(BaseCodeCompletionContext context)
        {
            if (!context.IsAvalilableAttributeValueCompletion)
                return false;

            if (!IsAttributeOf<IDeclaredParameter>(L4NConstants.TYPE, context))
                return false;

            return true;
        }
        public bool IsApplicable(BaseCodeCompletionContext context)
        {
            if (!context.IsAvalilableAttributeNameCompletion)
                return false;

            IDeclaredParameter declaredParameter = GetDeclaredParameter(context);
            if (declaredParameter == null)
                return false;

            return true;
        }
예제 #8
0
        public override bool IsApplicable(BaseCodeCompletionContext context)
        {
            if(!context.IsAvalilableAttributeValueCompletion)
                return false;

            if(!IsAttributeOf<IAppender>(L4NConstants.TYPE, context))
                return false;

            //            TODO introduce base class for <dynamic parameter>@type parameter@type and renderer@type

            return true;
        }
        protected override ITypeElement GetBaseType(BaseCodeCompletionContext context)
        {
            IDeclaredParameter declaredParameter = GetAttributeTag<IDeclaredParameter>(context);
            Assert.CheckNotNull(declaredParameter);
            IParameterDescriptor descriptor = declaredParameter.ParameterDescriptorProvider.GetParameterDescriptor(declaredParameter.Name);

            if(descriptor.RequredType)
            {
                return ((IDeclaredType) descriptor.Type).GetTypeElement();
            }

            return null;
        }
예제 #10
0
        public bool IsApplicable(BaseCodeCompletionContext context)
        {
            if(!context.IsAvalilableAttributeNameCompletion)
                return false;

            IParameterDescriptorProvider provider = GetParameterDescriptorProvider(context);
            if(provider == null)
                return false;

            //            if(!provider.IsAvailable)
            //                return false;

            return true;
        }
예제 #11
0
        public bool IsApplicable(BaseCodeCompletionContext context)
        {
            if (!context.IsAvalilableTagCompletion)
                return false;

            IParameterDescriptorProvider parameterDescriptorProvider = GetParameterDescriptorProvider(context);

            if (parameterDescriptorProvider == null)
                return false;

            if (!parameterDescriptorProvider.IsAvailable)
                return false;

            return true;
        }
예제 #12
0
        public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
        {
            IParameterDescriptorProvider parameterDescriptorProvider = GetParameterDescriptorProvider(context);

            ICollection<IParameterDescriptor> descriptors = parameterDescriptorProvider.GetParameterDescriptors();
            foreach (IParameterDescriptor descriptor in descriptors)
            {
                if (descriptor.IsAttribute)
                    continue;

                LookupItemBase item = CreateItem(descriptor, context);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
예제 #13
0
        public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
        {
            List<ILookupItem> toRemove = new List<ILookupItem>();
            foreach (ILookupItem item in result)
            {
                DeclaredElementLookupItem declaredElementLookupItem = item as DeclaredElementLookupItem;
                if(declaredElementLookupItem == null)
                    continue;

                IDeclaredElement element = declaredElementLookupItem.PreferredDeclaredElement.Element;
                if(!(element is IClass) &&!(element is INamespace))
                    toRemove.Add(declaredElementLookupItem);
            }

            foreach (ILookupItem item in toRemove)
            {
                result.Remove(item);
            }
        }
예제 #14
0
        public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
        {
            IAppenderRef appenderRef = GetAppenderRef(context);
            Assert.CheckNotNull(appenderRef);

            IL4NSection l4nSection = appenderRef.GetContainingElement<IL4NSection>(false);
            Assert.CheckNotNull(l4nSection);

            ICollection<IAppender> appenders = l4nSection.GetAppenders();

            foreach (IAppender appender in appenders)
            {
                DeclaredElementLookupItem item =
                    new DeclaredElementLookupItem(new DeclaredElementInstance((IDeclaredElement)appender), new DeclaredElementLookupItemCreationContext(context.ProjectFile), L4NLanguageService.L4N);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
        public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
        {
            IDeclaredParameter declaredParameter = GetDeclaredParameter(context);
            Assert.CheckNotNull(declaredParameter);

            IParameterDescriptor descriptor =
                declaredParameter.ParameterDescriptorProvider.GetParameterDescriptor(declaredParameter.Name);

            LookupItemBase item = null;
            if (!descriptor.RequredType)
                item = new TextLookupItem("value");
            else
                item = new TextLookupItem("type");

            item.InsertRange = new TextRange(0);
            item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);

            result.Add(item);
        }
        public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
        {
            IXmlTag tag = context.GetAttributeTag();
            Assert.CheckNotNull(tag);
            IXmlAttribute attribute = context.Token.GetContainingElement<IXmlAttribute>(false);
            Assert.CheckNotNull(attribute);

            IParameterDescriptor descriptor = null;
            IDeclaredParameter declaredParameter = tag as IDeclaredParameter;
            if (declaredParameter != null && attribute.AttributeName == L4NConstants.VALUE)
            {
                descriptor = declaredParameter.ParameterDescriptorProvider.GetParameterDescriptor(declaredParameter.Name);
            }
            else
            {
                IParameterDescriptorProvider parameterDescriptorProvider = tag as IParameterDescriptorProvider;
                if (parameterDescriptorProvider == null)
                    return;
                descriptor = parameterDescriptorProvider.GetParameterDescriptor(attribute.AttributeName);
            }

            if(descriptor == null)
                return;

            if(!descriptor.IsEnumerable)
                return;

            string[] values = descriptor.PossibleValues;
            if(values == null)
                return;

            foreach (string v in values)
            {
                TextLookupItem item = new TextLookupItem(v);
                item.InsertRange = new TextRange(0);
                item.ReplaceRange = new TextRange(0, context.GetPrefix().Length);
                result.Add(item);
            }
        }
예제 #17
0
 private ILogger GetLogger(BaseCodeCompletionContext context)
 {
     return context.GetAttributeTag() as ILogger;
 }
예제 #18
0
 private IAppenderRef GetAppenderRef(BaseCodeCompletionContext context)
 {
     return context.Token.GetContainingElement<IXmlTag>(false) as IAppenderRef;
 }
예제 #19
0
 private IParameterDescriptorProvider GetParameterDescriptorProvider(BaseCodeCompletionContext context)
 {
     return context.GetAttributeTag() as IParameterDescriptorProvider;
 }
예제 #20
0
 public void Apply(BaseCodeCompletionContext context, IList<ILookupItem> result)
 {
     throw new System.NotImplementedException();
 }
 private IDeclaredParameter GetDeclaredParameter(BaseCodeCompletionContext context)
 {
     return context.GetAttributeTag() as IDeclaredParameter;
 }
예제 #22
0
 public bool IsApplicable(BaseCodeCompletionContext context)
 {
     throw new System.NotImplementedException();
 }
예제 #23
0
 protected override ITypeElement GetBaseType(BaseCodeCompletionContext context)
 {
     return GetTypeElement(context, L4NConstants.log4net.IAppender);
 }