コード例 #1
0
 public IClass[] GetProjectContents(CodeCompletionDatabase db)
 {
     if (db != null)
         return db.GetClassList ();
     else
         return new IClass[0];
 }
コード例 #2
0
 public string[] GetNamespaceList(CodeCompletionDatabase db, string subNameSpace)
 {
     return GetNamespaceList (db, subNameSpace, true, true);
 }
コード例 #3
0
        public string[] GetNamespaceList(CodeCompletionDatabase db, string subNameSpace, bool includeReferences, bool caseSensitive)
        {
            ArrayList contents = new ArrayList ();

            if (db != null) {
                db.GetNamespaceList (contents, subNameSpace, caseSensitive);
                if (includeReferences) {
                    foreach (ReferenceEntry re in db.References) {
                        CodeCompletionDatabase cdb = GetDatabase (re.Uri);
                        if (cdb == null) continue;
                        cdb.GetNamespaceList (contents, subNameSpace, caseSensitive);
                    }
                }
            }

            if (includeReferences) {
                db = GetDatabase (CoreDB);
                db.GetNamespaceList (contents, subNameSpace, caseSensitive);
            }

            return (string[]) contents.ToArray (typeof(string));
        }
コード例 #4
0
 public IClass SearchType(CodeCompletionDatabase db, IUsing iusing, string partitialTypeName)
 {
     return SearchType (db, iusing, partitialTypeName, true);
 }
コード例 #5
0
 internal ClassInheritanceEnumerator(ParserDatabase parserDatabase, CodeCompletionDatabase db, IClass topLevelClass)
 {
     this.parserDatabase = parserDatabase;
     this.db = db;
     this.topLevelClass = topLevelClass;
     baseTypeQueue.Enqueue(topLevelClass.FullyQualifiedName);
     PutBaseClassesOnStack(topLevelClass);
     baseTypeQueue.Enqueue("System.Object");
 }
コード例 #6
0
        public bool NamespaceExists(CodeCompletionDatabase db, string name, bool caseSensitive)
        {
            if (db != null) {
                if (db.NamespaceExists (name, caseSensitive)) return true;
                foreach (ReferenceEntry re in db.References)
                {
                    CodeCompletionDatabase cdb = GetDatabase (re.Uri);
                    if (cdb == null) continue;
                    if (cdb.NamespaceExists (name, caseSensitive)) return true;
                }
            }

            db = GetDatabase (CoreDB);
            return db.NamespaceExists (name, caseSensitive);
        }
コード例 #7
0
        public string SearchNamespace(CodeCompletionDatabase db, IUsing usin, string partitialNamespaceName, bool caseSensitive)
        {
            //			Runtime.LoggingService.Info("SearchNamespace : >{0}<", partitialNamespaceName);
            if (NamespaceExists (db, partitialNamespaceName, caseSensitive)) {
                return partitialNamespaceName;
            }

            // search for partitial namespaces
            string declaringNamespace = (string)usin.Aliases[""];
            if (declaringNamespace != null) {
                while (declaringNamespace.Length > 0) {
                    if ((caseSensitive ? declaringNamespace.EndsWith(partitialNamespaceName) : declaringNamespace.ToLower().EndsWith(partitialNamespaceName.ToLower()) ) && NamespaceExists (db, declaringNamespace, caseSensitive)) {
                        return declaringNamespace;
                    }
                    int index = declaringNamespace.IndexOf('.');
                    if (index > 0) {
                        declaringNamespace = declaringNamespace.Substring(0, index);
                    } else {
                        break;
                    }
                }
            }

            // Remember:
            //     Each namespace has an own using object
            //     The namespace name is an alias which has the key ""
            foreach (DictionaryEntry entry in usin.Aliases) {
                string aliasString = entry.Key.ToString();
                if (caseSensitive ? partitialNamespaceName.StartsWith(aliasString) : partitialNamespaceName.ToLower().StartsWith(aliasString.ToLower())) {
                    if (aliasString.Length >= 0) {
                        string nsName = nsName = String.Concat(entry.Value.ToString(), partitialNamespaceName.Remove(0, aliasString.Length));
                        if (NamespaceExists (db, nsName, caseSensitive)) {
                            return nsName;
                        }
                    }
                }
            }
            return null;
        }
コード例 #8
0
        public IClass GetClass(CodeCompletionDatabase db, string typeName, bool caseSensitive)
        {
            if (db != null) {
                IClass c = db.GetClass (typeName, caseSensitive);
                if (c != null) return c;
                foreach (ReferenceEntry re in db.References)
                {
                    CodeCompletionDatabase cdb = GetDatabase (re.Uri);
                    if (cdb == null) continue;
                    c = cdb.GetClass (typeName, caseSensitive);
                    if (c != null) return c;
                }
            }

            db = GetDatabase (CoreDB);
            return db.GetClass (typeName, caseSensitive);
        }
コード例 #9
0
 public IEnumerable GetClassInheritanceTree(CodeCompletionDatabase db, IClass cls)
 {
     return new ClassInheritanceEnumerator (this, db, cls);
 }
コード例 #10
0
 public IClass GetClass(CodeCompletionDatabase db, string typeName)
 {
     return GetClass (db, typeName, false, true);
 }
コード例 #11
0
 public IClass GetClass(CodeCompletionDatabase db, string typeName, bool deepSearchReferences, bool caseSensitive)
 {
     if (deepSearchReferences)
         return DeepGetClass (db, typeName, caseSensitive);
     else
         return GetClass (db, typeName, caseSensitive);
 }
コード例 #12
0
        public IClass DeepGetClass(CodeCompletionDatabase db, string typeName, bool caseSensitive)
        {
            ArrayList visited = new ArrayList ();
            IClass c = DeepGetClassRec (visited, db, typeName, caseSensitive);
            if (c != null) return c;

            db = GetDatabase (CoreDB);
            return db.GetClass (typeName, caseSensitive);
        }
コード例 #13
0
 internal ParserContext(DefaultParserService parserService, ParserDatabase pdb, CodeCompletionDatabase db)
 {
     this.parserService = parserService;
     this.pdb = pdb;
     this.db = db;
 }
コード例 #14
0
 public CompilationUnitTypeResolver(CodeCompletionDatabase db, ICompilationUnit unit, ParserDatabase parserDatabase)
 {
     this.db = db;
     this.unit = unit;
     this.parserDatabase = parserDatabase;
 }
コード例 #15
0
        public void Initialize()
        {
            SetDefaultCompletionFileLocation();
            DeleteObsoleteDatabases ();

            string coreName = typeof(object).Assembly.GetName().ToString ();
            CoreDB = "Assembly:" + coreName;
            coreDatabase = new AssemblyCodeCompletionDatabase (codeCompletionPath, coreName, this);
            databases [CoreDB] = coreDatabase;
        }
コード例 #16
0
 public string[] GetClassList(CodeCompletionDatabase db, string subNameSpace, bool includeReferences)
 {
     return GetClassList (db, subNameSpace, includeReferences, true);
 }
コード例 #17
0
 public bool NamespaceExists(CodeCompletionDatabase db, string name)
 {
     return NamespaceExists (db, name, true);
 }
コード例 #18
0
 public IClass[] GetFileContents(CodeCompletionDatabase db, string fileName)
 {
     return db.GetFileContents (fileName);
 }
コード例 #19
0
 public string SearchNamespace(CodeCompletionDatabase db, IUsing usin, string partitialNamespaceName)
 {
     return SearchNamespace (db, usin, partitialNamespaceName, true);
 }
コード例 #20
0
 public ArrayList GetNamespaceContents(CodeCompletionDatabase db, string namspace, bool includeReferences)
 {
     return GetNamespaceContents (db, namspace, includeReferences, true);
 }
コード例 #21
0
        /// <remarks>
        /// use the usings and the name of the namespace to find a class
        /// </remarks>
        public IClass SearchType(CodeCompletionDatabase db, string name, IClass callingClass, ICompilationUnit unit)
        {
            if (name == null || name == String.Empty)
                return null;

            IClass c;
            c = GetClass (db, name);
            if (c != null)
                return c;

            if (unit != null) {
                foreach (IUsing u in unit.Usings) {
                    if (u != null) {
                        c = SearchType (db, u, name);
                        if (c != null) {
                            return c;
                        }
                    }
                }
            }
            if (callingClass == null) {
                return null;
            }
            string fullname = callingClass.FullyQualifiedName;
            string[] namespaces = fullname.Split(new char[] {'.'});
            string curnamespace = "";
            int i = 0;

            do {
                curnamespace += namespaces[i] + '.';
                c = GetClass (db, curnamespace + name);
                if (c != null) {
                    return c;
                }
                i++;
            }
            while (i < namespaces.Length);

            return null;
        }
コード例 #22
0
        public ArrayList GetNamespaceContents(CodeCompletionDatabase db, string namspace, bool includeReferences, bool caseSensitive)
        {
            ArrayList contents = new ArrayList ();

            if (db != null) {
                db.GetNamespaceContents (contents, namspace, caseSensitive);
                if (includeReferences) {
                    foreach (ReferenceEntry re in db.References)
                    {
                        CodeCompletionDatabase cdb = GetDatabase (re.Uri);
                        if (cdb == null) continue;
                        cdb.GetNamespaceContents (contents, namspace, caseSensitive);
                    }
                }
            }

            if (includeReferences) {
                db = GetDatabase (CoreDB);
                db.GetNamespaceContents (contents, namspace, caseSensitive);
            }

            return contents;
        }
コード例 #23
0
        public IClass SearchType(CodeCompletionDatabase db, IUsing iusing, string partitialTypeName, bool caseSensitive)
        {
            //			Runtime.LoggingService.Info("Search type : >{0}<", partitialTypeName);
            IClass c = GetClass (db, partitialTypeName, caseSensitive);
            if (c != null) {
                return c;
            }

            foreach (string str in iusing.Usings) {
                string possibleType = String.Concat(str, ".", partitialTypeName);
            //				Runtime.LoggingService.Info("looking for " + possibleType);
                c = GetClass (db, possibleType, caseSensitive);
                if (c != null) {
            //					Runtime.LoggingService.Info("Found!");
                    return c;
                }
            }

            // search class in partitial namespaces
            string declaringNamespace = (string)iusing.Aliases[""];
            if (declaringNamespace != null) {
                while (declaringNamespace.Length > 0) {
                    string className = String.Concat(declaringNamespace, ".", partitialTypeName);
            //					Runtime.LoggingService.Info("looking for " + className);
                    c = GetClass (db, className, caseSensitive);
                    if (c != null) {
            //						Runtime.LoggingService.Info("Found!");
                        return c;
                    }
                    int index = declaringNamespace.IndexOf('.');
                    if (index > 0) {
                        declaringNamespace = declaringNamespace.Substring(0, index);
                    } else {
                        break;
                    }
                }
            }

            foreach (DictionaryEntry entry in iusing.Aliases) {
                string aliasString = entry.Key.ToString();
                if (caseSensitive ? partitialTypeName.StartsWith(aliasString) : partitialTypeName.ToLower().StartsWith(aliasString.ToLower())) {
                    string className = null;
                    if (aliasString.Length > 0) {
                        className = String.Concat(entry.Value.ToString(), partitialTypeName.Remove(0, aliasString.Length));
            //						Runtime.LoggingService.Info("looking for " + className);
                        c = GetClass (db, className, caseSensitive);
                        if (c != null) {
            //							Runtime.LoggingService.Info("Found!");
                            return c;
                        }
                    }
                }
            }

            return null;
        }
コード例 #24
0
        internal IClass DeepGetClassRec(ArrayList visitedDbs, CodeCompletionDatabase db, string typeName, bool caseSensitive)
        {
            if (db == null) return null;
            if (visitedDbs.Contains (db)) return null;

            visitedDbs.Add (db);

            IClass c = db.GetClass (typeName, caseSensitive);
            if (c != null) return c;

            foreach (ReferenceEntry re in db.References)
            {
                CodeCompletionDatabase cdb = GetDatabase (re.Uri);
                if (cdb == null) continue;
                c = DeepGetClassRec (visitedDbs, cdb, typeName, caseSensitive);
                if (c != null) return c;
            }
            return null;
        }