Ejemplo n.º 1
0
        public LibraryNode(LibraryNode node)
        {
            _capabilities  = node._capabilities;
            _contextMenuID = node._contextMenuID;
            _displayData   = node._displayData;
            _name          = node._name;
            _tooltip       = node._tooltip;
            _type          = node._type;
            _children      = new List <LibraryNode>();

            foreach (LibraryNode child in node._children)
            {
                _children.Add(child);
            }

            _clipboardFormats = new List <VSOBJCLIPFORMAT>();

            foreach (VSOBJCLIPFORMAT format in node._clipboardFormats)
            {
                _clipboardFormats.Add(format);
            }

            _filteredView = new Dictionary <LibraryNodeType, LibraryNode>();
            _updateCount  = node._updateCount;
        }
        protected virtual uint CategoryField(LIB_CATEGORY category)
        {
            uint fieldValue = 0;

            switch (category)
            {
            case LIB_CATEGORY.LC_LISTTYPE:
            {
                LibraryNodeType subTypes = LibraryNodeType.None;
                foreach (LibraryNode node in children)
                {
                    subTypes |= node.type;
                }
                fieldValue = (uint)subTypes;
            }
            break;

            case (LIB_CATEGORY)_LIB_CATEGORY2.LC_HIERARCHYTYPE:
                fieldValue = (uint)_LIBCAT_HIERARCHYTYPE.LCHT_UNKNOWN;
                break;

            default:
                throw new NotImplementedException();
            }
            return(fieldValue);
        }
Ejemplo n.º 3
0
 public LibraryNode(LibraryNode node)
 {
     this.capabilities  = node.capabilities;
     this.contextMenuID = node.contextMenuID;
     this.displayData   = node.displayData;
     this.name          = node.name;
     this.uniquename    = node.uniquename;
     this.tooltip       = node.tooltip;
     this.type          = node.type;
     this.children      = new List <LibraryNode>();
     foreach (LibraryNode child in node.children)
     {
         children.Add(child);
     }
     this.clipboardFormats = new List <VSOBJCLIPFORMAT>();
     foreach (VSOBJCLIPFORMAT format in node.clipboardFormats)
     {
         clipboardFormats.Add(format);
     }
     this.filteredView   = new Dictionary <LibraryNodeType, LibraryNode>();
     this.ownerHierarchy = node.ownerHierarchy;
     this.fileId         = node.fileId;
     this.sourceSpan     = node.sourceSpan;
     this.CanGoToSource  = node.CanGoToSource;
     this.updateCount    = node.updateCount;
 }
Ejemplo n.º 4
0
 protected IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
 {
     return(ThreadHelper.JoinableTaskFactory.Run(async delegate
     {
         await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
         LibraryNode filtered = null;
         if (filteredView.TryGetValue(filterType, out filtered))
         {
             return filtered as IVsSimpleObjectList2;
         }
         filtered = this.Clone();
         for (int i = 0; i < filtered.children.Count;)
         {
             if (0 == (filtered.children[i].type & filterType))
             {
                 filtered.children.RemoveAt(i);
             }
             else
             {
                 i += 1;
             }
         }
         filteredView.Add(filterType, filtered);
         return filtered as IVsSimpleObjectList2;
     }));
 }
Ejemplo n.º 5
0
        public LibraryNode(string name, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID, ModuleId moduleId)
        {
            this.capabilities  = capabilities;
            this.contextMenuID = contextMenuID;
            this.name          = name;
            this.uniquename    = name;
            this.tooltip       = name;
            this.type          = type;
            parent             = null;
            children           = new List <LibraryNode>();
            clipboardFormats   = new List <VSOBJCLIPFORMAT>();
            filteredView       = new Dictionary <LibraryNodeType, LibraryNode>();
            if (moduleId != null)
            {
                this.ownerHierarchy = moduleId.Hierarchy;
                this.fileId         = moduleId.ItemID;
                ownerHierarchy.GetCanonicalName(fileId, out this.path);
            }
            sourceSpan = new TextSpan();
            if (type == LibraryNodeType.Package)
            {
                this.CanGoToSource = false;
            }
            else
            {
                this.CanGoToSource = true;
            }

            if (type == LibraryNodeType.Members)
            {
                displayData.Image         = (ushort)OMGlyphType.Members;
                displayData.SelectedImage = displayData.Image;
            }
        }
Ejemplo n.º 6
0
        protected IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
        {
            LibraryNode filtered;

            if (_filteredView.TryGetValue(filterType, out filtered))
            {
                return(filtered);
            }

            filtered = Clone();

            for (int i = 0; i < filtered._children.Count;)
            {
                if (0 == (filtered._children[i]._type & filterType))
                {
                    filtered._children.RemoveAt(i);
                }
                else
                {
                    i += 1;
                }
            }

            _filteredView.Add(filterType, filtered);

            return(filtered);
        }
Ejemplo n.º 7
0
        protected virtual uint CategoryField(LIB_CATEGORY category)
        {
            uint fieldValue = 0;

            switch (category)
            {
            case LIB_CATEGORY.LC_LISTTYPE:
            {
                LibraryNodeType subTypes = LibraryNodeType.None;
                foreach (LibraryNode node in children)
                {
                    subTypes |= node.type;
                }
                fieldValue = (uint)subTypes;
            }
            break;

            case (LIB_CATEGORY)_LIB_CATEGORY2.LC_HIERARCHYTYPE:
                fieldValue = (uint)_LIBCAT_HIERARCHYTYPE.LCHT_UNKNOWN;
                break;

            case LIB_CATEGORY.LC_VISIBILITY:
            case LIB_CATEGORY.LC_NODETYPE:
            case LIB_CATEGORY.LC_MODIFIER:
            case LIB_CATEGORY.LC_CLASSTYPE:
            case LIB_CATEGORY.LC_CLASSACCESS:
            case LIB_CATEGORY.LC_MEMBERACCESS:
            case LIB_CATEGORY.LC_MEMBERTYPE:
            default:
                break;
            }
            return(fieldValue);
        }
Ejemplo n.º 8
0
        protected _LIBCAT_SEARCHMATCHTYPE srchMatchType           = _LIBCAT_SEARCHMATCHTYPE.LSMT_LEAF_WHOLEWORD;                                    // 4

        public SymbolNode(string text, string prefix, string fName, int lineNumber, int columnNumber, LibraryNodeType type)
        {
            this.symbolText   = text;
            this.symbolPrefix = prefix;
            this.fName        = fName;
            this.lineNumber   = lineNumber;
            this.columnNumber = columnNumber;
            this.nodeListType = type;
        }
Ejemplo n.º 9
0
 public SymbolNode(string text, string prefix, string fName, int lineNumber, int columnNumber, LibraryNodeType type)
 {
     this.symbolText = text;
     this.symbolPrefix = prefix;
     this.fName = fName;
     this.lineNumber = lineNumber;
     this.columnNumber = columnNumber;
     this.nodeListType = type;
 }
Ejemplo n.º 10
0
 public LibraryNode(string name, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID)
 {
     _capabilities  = capabilities;
     _contextMenuID = contextMenuID;
     _name          = name;
     _tooltip       = name;
     _type          = type;
     _filteredView  = new Dictionary <LibraryNodeType, LibraryNode>();
 }
 public SQObjectLibraryNode(LibraryNodeType type, string name)
 {
     _altName                   = name;
     _capabilities              = LibraryNodeCapabilities.None;
     _displayData               = new VSTREEDISPLAYDATA();
     _type                      = LibraryNodeType.Namespaces;
     _displayData.Image         = (ushort)StandardGlyphGroup.GlyphGroupEnum;
     _displayData.SelectedImage = _displayData.Image;
 }
Ejemplo n.º 12
0
 internal SymbolNode(SymbolNode node)
 {
     this.symbolText = node.symbolText;
     this.symbolPrefix = node.symbolPrefix;
     this.fName = node.fName;
     this.lineNumber = node.lineNumber;
     this.columnNumber = node.columnNumber;
     this.nodeListType = node.nodeListType;
     node.children.ForEach(c => AddChild(c));
 }
Ejemplo n.º 13
0
 public LibraryNode(LibraryNode node)
 {
     _capabilities  = node._capabilities;
     _contextMenuID = node._contextMenuID;
     _name          = node._name;
     _tooltip       = node._tooltip;
     _type          = node._type;
     Children.AddRange(node.Children);
     _filteredView = new Dictionary <LibraryNodeType, LibraryNode>();
 }
Ejemplo n.º 14
0
 internal ResultList(ResultList node)
 {
     this.symbolText = node.symbolText;
     this.symbolPrefix = node.symbolPrefix;
     this.fName = node.fName;
     this.lineNumber = node.lineNumber;
     this.columnNumber = node.columnNumber;
     this.nodeType = node.nodeType;
     node.children.ForEach(c => AddChild(c));
 }
Ejemplo n.º 15
0
 internal SymbolNode(SymbolNode node)
 {
     this.symbolText   = node.symbolText;
     this.symbolPrefix = node.symbolPrefix;
     this.fName        = node.fName;
     this.lineNumber   = node.lineNumber;
     this.columnNumber = node.columnNumber;
     this.nodeListType = node.nodeListType;
     node.children.ForEach(c => AddChild(c));
 }
        public SQObjectLibraryNode(SQProjectFileNode filenode, SQDeclaration declaration, LibraryNodeCapabilities capabilities)
        {
            _filenode     = filenode;
            _filePath     = filenode.Url;
            _declaration  = declaration;
            _capabilities = capabilities;
            _displayData  = new VSTREEDISPLAYDATA();
            //if (((VisualStudioWorkspaceImpl)workspace).TryGetImageListAndIndex(_imageService, document.Id, out pData[0].hImageList, out pData[0].Image))
            //bool global = _declaration.Parent.Type == SQDeclarationType.File;
            bool local = _declaration.Parent.Type == SQDeclarationType.Function || _declaration.Parent.Type == SQDeclarationType.Constructor;

            switch (_declaration.Type)
            {
            case SQDeclarationType.Class:
                _type = LibraryNodeType.Classes; break;

            case SQDeclarationType.Constructor:
            case SQDeclarationType.Function:
                _type = LibraryNodeType.Members;
                _displayData.Image = (ushort)StandardGlyphGroup.GlyphGroupMethod;
                break;

            case SQDeclarationType.Variable:
                _type = LibraryNodeType.Members;
                _displayData.Image = (ushort)StandardGlyphGroup.GlyphGroupVariable;
                break;

            case SQDeclarationType.Enum:
                _type = LibraryNodeType.Namespaces;
                _displayData.Image = (ushort)StandardGlyphGroup.GlyphGroupEnum;
                break;

            case SQDeclarationType.EnumData:
                _type = LibraryNodeType.Members;
                _displayData.Image = (ushort)StandardGlyphGroup.GlyphGroupEnumMember;
                break;
            }

            // if (local)
            //   _displayData.Image |= (ushort)StandardGlyphItem.GlyphItemPrivate;

            if (_type == LibraryNodeType.Package)
            {
                this.CanGoToSource = false;
            }
            else
            {
                this.CanGoToSource = true;
            }

            //if (_type == LibraryNodeType.Members)
            {
                _displayData.SelectedImage = _displayData.Image;
            }
        }
Ejemplo n.º 17
0
 public LibraryNode(string name, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID)
 {
     this.capabilities = capabilities;
     this.contextMenuID = contextMenuID;
     this.name = name;
     this.tooltip = name;
     this.type = type;
     children = new List<LibraryNode>();
     clipboardFormats = new List<VSOBJCLIPFORMAT>();
     filteredView = new Dictionary<LibraryNodeType, LibraryNode>();
 }
 public LibraryNode(string name, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID)
 {
     this.capabilities  = capabilities;
     this.contextMenuID = contextMenuID;
     this.name          = name;
     this.tooltip       = name;
     this.type          = type;
     children           = new List <LibraryNode>();
     clipboardFormats   = new List <VSOBJCLIPFORMAT>();
     filteredView       = new Dictionary <LibraryNodeType, LibraryNode>();
 }
Ejemplo n.º 19
0
 internal XSharpLibraryNode(string namePrefix, LibraryNodeType nType)
     : base(namePrefix)
 {
     //
     this.filesId = new List <uint>();
     //
     this.ownerHierarchy = null;
     this.Depends(0);
     this.member   = null;
     this.NodeType = nType;
 }
Ejemplo n.º 20
0
 protected LibraryNode(LibraryNode node, string newFullName)
 {
     _capabilities  = node._capabilities;
     _contextMenuID = node._contextMenuID;
     _name          = node._name;
     _tooltip       = node._tooltip;
     _type          = node._type;
     _fullname      = newFullName;
     Children.AddRange(node.Children);
     _childrenByName = new Dictionary <string, LibraryNode[]>(node._childrenByName);
     _filteredView   = new Dictionary <LibraryNodeType, LibraryNode>();
 }
Ejemplo n.º 21
0
        public LibraryNode(LibraryNode parent, string name, string fullname, LibraryNodeType type, LibraryNodeCapabilities capabilities = LibraryNodeCapabilities.None, CommandID contextMenuID = null)
        {
            Debug.Assert(name != null);

            this.Parent        = parent;
            this.capabilities  = capabilities;
            this.ContextMenuID = contextMenuID;
            this.Name          = name;
            this.FullName      = fullname;
            this.TooltipText   = name;
            this.NodeType      = type;
        }
Ejemplo n.º 22
0
        public LibraryNode(LibraryNode parent, string name, string fullname, LibraryNodeType type, LibraryNodeCapabilities capabilities = LibraryNodeCapabilities.None, IList <LibraryNode> children = null) : base(children)
        {
            Debug.Assert(name != null);

            _parent         = parent;
            _capabilities   = capabilities;
            _name           = name;
            _fullname       = fullname;
            _tooltip        = name;
            _type           = type;
            _filteredView   = new Dictionary <LibraryNodeType, LibraryNode>();
            _childrenByName = new Dictionary <string, LibraryNode[]>();
        }
        public IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
        {
            SQObjectLibraryNode filtered = new SQObjectLibraryNode(_filenode, _declaration, _capabilities);

            foreach (var child in Children)
            {
                if ((child._type & filterType) != 0)
                {
                    filtered.Children.Add(new SQObjectLibraryNode(child._filenode, child._declaration, child._capabilities));
                }
            }
            return(filtered as IVsSimpleObjectList2);
        }
        public LibraryNode(LibraryNode parent, string name, string fullname, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID)
        {
            Debug.Assert(name != null);

            _parent         = parent;
            _capabilities   = capabilities;
            _contextMenuID  = contextMenuID;
            _name           = name;
            _fullname       = fullname;
            _tooltip        = name;
            _type           = type;
            _filteredView   = new Dictionary <LibraryNodeType, LibraryNode>();
            _childrenByName = new Dictionary <string, LibraryNode[]>();
        }
Ejemplo n.º 25
0
 protected LibraryNode(LibraryNode node, string newFullName)
 {
     _parent       = node._parent;
     _capabilities = node._capabilities;
     _name         = node._name;
     _tooltip      = node._tooltip;
     _type         = node._type;
     _fullname     = newFullName;
     foreach (var child in node.Children)
     {
         Children.Add(child);
     }
     _childrenByName = new Dictionary <string, LibraryNode[]>(node._childrenByName);
     _filteredView   = new Dictionary <LibraryNodeType, LibraryNode>();
 }
Ejemplo n.º 26
0
        public override uint CategoryField(LIB_CATEGORY category)
        {
            uint fieldValue = 0;

            switch (category)
            {
            case (LIB_CATEGORY)_LIB_CATEGORY2.LC_PHYSICALCONTAINERTYPE:
                fieldValue = (uint)_LIBCAT_PHYSICALCONTAINERTYPE.LCPT_PROJECT;
                break;

            case LIB_CATEGORY.LC_NODETYPE:
                fieldValue = (uint)_LIBCAT_NODETYPE.LCNT_SYMBOL;
                break;

            case LIB_CATEGORY.LC_LISTTYPE:
            {
                LibraryNodeType subTypes = LibraryNodeType.None;
                foreach (LibraryNode node in Children)
                {
                    subTypes |= node._type;
                }
                fieldValue = (uint)subTypes;
            }
            break;

            case (LIB_CATEGORY)_LIB_CATEGORY2.LC_HIERARCHYTYPE:
                fieldValue = (uint)_LIBCAT_HIERARCHYTYPE.LCHT_UNKNOWN;
                break;

            case LIB_CATEGORY.LC_VISIBILITY:
                fieldValue = (uint)_LIBCAT_VISIBILITY.LCV_VISIBLE;
                break;

            case LIB_CATEGORY.LC_MEMBERTYPE:
                fieldValue = (uint)_LIBCAT_MEMBERTYPE.LCMT_METHOD;
                break;

            case LIB_CATEGORY.LC_MEMBERACCESS:
                fieldValue = (uint)_LIBCAT_MEMBERACCESS.LCMA_PUBLIC;
                break;

            default:
                throw new NotImplementedException();
            }
            return(fieldValue);
        }
Ejemplo n.º 27
0
 internal XSharpLibraryNode(string namePrefix, LibraryNodeType nType)
     : base(namePrefix)
 {
     //
     this.filesId = new List <uint>();
     //
     this.ownerHierarchy = null;
     this.Depends(0);
     //this.member = null;
     this.NodeType = nType;
     if (this.NodeType == LibraryNodeType.Namespaces)
     {
         buildImageData(Kind.Namespace, Modifiers.Public);
     }
     //
     description = new List <Tuple <string, VSOBDESCRIPTIONSECTION> >();
     editorInfo  = null;
 }
Ejemplo n.º 28
0
 public LibraryNode(LibraryNode node)
 {
     this.capabilities = node.capabilities;
     this.contextMenuID = node.contextMenuID;
     this.displayData = node.displayData;
     this.name = node.name;
     this.tooltip = node.tooltip;
     this.type = node.type;
     this.children = new List<LibraryNode>();
     foreach (LibraryNode child in node.children) {
         children.Add(child);
     }
     this.clipboardFormats = new List<VSOBJCLIPFORMAT>();
     foreach (VSOBJCLIPFORMAT format in node.clipboardFormats) {
         clipboardFormats.Add(format);
     }
     this.filteredView = new Dictionary<LibraryNodeType, LibraryNode>();
     this.updateCount = node.updateCount;
 }
Ejemplo n.º 29
0
        protected virtual uint CategoryField(LIB_CATEGORY category)
        {
            switch (category)
            {
            case LIB_CATEGORY.LC_LISTTYPE:
                LibraryNodeType subTypes = LibraryNodeType.None;

                foreach (LibraryNode node in _children)
                {
                    subTypes |= node._type;
                }

                return((uint)subTypes);

            case (LIB_CATEGORY)_LIB_CATEGORY2.LC_HIERARCHYTYPE:
                return((uint)_LIBCAT_HIERARCHYTYPE.LCHT_UNKNOWN);

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 30
0
        public LibraryNode(LibraryNode node)
        {
            _capabilities  = node._capabilities;
            _contextMenuID = node._contextMenuID;
            _displayData   = node._displayData;
            _name		  = node._name;
            _tooltip	   = node._tooltip;
            _type		  = node._type;
            _children	  = new List<LibraryNode>();

            foreach (LibraryNode child in node._children)
                _children.Add(child);

            _clipboardFormats = new List<VSOBJCLIPFORMAT>();

            foreach (VSOBJCLIPFORMAT format in node._clipboardFormats)
                _clipboardFormats.Add(format);

            _filteredView = new Dictionary<LibraryNodeType, LibraryNode>();
            _updateCount  = node._updateCount;
        }
Ejemplo n.º 31
0
 public LibraryNode(LibraryNode node)
 {
     this.capabilities  = node.capabilities;
     this.contextMenuID = node.contextMenuID;
     this.displayData   = node.displayData;
     this.name          = node.name;
     this.tooltip       = node.tooltip;
     this.type          = node.type;
     this.visible       = node.visible;
     this.children      = new List <LibraryNode>();
     foreach (LibraryNode child in node.children)
     {
         children.Add(child);
     }
     this.clipboardFormats = new List <VSOBJCLIPFORMAT>();
     foreach (VSOBJCLIPFORMAT format in node.clipboardFormats)
     {
         clipboardFormats.Add(format);
     }
     this.filteredView = new Dictionary <LibraryNodeType, LibraryNode>();
     this.updateCount  = node.updateCount;
 }
Ejemplo n.º 32
0
        public IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
        {
            LibraryNode filtered = null;

            if (filteredView.TryGetValue(filterType, out filtered))
            {
                return(filtered as IVsSimpleObjectList2);
            }
            filtered = this.Clone();
            for (int i = 0; i < filtered.children.Count;)
            {
                if (0 == (filtered.children[i].type & filterType))
                {
                    filtered.children.RemoveAt(i);
                }
                else
                {
                    i += 1;
                }
            }
            filteredView.Add(filterType, filtered);
            return(filtered as IVsSimpleObjectList2);
        }
 public NodeFileLibraryNode(LibraryNode parent, HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType)
     : base(parent, name, filename, libraryNodeType) {
 }
Ejemplo n.º 34
0
 public PythonFileLibraryNode(LibraryNode parent, HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType)
     : base(parent, name, filename, libraryNodeType) {
         _hierarchy = hierarchy;
 }
Ejemplo n.º 35
0
        internal IVsSimpleObjectList2 FilterView(LibraryNodeType filterType, VSOBSEARCHCRITERIA2[] pobSrch)
        {
            SymbolNode
                filtered = null,
                temp = null;

            if (!filteredView.TryGetValue(filterType, out temp))
            {   // Filling filtered view
                filtered = this.Clone();
                for (int i = 0; i < filtered.children.Count; )
                    if (0 == (filtered.children[i].nodeListType & filterType))
                        filtered.children.RemoveAt(i);
                    else
                        i += 1;
                filteredView.Add(filterType, filtered.Clone());
            }
            else
                filtered = temp.Clone(); // making sure we filter a new node

            // Checking if we need to perform search
            if (pobSrch != null)
            {
                Regex reg;
                switch (pobSrch[0].eSrchType)
                {
                    case VSOBSEARCHTYPE.SO_ENTIREWORD:
                        reg = new Regex(string.Format("^{0}$", pobSrch[0].szName.ToLower()));
                        break;
                    case VSOBSEARCHTYPE.SO_PRESTRING:
                        reg = new Regex(string.Format("^{0}.*", pobSrch[0].szName.ToLower()));
                        break;
                    case VSOBSEARCHTYPE.SO_SUBSTRING:
                        reg = new Regex(string.Format(".*{0}.*", pobSrch[0].szName.ToLower()));
                        break;
                    default:
                        throw new NotImplementedException();
                }

                for (int i = 0; i < filtered.children.Count; )
                    if (!reg.Match(filtered.children[i].UniqueName.ToLower()).Success)
                        filtered.children.RemoveAt(i);
                    else
                        i += 1;
            }

            return filtered as IVsSimpleObjectList2;
        }
Ejemplo n.º 36
0
 public JFileLibraryNode(HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType)
     : base(name, filename, libraryNodeType)
 {
     _hierarchy = hierarchy;
 }
Ejemplo n.º 37
0
 public virtual LibraryNode CreateFileLibraryNode(LibraryNode parent, HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType) {
     return new LibraryNode(null, name, filename, libraryNodeType);
 }
Ejemplo n.º 38
0
 public override LibraryNode CreateFileLibraryNode(HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType)
 {
     return new JFileLibraryNode(hierarchy, hierarchy.Caption, filename, libraryNodeType);
 }
Ejemplo n.º 39
0
        protected IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
        {
            LibraryNode filtered;

            if (_filteredView.TryGetValue(filterType, out filtered))
                return filtered;

            filtered = Clone();

            for (int i = 0; i < filtered._children.Count; )
            {
                if (0 == (filtered._children[i]._type & filterType))
                    filtered._children.RemoveAt(i);
                else
                    i += 1;
            }

            _filteredView.Add(filterType, filtered);

            return filtered;
        }
 public LibraryNode(string name, LibraryNodeType type)
     : this(name, type, LibraryNodeCapabilities.None, null)
 {
 }
Ejemplo n.º 41
0
 protected IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
 {
     LibraryNode filtered = null;
     if (filteredView.TryGetValue(filterType, out filtered)) {
         return filtered as IVsSimpleObjectList2;
     }
     filtered = this.Clone();
     for (int i = 0; i < filtered.children.Count;) {
         if (0 == (filtered.children[i].type & filterType)) {
             filtered.children.RemoveAt(i);
         } else {
             i += 1;
         }
     }
     filteredView.Add(filterType, filtered);
     return filtered as IVsSimpleObjectList2;
 }
Ejemplo n.º 42
0
 public LibraryNode(string name, LibraryNodeType type)
     : this(name, type, LibraryNodeCapabilities.None, null)
 {
 }
Ejemplo n.º 43
0
 protected CommonLibraryNode(LibraryNode parent, string name, string fullName, IVsHierarchy hierarchy, uint itemId, LibraryNodeType type, IList<LibraryNode> children = null) :
     base(parent, name, fullName, type, children: children) {
     _ownerHierarchy = hierarchy;
     _fileId = itemId;
 }
Ejemplo n.º 44
0
 public PythonFileLibraryNode(HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType)
     : base(name, filename, libraryNodeType)
 {
     _hierarchy = hierarchy;
 }
Ejemplo n.º 45
0
        internal IVsSimpleObjectList2 FilterView(LibraryNodeType filterType, VSOBSEARCHCRITERIA2[] pobSrch)
        {
            SymbolNode
                filtered = null,
                temp     = null;

            if (!filteredView.TryGetValue(filterType, out temp))
            {   // Filling filtered view
                filtered = this.Clone();
                for (int i = 0; i < filtered.children.Count;)
                {
                    if (0 == (filtered.children[i].nodeListType & filterType))
                    {
                        filtered.children.RemoveAt(i);
                    }
                    else
                    {
                        i += 1;
                    }
                }
                filteredView.Add(filterType, filtered.Clone());
            }
            else
            {
                filtered = temp.Clone(); // making sure we filter a new node
            }
            // Checking if we need to perform search
            if (pobSrch != null)
            {
                Regex reg;
                switch (pobSrch[0].eSrchType)
                {
                case VSOBSEARCHTYPE.SO_ENTIREWORD:
                    reg = new Regex(string.Format("^{0}$", pobSrch[0].szName.ToLower()));
                    break;

                case VSOBSEARCHTYPE.SO_PRESTRING:
                    reg = new Regex(string.Format("^{0}.*", pobSrch[0].szName.ToLower()));
                    break;

                case VSOBSEARCHTYPE.SO_SUBSTRING:
                    reg = new Regex(string.Format(".*{0}.*", pobSrch[0].szName.ToLower()));
                    break;

                default:
                    throw new NotImplementedException();
                }

                for (int i = 0; i < filtered.children.Count;)
                {
                    if (!reg.Match(filtered.children[i].UniqueName.ToLower()).Success)
                    {
                        filtered.children.RemoveAt(i);
                    }
                    else
                    {
                        i += 1;
                    }
                }
            }

            return(filtered as IVsSimpleObjectList2);
        }
Ejemplo n.º 46
0
 public virtual LibraryNode CreateFileLibraryNode(LibraryNode parent, HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType)
 {
     return(new LibraryNode(null, name, filename, libraryNodeType));
 }
Ejemplo n.º 47
0
 public override LibraryNode CreateFileLibraryNode(LibraryNode parent, HierarchyNode hierarchy, string name, string filename, LibraryNodeType libraryNodeType) {
     return new PythonFileLibraryNode(parent, hierarchy, hierarchy.Caption, filename, libraryNodeType);
 }