示例#1
0
 public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     string namespaceName = document.GetField(SandoField.Namespace.ToString()).StringValue();
     AccessLevel accessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
     string body = "not stored in index";//document.GetField(SandoField.Body.ToString()).StringValue();
     if(name == String.Empty) name = ProgramElement.UndefinedName;
     return new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, accessLevel, namespaceName, body };
 }
 public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     AccessLevel accessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
     string arguments = document.GetField(SandoField.Arguments.ToString()).StringValue();
     string returnType = document.GetField(SandoField.ReturnType.ToString()).StringValue();
     bool isConstructor = bool.Parse(document.GetField(SandoField.IsConstructor.ToString()).StringValue());
     return new object[] { name, definitionLineNumber, definitionColumnNumber, returnType, accessLevel, arguments, fullFilePath, snippet, isConstructor };
 }
        public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
        {
            AccessLevel accessLevel   = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
            string      arguments     = document.GetField(SandoField.Arguments.ToString()).StringValue().ToSandoDisplayable();
            string      returnType    = document.GetField(SandoField.ReturnType.ToString()).StringValue().ToSandoDisplayable();
            bool        isConstructor = bool.Parse(document.GetField(SandoField.IsConstructor.ToString()).StringValue().ToSandoDisplayable());

            return(new object[] { name, definitionLineNumber, definitionColumnNumber, returnType, accessLevel, arguments, fullFilePath, snippet, isConstructor });
        }
示例#4
0
 public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     string namespaceName = document.GetField(SandoField.Namespace.ToString()).StringValue();
     AccessLevel accessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
     string extendedClasses = document.GetField(SandoField.ExtendedClasses.ToString()).StringValue();
     string implementedInterfaces = document.GetField(SandoField.ImplementedInterfaces.ToString()).StringValue();
     string modifiers = document.GetField(SandoField.Modifiers.ToString()).StringValue();
     return new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, accessLevel, namespaceName, extendedClasses, implementedInterfaces, modifiers, "" };
 }
        public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
        {
            string      namespaceName   = document.GetField(SandoField.Namespace.ToString()).StringValue().ToSandoDisplayable();
            AccessLevel accessLevel     = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
            string      body            = "not stored in index";//document.GetField(SandoField.Body.ToString()).StringValue().ToSandoDisplayable();
            string      extendedClasses = document.GetField(SandoField.ExtendedClasses.ToString()).StringValue().ToSandoDisplayable();
            string      modifiers       = document.GetField(SandoField.Modifiers.ToString()).StringValue();

            return(new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, accessLevel, namespaceName, body, extendedClasses, modifiers });
        }
示例#6
0
 public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     AccessLevel accessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
     string propertyType = document.GetField(SandoField.DataType.ToString()).StringValue();
     string body = "not stored in index";//document.GetField(SandoField.Body.ToString()).StringValue();
     Guid classId = new Guid(document.GetField(SandoField.ClassId.ToString()).StringValue());
     string className = document.GetField(SandoField.ClassName.ToString()).StringValue();
     string modifiers = document.GetField(SandoField.Modifiers.ToString()).StringValue();
     return new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, accessLevel, propertyType, body, classId, className, modifiers };
 }
        public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
        {
            AccessLevel accessLevel  = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
            string      fieldType    = document.GetField(SandoField.DataType.ToString()).StringValue().ToSandoDisplayable();
            Guid        classId      = new Guid(document.GetField(SandoField.ClassId.ToString()).StringValue());
            string      className    = document.GetField(SandoField.ClassName.ToString()).StringValue().ToSandoDisplayable();
            string      modifiers    = document.GetField(SandoField.Modifiers.ToString()).StringValue();
            string      initialValue = document.GetField(SandoField.InitialValue.ToString()).StringValue().ToSandoDisplayable();

            return(new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, accessLevel, fieldType, classId, className, modifiers, initialValue });
        }
示例#8
0
        public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
        {
            AccessLevel accessLevel   = (AccessLevel)Enum.Parse(typeof(AccessLevel), document.GetField(SandoField.AccessLevel.ToString()).StringValue(), true);
            string      arguments     = document.GetField(SandoField.Arguments.ToString()).StringValue().ToSandoDisplayable();
            string      returnType    = document.GetField(SandoField.ReturnType.ToString()).StringValue().ToSandoDisplayable();
            string      body          = "not stored in index";//document.GetField(SandoField.Body.ToString()).StringValue();
            Guid        classId       = new Guid(document.GetField(SandoField.ClassId.ToString()).StringValue());
            string      className     = document.GetField(SandoField.ClassName.ToString()).StringValue().ToSandoDisplayable();
            string      modifiers     = document.GetField(SandoField.Modifiers.ToString()).StringValue();
            bool        isConstructor = bool.Parse(document.GetField(SandoField.IsConstructor.ToString()).StringValue());

            return(new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, accessLevel, arguments, returnType, body, classId, className, modifiers, isConstructor });
        }
        private static SandoDocument GetSandoDocument(Document document)
        {
            ProgramElementType programElementType = (ProgramElementType)Enum.Parse(typeof(ProgramElementType), document.GetField(SandoField.ProgramElementType.ToString()).StringValue(), true);

            switch (programElementType)
            {
            case ProgramElementType.Class:
                return(new ClassDocument(document));

            case ProgramElementType.Comment:
                return(new CommentDocument(document));

            case ProgramElementType.Enum:
                return(new EnumDocument(document));

            case ProgramElementType.Field:
                return(new FieldDocument(document));

            case ProgramElementType.Method:
                return(new MethodDocument(document));

            case ProgramElementType.Property:
                return(new PropertyDocument(document));

            case ProgramElementType.MethodPrototype:
                return(new MethodPrototypeDocument(document));

            case ProgramElementType.Struct:
                return(new StructDocument(document));

            case ProgramElementType.TextLine:
                return(new TextLineDocument(document));

            case ProgramElementType.XmlElement:
                return(new XmlXElementDocument(document));

            case ProgramElementType.Custom:
                var type = GetMyType(document);
                if (type.BaseType.Equals(typeof(MethodElement)))
                {
                    return(new MethodDocument(document));
                }
                return(new SandoDocument(document));

            default:
                return(null);
            }
        }
示例#10
0
 internal void AddProgramElementTypes(List <string> list)
 {
     foreach (var elementType in list)
     {
         try
         {
             ProgramElementType value = (ProgramElementType)Enum.Parse(typeof(ProgramElementType), elementType);
             if (value != null)
             {
                 ProgramElementTypes.Add(value);
             }
         }
         catch (ArgumentException)
         {
             //ignore invalid values
         }
     }
 }
        public ProgramElement Convert()
        {
            Contract.Ensures(Contract.Result <ProgramElement>() != null, "ConverterFromHitToProgramElement:ReadProgramElementFromDocument - an object must be returned from this method!");

            //Get standard field values
            string             name         = luceneDocument.GetField(SandoField.Name.ToString()).StringValue().ToSandoDisplayable();
            ProgramElementType type         = (ProgramElementType)Enum.Parse(typeof(ProgramElementType), luceneDocument.GetField(SandoField.ProgramElementType.ToString()).StringValue(), true);
            string             fullFilePath = luceneDocument.GetField(SandoField.FullFilePath.ToString()).StringValue();
            int    definitionLineNumber     = int.Parse(luceneDocument.GetField(SandoField.DefinitionLineNumber.ToString()).StringValue());
            int    definitionColumnNumber   = int.Parse(luceneDocument.GetField(SandoField.DefinitionColumnNumber.ToString()).StringValue());
            string snippet = luceneDocument.GetField(SandoField.Source.ToString()).StringValue();

            //Add values that vary according to element type (e.g., a textline doesn't have a parent class whereas a method often does)
            //Note: Parameters must match the parameter list for corresponding program element.  See MethodDocument.GetParametersForConstructor and the MethodElement constructor
            var parameters = sandoDocument.GetParametersForConstructor(name, type, fullFilePath, definitionLineNumber, definitionColumnNumber, snippet, luceneDocument);

            //Create type from the collected values
            var myClassType = GetMyType(luceneDocument);
            var myElement   = Activator.CreateInstance(myClassType, parameters);

            //Populate any custom fields from user-defined types, only happens when a third party extends Sando
            SetCustomFields(myElement, luceneDocument);
            return(myElement as ProgramElement);
        }
示例#12
0
 public ProgramElementWrapper(bool isChecked, ProgramElementType programElementType)
 {
     Checked        = isChecked;
     ProgramElement = programElementType;
 }
 public virtual string GetName()
 {
     return(ProgramElementType.ToString());
 }
 public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath,
     int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     return new object[] {name, String.Empty, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet};
 }
 public ProgramElementWrapper(bool isChecked, ProgramElementType programElementType)
 {
     Checked = isChecked;
     ProgramElement = programElementType;
 }
示例#16
0
        public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
        {
            string body = "not stored in index";        //document.GetField(SandoField.Body.ToString()).StringValue();

            return(new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, body });
        }
 public SearchResultType(ProgramElementType type)
 {
     this.TypeName = type;
     this.IsChecked = true;
 }
 public void AddSearchResultType(ProgramElementType type, PropertyChangedEventHandler propertyChangedHandler)
 {
     if (!this._types.Contains(type))
     {
         var searchResultType = new SearchResultType(type);
         searchResultType.PropertyChanged += propertyChangedHandler;
         this.SearchResultTypes.Add(searchResultType);
         this._types.Add(type);
     }
 }
示例#19
0
 public virtual object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     return(new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet });
 }
示例#20
0
 public override object[] GetParametersForConstructor(string name, ProgramElementType programElementType, string fullFilePath, int definitionLineNumber, int definitionColumnNumber, string snippet, Document document)
 {
     string body = "not stored in index";//document.GetField(SandoField.Body.ToString()).StringValue();
     return new object[] { name, definitionLineNumber, definitionColumnNumber, fullFilePath, snippet, body };
 }