Esempio n. 1
0
        public Library(Guid libraryGuid)
        {
            this.guid = libraryGuid;

            root        = new LibraryNode("", LibraryNode.LibraryNodeType.Package); //the root node is not visible in the object browser
            cocoLibNode = new LibraryNode("Coco/R Grammar Library", LibraryNode.LibraryNodeType.Package);
            root.AddNode(cocoLibNode);
            classLevelNode = new LibraryNode("Coco/R Grammar Files", LibraryNode.LibraryNodeType.Namespaces);
            cocoLibNode.AddNode(classLevelNode);
        }
Esempio n. 2
0
 internal void RemoveNode(LibraryNode node)
 {
     lock (this) {
         //recreate every node
         root           = new LibraryNode(root);
         cocoLibNode    = new LibraryNode(cocoLibNode);
         classLevelNode = new LibraryNode(classLevelNode);
         classLevelNode.RemoveNode(node);
         root.children.Clear();
         cocoLibNode.children.Clear();
         cocoLibNode.AddNode(classLevelNode);
         root.AddNode(cocoLibNode);
     }
 }
Esempio n. 3
0
 private void CreateLibraryEntry(LibraryNode parent, ModuleId moduleId, IEnumerable <AddTokenInfo> tokens, IDictionary <string, List <AddTokenInfo> > references)
 {
     foreach (AddTokenInfo info in tokens)
     {
         int             length = info.Name == null ? 0 : info.Name.Length;
         CocoLibraryNode entry  = new CocoLibraryNode(info.Name, info.Line, info.Col, info.Col + length, moduleId.Hierarchy, moduleId.ItemID, LibraryNode.LibraryNodeType.Members);
         parent.AddNode(entry);
         if (references.ContainsKey(info.Name))
         {
             foreach (AddTokenInfo refInfo in references[info.Name])
             {
                 if (refInfo.Line == info.Line && refInfo.Col == info.Col)
                 {
                     continue; //sometimes the definition is also tracked as reference (only with tokendecls, but changes to original parser would be necessary to avoid this) -> simply skip it here
                 }
                 //it is important that the name is starts with the same name as the definition, followed by a whitespace (easy search-algorithm)
                 string          refName   = String.Format("{0} ({1}, {2}): {3}", refInfo.Name, refInfo.Line, refInfo.Col, refInfo.AdditionalInfo);
                 CocoLibraryNode reference = new CocoLibraryNode(refName, refInfo.Line, refInfo.Col, refInfo.Col + length, moduleId.Hierarchy, moduleId.ItemID, LibraryNode.LibraryNodeType.References);
                 reference.Visible = false;
                 parent.AddNode(reference);
             }
         }
     }
 }