示例#1
0
        private void ActivateEntries(int position)
        {
            if (_entries == null)
            {
                return;
            }

            int currentModuleIndex;

            _dropDownBar.GetCurrentSelection(ModuleComboBoxId, out currentModuleIndex);

            ModuleEntry newModule = _entries.LocateModule(position);

            Debug.Assert(newModule != null);

            MethodEntry newMethod      = newModule.LocateMethod(position);
            int         newMethodIndex = newMethod != null ? newMethod.Index : -1;

            if (newModule.Index != currentModuleIndex)
            {
                _dropDownBar.SetCurrentSelection(ModuleComboBoxId, newModule.Index);
                _dropDownBar.RefreshCombo(MethodComboBoxId, newMethodIndex);
            }
            else
            {
                int currentMethodIndex;
                _dropDownBar.GetCurrentSelection(MethodComboBoxId, out currentMethodIndex);
                if (newMethodIndex != currentMethodIndex)
                {
                    _dropDownBar.SetCurrentSelection(MethodComboBoxId, newMethodIndex);
                }
            }
        }
示例#2
0
        private void EnterModule(string /*!*/ name, Node /*!*/ definition, bool isExpressionBound, bool isSingleton)
        {
            string displayName = name;
            int    count;

            if (_definitions.TryGetValue(name, out count))
            {
                count++;
                displayName = name + " (" + count + ")";
            }
            else
            {
                count = 1;
            }
            _definitions[name] = count;

            var entry = new ModuleEntry(displayName, name, definition, isExpressionBound, isSingleton);

            _entries.Add(entry);
            _outerModules.Peek().AddNested(entry);
            _outerName.Add(name);
            _outerModules.Push(entry);

            // add a boundary for method nesting:
            _outerMethods.Push(null);
        }
示例#3
0
 public void AddNested(ModuleEntry /*!*/ module)
 {
     if (_nestedModules == null)
     {
         _nestedModules = new List <ModuleEntry>();
     }
     else
     {
         // children need to be sorted by position:
         Debug.Assert(_nestedModules.Last().End <= module.Start);
     }
     _nestedModules.Add(module);
 }
示例#4
0
        /// <summary>
        /// Wired to parser event for when the parser has completed parsing a new tree and we need
        /// to update the navigation bar with the new data.
        /// </summary>
        private void ParserOnNewParseTree(object sender, EventArgs e)
        {
            if (_dropDownBar != null)
            {
                Action callback = () => {
                    BuildModel();
                    int position = _textView.Caret.Position.BufferPosition.Position;

                    ModuleEntry newModule = _entries.LocateModule(position);
                    MethodEntry newMethod = newModule.LocateMethod(position);
                    _dropDownBar.RefreshCombo(ModuleComboBoxId, newModule.Index);
                    _dropDownBar.RefreshCombo(MethodComboBoxId, newMethod != null ? newMethod.Index : -1);
                };

                _dispatcher.BeginInvoke(callback, DispatcherPriority.Background);
            }
        }
示例#5
0
        public ModelBuilder(SourceUnitTree /*!*/ tree)
        {
            _tree = tree;
            var top = new ModuleEntry("<main>", "<main>", tree, false, false);

            _outerName = new List <string>();
            _outerName.Add(null);

            _outerModules = new Stack <ModuleEntry>();
            _outerModules.Push(top);

            _outerMethods = new Stack <MethodEntry>();

            _definitions = new Dictionary <string, int>();
            _entries     = new List <ModuleEntry>();
            _entries.Add(top);
        }
示例#6
0
 public void AddNested(ModuleEntry/*!*/ module)
 {
     if (_nestedModules == null) {
         _nestedModules = new List<ModuleEntry>();
     } else {
         // children need to be sorted by position:
         Debug.Assert(_nestedModules.Last().End <= module.Start);
     }
     _nestedModules.Add(module);
 }
示例#7
0
        private void EnterModule(string/*!*/ name, Node/*!*/ definition, bool isExpressionBound, bool isSingleton)
        {
            string displayName = name;
            int count;
            if (_definitions.TryGetValue(name, out count)) {
                count++;
                displayName = name + " (" + count + ")";
            } else {
                count = 1;
            }
            _definitions[name] = count;

            var entry = new ModuleEntry(displayName, name, definition, isExpressionBound, isSingleton);

            _entries.Add(entry);
            _outerModules.Peek().AddNested(entry);
            _outerName.Add(name);
            _outerModules.Push(entry);

            // add a boundary for method nesting:
            _outerMethods.Push(null);
        }
示例#8
0
        public ModelBuilder(SourceUnitTree/*!*/ tree)
        {
            _tree = tree;
            var top = new ModuleEntry("<main>", "<main>", tree, false, false);

            _outerName = new List<string>();
            _outerName.Add(null);

            _outerModules = new Stack<ModuleEntry>();
            _outerModules.Push(top);

            _outerMethods = new Stack<MethodEntry>();

            _definitions = new Dictionary<string, int>();
            _entries = new List<ModuleEntry>();
            _entries.Add(top);
        }
示例#9
0
 public Model(ModuleEntry/*!*/ top, ModuleEntry[]/*!*/ moduleEntries)
 {
     _top = top;
     _moduleEntries = moduleEntries;
 }
示例#10
0
        private readonly ModuleEntry[] /*!*/ _moduleEntries;                           // entries for modules of the file

        public Model(ModuleEntry /*!*/ top, ModuleEntry[] /*!*/ moduleEntries)
        {
            _top           = top;
            _moduleEntries = moduleEntries;
        }