예제 #1
0
        /// <summary>
        ///  标签有更改时更新界面
        /// </summary>
        /// <param name="file"></param>
        /// <param name="op"></param>

        /*  void _TagCache_CacheUpdated(CacheUpdatedArgs e)
         * {
         *    // 删除结点
         *    TreeNode root = tvClassView.Nodes[e.ProjectIndex];
         *    ClassViewIndex index = root.Tag as ClassViewIndex;
         *    if (index.FileName2TreeNode_Index.ContainsKey(e.File))
         *    {
         *        List<TreeNode> nodeList = index.FileName2TreeNode_Index[e.File];
         *        nodeList.Reverse();
         *        foreach (TreeNode node in nodeList)
         *        {
         *            ITag tag = node.Tag as ITag;
         *            index.TagFullName2TreeNode_Index.Remove(tag.FullName);
         *        }
         *        index.FileName2TreeNode_Index.Remove(e.File);
         *        foreach (TreeNode node in nodeList)
         *        {
         *            if (node.Nodes.Count == 0)  // 没有子结点的情况下才删除。像命名空间往往有很多子结点
         *                node.Remove();  // throw new exception?
         *        }
         *    }
         *    // 如果是Update操作,添加结点
         *    if (e.Operator == Operator.Update)
         *    {
         *        _InsertTags(root, TagCache.GetTags(e.File));
         *    }
         * }*/
        /// <summary>
        /// Update tree for current active document
        /// </summary>
        /// <param name="root"></param>
        /// <param name="tags"></param>
        void _InsertTags(TreeNode root, List <ITag> tags)
        {
            IView _View = ControllerDocument.Instance.GetActiveView();

            if (_View == null || _View.GetViewData() == null)
            {
                return;
            }

            string  _Scope = _View.GetViewData().File;
            Project proj   = ProjectManager.GetProjectByItsFile(_Scope);

            if (proj == null)
            {
                return;
            }
            ModelDocument _Model = proj.Model;

            _Scope = _Model.GetRelativePath(_Scope);
            TreeNode parent = new TreeNode(_Scope);

            _InsertTagsSub(parent, _Scope, _Model);
            tvClassView.Nodes.Clear();
            tvClassView.Nodes.Add(parent);
            tvClassView.ExpandAll();
        }
예제 #2
0
 /// <summary>
 /// this needs to be called before processing next file token
 /// </summary>
 /// <param name="Scope"></param>
 public void ResetState(String filePath)
 {
     m_IsRoot = true;
     m_Scope  = filePath;
     if (!filePath.Equals(""))
     {
         m_Scope = m_Model.GetRelativePath(filePath);     // the sequence relative to project-dir
     }
     m_Context.ResetCmds(m_Scope);
 }
예제 #3
0
        /// <summary>
        /// Update tree for current active document
        /// </summary>
        /// <param name="root"></param>
        /// <param name="tags"></param>
        void _InsertTags(TreeNode root, List <ITag> tags)
        {
            string  _Scope = NPP.GetCurrentFile();
            Project proj   = ProjectManager.GetProjectByItsFile(_Scope);

            if (proj == null)
            {
                return;
            }
            ModelDocument _Model = proj.Model;

            _Scope = _Model.GetRelativePath(_Scope);
            TreeNode parent = new TreeNode(_Scope);

            _InsertTagsSub(parent, _Scope, _Model);
            tvClassView.Nodes.Clear();
            tvClassView.Nodes.Add(parent);
            tvClassView.ExpandAll();
        }