public static CompilationUnitSyntax Generate(XDocument vsctDocument, string desiredNamespaceName)
        {
            VisualStudioWorkspace componentModelService = Services.GetComponentModelService <VisualStudioWorkspace>();

            return((CompilationUnitSyntax)Formatter.Format(SyntaxFactory.CompilationUnit().WithUsings(SyntaxFactory.List <UsingDirectiveSyntax>(new UsingDirectiveSyntax[3]
            {
                SyntaxNodeExtensions.WithLeadingTrivia(Usings.System, GenerateAutoGeneratedHeader()),
                Usings.SystemComponentModelDesign,
                Usings.MicrosoftVisualStudioShell
            })).AddMembers(new MemberDeclarationSyntax[1]
            {
                SyntaxFactory.NamespaceDeclaration(SyntaxFactory.IdentifierName(desiredNamespaceName)).AddMembers(new MemberDeclarationSyntax[1]
                {
                    ClassGenerator.GeneratePackageGuidsClass(vsctDocument)
                }).AddMembers(new MemberDeclarationSyntax[1]
                {
                    ClassGenerator.GeneratePackageIdsClass(vsctDocument)
                }).AddMembers(new MemberDeclarationSyntax[1]
                {
                    ClassGenerator.GenerateCommandIdsClass(vsctDocument)
                }).AddMembers(new MemberDeclarationSyntax[1]
                {
                    ClassGenerator.GenerateAbstractCommandFacadeClass(vsctDocument)
                }).AddMembers(new MemberDeclarationSyntax[1]
                {
                    ClassGenerator.GenerateCommandFacadeClass()
                }).AddMembers(new MemberDeclarationSyntax[1]
                {
                    ClassGenerator.GenerateCommandRegistrarClass(vsctDocument)
                })
            }), componentModelService, null, new CancellationToken()));
        }
        public static ClassDeclarationSyntax GenerateAbstractCommandFacadeClass(XDocument vsctDocument)
        {
            SyntaxList <MemberDeclarationSyntax> syntaxList = SyntaxFactory.List <MemberDeclarationSyntax>();

            syntaxList = @syntaxList.Add(ClassGenerator.GenerateProtectedConstructor("AbstractCommandFacade"));
            XElement xelement = vsctDocument.Root.Element(XNames.Commands).Element(XNames.Buttons);

            if (xelement != null && xelement.HasElements)
            {
                foreach (XElement element in xelement.Elements(XNames.Button))
                {
                    string id           = element.Attribute("id").Value;
                    string commandName1 = NameMaker.MakeExecuteCommandMethodName(id);
                    string commandName2 = NameMaker.MakeBeforeQueryStatusMethodName(id);
                    syntaxList = @syntaxList.Add(MethodGenerator.GenerateFacadeCommandMethod(commandName1));
                    syntaxList = @syntaxList.Add(MethodGenerator.GenerateFacadeCommandMethod(commandName2));
                }
            }
            return(SyntaxFactory.ClassDeclaration("AbstractCommandFacade")
                   .WithModifiers(Modifiers.InternalAbstractPartial)
                   .WithMembers(syntaxList)
                   .NormalizeWhitespace());
        }