Beispiel #1
0
        private void AddDocument(CodeDocument codeDoc)
        {
            if (codeDoc != null && codeDoc.Features.Set(CodeEditorFeatures.Tasks))
            {
                var editor = app.Editor(codeDoc.GetType());
                var sci    = editor.Control as ScintillaControl;

                if (sci != null)
                {
                    var node = new TreeNode();
                    codeDoc.FileChanged += (o, ev) => ChangeNodeText(node);
                    node.ImageKey        = node.SelectedImageKey = "Folder";
                    node.Tag             = codeDoc;
                    node.Nodes.Add(new TreeNode {
                        Tag = stub
                    });
                    ChangeNodeText(node);
                    nodeMap.Add(codeDoc, node);
                    treeView.Nodes.Add(node);

                    if (!sciMap.ContainsKey(sci))
                    {
                        sci.TextChanged += (o, ev) => ContentChanged();
                    }
                }
            }
        }
Beispiel #2
0
 private void AddDocument(CodeDocument codeDoc)
 {
     if (codeDoc != null && codeDoc.Features.Set(CodeEditorFeatures.Outline))
     {
         var tn  = control.AddDocumentNode(codeDoc);
         var sci = (ScintillaControl)App.Editor(codeDoc.GetType()).Control;
         sci.TextChanged     += (o, e) => DocumentChanged();
         codeDoc.FileChanged += (o, e) => ChangeNodeText(codeDoc, tn);
     }
 }
Beispiel #3
0
        private IEnumerable <SymbolLocation> ProcessFile(string name, CodeDocument doc)
        {
            var editor = app.Editor(doc.GetType());
            var list   = new List <SymbolLocation>();

            if (editor is ElaEditor)
            {
                var src = ((ITextEditor)editor).GetContent(doc);
                var p   = new ElaParser();
                var res = p.Parse(new StringBuffer(src));

                if (res.Success)
                {
                    res.Program.Includes.ForEach(i => FindName(name, doc, i, list));
                    FindName(name, doc, res.Program.Instances, list);
                    FindName(name, doc, res.Program.Classes, list);
                    FindName(name, doc, res.Program.Types, list);
                    FindName(name, doc, res.Program.TopLevel, list);
                }
            }

            return(list);
        }