Esempio n. 1
0
        /// <summary>
        /// Gets the image for the specified entity.
        /// Returns null when no image is available for the entity type.
        /// </summary>
        public static Pixbuf GetImage(IEntity entity)
        {
            CompletionImage image = getCompletionImage(entity);

            if (image != null)
            {
                return(image.getImage(entity.Accessibility, entity.IsStatic));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Public constructor.
        /// </summary>
        /// <param name="entity">The entity. Cannot be null.</param>
        public EntityCompletionData(IEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            this.entity = entity;
            IAmbience ambience = new CSharpAmbience();

            ambience.ConversionFlags = entity is ITypeDefinition ? ConversionFlags.ShowTypeParameterList : ConversionFlags.None;
            DisplayText              = entity.Name;
            CompletionText           = ambience.ConvertSymbol(entity);
            ambience.ConversionFlags = ConversionFlags.StandardConversionFlags;
            if (entity is ITypeDefinition)
            {
                // Show fully qualified Type name
                ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedTypeNames;
            }
            Image      = CompletionImage.GetImage(entity);
            Units      = entity.GetAttribute(new FullTypeName(typeof(Models.Core.UnitsAttribute).FullName))?.PositionalArguments?.First()?.ConstantValue.ToString();
            ReturnType = GetReturnType();
        }