Ejemplo n.º 1
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            NamespaceData ns = (NamespaceData)dataObject;

            nodeInfo.Label = GLib.Markup.EscapeText(ns.Name);
            nodeInfo.Icon  = Context.GetIcon(MonoDevelop.Ide.Gui.Stock.NameSpace);
        }
Ejemplo n.º 2
0
        public List <ReferenceSegment> Disassemble(TextEditor data, ITreeNavigator navigator)
        {
            //	bool publicOnly = Widget.PublicApiOnly;
            NamespaceData ns = (NamespaceData)navigator.DataItem;

            data.Text = "// " + ns.Name;
            return(null);
        }
Ejemplo n.º 3
0
        public Task <List <ReferenceSegment> > DisassembleAsync(TextEditor data, ITreeNavigator navigator)
        {
            //	bool publicOnly = Widget.PublicApiOnly;
            NamespaceData ns = (NamespaceData)navigator.DataItem;

            data.Text = "// " + ns.Name;
            return(EmptyReferenceSegmentTask);
        }
Ejemplo n.º 4
0
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            var compilationUnit = (AssemblyLoader)dataObject;

            if (compilationUnit.Error != null)
            {
                treeBuilder.AddChild(compilationUnit.Error);
                return;
            }
            if (compilationUnit.Assembly == null)
            {
                return;
            }
            var references = new AssemblyReferenceFolder(compilationUnit.Assembly);

            if (references.AssemblyReferences.Any() || references.ModuleReferences.Any())
            {
                treeBuilder.AddChild(references);
            }

            var resources = new AssemblyResourceFolder(compilationUnit.Assembly);

            if (resources.Resources.Any())
            {
                treeBuilder.AddChild(resources);
            }

            var  namespaces = new Dictionary <string, NamespaceData> ();
            bool publicOnly = Widget.PublicApiOnly;

            foreach (var type in compilationUnit.DecompilerTypeSystem.MainModule.TypeDefinitions)
            {
                string namespaceName = string.IsNullOrEmpty(type.Namespace) ? "" : type.Namespace;
                if (!namespaces.ContainsKey(namespaceName))
                {
                    namespaces [namespaceName] = new NamespaceData(namespaceName);
                }

                var ns = namespaces [namespaceName];
                ns.Types.Add((type.IsPublic(), type));
            }

            treeBuilder.AddChildren(namespaces.Where(ns => ns.Key != "" && (!publicOnly || ns.Value.Types.Any(t => t.isPublic))).Select(n => n.Value));
            if (namespaces.ContainsKey(""))
            {
                foreach (var child in namespaces[""].Types)
                {
                    if (((INamedElement)child.typeObject).Name == "<Module>")
                    {
                        continue;
                    }
                    treeBuilder.AddChild(child);
                }
            }
        }
Ejemplo n.º 5
0
        public override void BuildChildNodes(ITreeBuilder ctx, object dataObject)
        {
            NamespaceData ns = (NamespaceData)dataObject;

            IEnumerable <object> result = ns.Types;

            if (Widget.PublicApiOnly)
            {
                result = result.Where(x => NamespaceData.IsPublic(x));
            }

            ctx.AddChildren(result);
        }
Ejemplo n.º 6
0
        public override void BuildChildNodes(ITreeBuilder ctx, object dataObject)
        {
            NamespaceData ns         = (NamespaceData)dataObject;
            bool          publicOnly = Widget.PublicApiOnly;

            foreach (var type in ns.Types)
            {
                if (publicOnly && !type.isPublic)
                {
                    continue;
                }
                ctx.AddChild(type.typeObject);
            }
        }
Ejemplo n.º 7
0
        public static void FillNamespaces(ITreeBuilder builder, Project project, Microsoft.CodeAnalysis.INamespaceSymbol ns)
        {
            var members = ns.GetTypeMembers();

            //IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project);
            if (members.Any())
            {
                var data = new NamespaceData(ns.Name);
                foreach (var member in members)
                {
                    data.Types.Add((member.DeclaredAccessibility == Microsoft.CodeAnalysis.Accessibility.Public, member));
                }
                builder.AddChild(data);
            }
            foreach (var nSpace in ns.GetNamespaceMembers())
            {
                FillNamespaces(builder, project, nSpace);
            }
        }
Ejemplo n.º 8
0
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            var assemblyLoader = (AssemblyLoader)dataObject;

            if (assemblyLoader.Error != null)
            {
                treeBuilder.AddChild(assemblyLoader.Error);
                return;
            }
            if (assemblyLoader.Assembly == null)
            {
                return;
            }
            var references = new AssemblyReferenceFolder(assemblyLoader.Assembly);

            if (references.AssemblyReferences.Any() || references.ModuleReferences.Any())
            {
                treeBuilder.AddChild(references);
            }

            var resources = new AssemblyResourceFolder(assemblyLoader.Assembly);

            if (resources.Resources.Any())
            {
                treeBuilder.AddChild(resources);
            }

            var mainModule = assemblyLoader.DecompilerTypeSystem.MainModule;
            var rootData   = new NamespaceData(mainModule.RootNamespace);

            if (rootData.Types.Length > 0)
            {
                treeBuilder.AddChild(rootData);
            }

            var allNamespaces = new List <NamespaceData> (32);

            CollectNamespaces(allNamespaces, mainModule.RootNamespace.ChildNamespaces);
            treeBuilder.AddChildren(allNamespaces);
        }
Ejemplo n.º 9
0
        public override string GetNodeName(ITreeNavigator thisNode, object dataObject)
        {
            NamespaceData ns = (NamespaceData)dataObject;

            return(ns.Name);
        }