public IClass[] GetProjectContents(CodeCompletionDatabase db) { if (db != null) return db.GetClassList (); else return new IClass[0]; }
public string[] GetNamespaceList(CodeCompletionDatabase db, string subNameSpace) { return GetNamespaceList (db, subNameSpace, true, true); }
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)); }
public IClass SearchType(CodeCompletionDatabase db, IUsing iusing, string partitialTypeName) { return SearchType (db, iusing, partitialTypeName, true); }
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"); }
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); }
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; }
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); }
public IEnumerable GetClassInheritanceTree(CodeCompletionDatabase db, IClass cls) { return new ClassInheritanceEnumerator (this, db, cls); }
public IClass GetClass(CodeCompletionDatabase db, string typeName) { return GetClass (db, typeName, false, true); }
public IClass GetClass(CodeCompletionDatabase db, string typeName, bool deepSearchReferences, bool caseSensitive) { if (deepSearchReferences) return DeepGetClass (db, typeName, caseSensitive); else return GetClass (db, typeName, caseSensitive); }
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); }
internal ParserContext(DefaultParserService parserService, ParserDatabase pdb, CodeCompletionDatabase db) { this.parserService = parserService; this.pdb = pdb; this.db = db; }
public CompilationUnitTypeResolver(CodeCompletionDatabase db, ICompilationUnit unit, ParserDatabase parserDatabase) { this.db = db; this.unit = unit; this.parserDatabase = parserDatabase; }
public void Initialize() { SetDefaultCompletionFileLocation(); DeleteObsoleteDatabases (); string coreName = typeof(object).Assembly.GetName().ToString (); CoreDB = "Assembly:" + coreName; coreDatabase = new AssemblyCodeCompletionDatabase (codeCompletionPath, coreName, this); databases [CoreDB] = coreDatabase; }
public string[] GetClassList(CodeCompletionDatabase db, string subNameSpace, bool includeReferences) { return GetClassList (db, subNameSpace, includeReferences, true); }
public bool NamespaceExists(CodeCompletionDatabase db, string name) { return NamespaceExists (db, name, true); }
public IClass[] GetFileContents(CodeCompletionDatabase db, string fileName) { return db.GetFileContents (fileName); }
public string SearchNamespace(CodeCompletionDatabase db, IUsing usin, string partitialNamespaceName) { return SearchNamespace (db, usin, partitialNamespaceName, true); }
public ArrayList GetNamespaceContents(CodeCompletionDatabase db, string namspace, bool includeReferences) { return GetNamespaceContents (db, namspace, includeReferences, true); }
/// <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; }
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; }
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; }
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; }