Exemplo n.º 1
0
        public void RegisterHierarchy(IVsHierarchy hierarchy)
        {
            if ((null == hierarchy) || _hierarchies.ContainsKey(hierarchy))
            {
                return;
            }

            RegisterLibrary();

            HierarchyListener listener = new HierarchyListener(hierarchy, _package.Engine);

            listener.OnAddItem    += new EventHandler <HierarchyEventArgs>(OnNewFile);
            listener.OnDeleteItem += new EventHandler <HierarchyEventArgs>(OnDeleteFile);
            listener.StartListening(true);
            _hierarchies.Add(hierarchy, listener);
            RegisterForRDTEvents();
        }
Exemplo n.º 2
0
        public void UnregisterHierarchy(IVsHierarchy hierarchy)
        {
            if ((null == hierarchy) || !_hierarchies.ContainsKey(hierarchy))
            {
                return;
            }
            HierarchyListener listener = _hierarchies[hierarchy];

            if (null != listener)
            {
                listener.Dispose();
            }
            _hierarchies.Remove(hierarchy);
            if (0 == _hierarchies.Count)
            {
                UnregisterRDTEvents();
            }
            lock (_files) {
                ModuleId[] keys = new ModuleId[_files.Keys.Count];
                _files.Keys.CopyTo(keys, 0);
                foreach (ModuleId id in keys)
                {
                    if (hierarchy.Equals(id.Hierarchy))
                    {
                        _library.RemoveNode(_files[id]);
                        _files.Remove(id);
                    }
                }
            }
            // Remove the document listeners.
            uint[] docKeys = new uint[_documents.Keys.Count];
            _documents.Keys.CopyTo(docKeys, 0);
            foreach (uint id in docKeys)
            {
                TextLineEventListener docListener = _documents[id];
                if (hierarchy.Equals(docListener.FileID.Hierarchy))
                {
                    _documents.Remove(id);
                    docListener.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        public void RegisterHierarchy(IVsHierarchy hierarchy)
        {
            if ((null == hierarchy) || _hierarchies.ContainsKey(hierarchy)) {
                return;
            }

            RegisterLibrary();

            HierarchyListener listener = new HierarchyListener(hierarchy, _package.Engine);
            listener.OnAddItem += new EventHandler<HierarchyEventArgs>(OnNewFile);
            listener.OnDeleteItem += new EventHandler<HierarchyEventArgs>(OnDeleteFile);
            listener.StartListening(true);
            _hierarchies.Add(hierarchy, listener);
            RegisterForRDTEvents();
        }