/// <summary>
      /// Loads reference items from the project file into the hierarchy.
      /// </summary>
      protected internal override void ProcessReferences()
      {
          base.ProcessReferences();
          IEnumerable <ProjectItem> references = ProjectMgr.BuildProject.GetItems("TestSuite");

          foreach (ProjectItem item in references)
          {
              var element = new ProjectElement(ProjectMgr, item, false);

              string        title         = element.GetMetadata("Title");
              TestSuiteNode testSuiteNode = new TestSuiteNode(this, title);
              AddChild(testSuiteNode);

              IEnumerable <ProjectItem> testcases = ProjectMgr.BuildProject.GetItems("TestCase");

              foreach (ProjectItem testcase in testcases)
              {
                  var testcaseElement = new ProjectElement(ProjectMgr, testcase, false);

                  string testsuite = testcaseElement.GetMetadata("TestSuite");
                  if (testsuite == element.Item.EvaluatedInclude)
                  {
                      string       TestCaseNodetitle = testcaseElement.GetMetadata("Title");
                      TestCaseNode testCaseNode      = new TestCaseNode(this, TestCaseNodetitle);
                      testSuiteNode.AddChild(testCaseNode);
                  }
              }
          }
      }
Ejemplo n.º 2
0
        /// <summary>
        /// Create my file nodes that know about the file
        /// </summary>
        /// <param name="item">msbuild item</param>
        /// <returns>FileNode added</returns>
        public override FileNode CreateFileNode(ProjectElement item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            DelphiFileNode lNewNode;
            string         include = item.GetMetadata(ProjectFileConstants.Include);

            if (DelphiProjectFileNode.IsDelphiProjectFile(include))
            {
                lNewNode = new DelphiProjectFileNode(this, item);
            }
            else if (DelphiPackageFileNode.IsDelphiProjectFile(include))
            {
                lNewNode = new DelphiPackageFileNode(this, item);
            }
            else
            {
                lNewNode = new DelphiFileNode(this, item);
            }
            lNewNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            lNewNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);

            lNewNode.OnAfterDelphiUnitRename += new AfterDelphiUnitRename(AfterDelphiUnitRenameEvent);
            lNewNode.OnAfterFileRename       += new AfterFileRename(AfterFileRenameEvent);

            return(lNewNode);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a file node based on an msbuild item.
        /// </summary>
        /// <param name="item">The msbuild item to be analyzed</param>
        public override FileNode CreateFileNode(ProjectElement item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            CommonFileNode newNode;

            if (string.Compare(GetCodeFileExtension(), Path.GetExtension(item.GetFullPathForElement()), StringComparison.OrdinalIgnoreCase) == 0)
            {
                newNode = CreateCodeFileNode(item);
            }
            else
            {
                newNode = CreateNonCodeFileNode(item);
            }
            string include = item.GetMetadata(ProjectFileConstants.Include);

            newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project),
                                                  new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
            newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.ServiceCreator, false);
            if (!string.IsNullOrEmpty(include) && Path.GetExtension(include).Equals(".xaml", StringComparison.OrdinalIgnoreCase))
            {
                //Create a DesignerContext for the XAML designer for this file
                newNode.OleServiceProvider.AddService(typeof(DesignerContext), newNode.ServiceCreator, false);
            }

            newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject),
                                                  new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
            return(newNode);
        }
Ejemplo n.º 4
0
        //=====================================================================

        /// <summary>
        /// This is used to set the Image project element metadata
        /// </summary>
        /// <param name="element">The project element to update</param>
        public static void SetImageMetadata(this ProjectElement element)
        {
            string baseName = Path.GetFileNameWithoutExtension(element.GetMetadata(ProjectFileConstants.Include));

            if (String.IsNullOrEmpty(element.GetMetadata(SandcastleBuildItemMetadata.ImageId)))
            {
                element.SetMetadata(SandcastleBuildItemMetadata.ImageId, baseName);
            }

            if (String.IsNullOrEmpty(element.GetMetadata(SandcastleBuildItemMetadata.AlternateText)))
            {
                baseName = baseName.Replace("_", " ");
                element.SetMetadata(SandcastleBuildItemMetadata.AlternateText,
                                    reInsertSpaces.Replace(baseName, " $&").Trim());
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Create a file node based on an msbuild item.
        /// </summary>
        /// <param name="item">The msbuild item to be analyzed</param>
        /// <returns>PythonFileNode or FileNode</returns>
        public override FileNode CreateFileNode(ProjectElement item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            string         include = item.GetMetadata(ProjectFileConstants.Include);
            PythonFileNode newNode = new PythonFileNode(this, item);

            newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.ServiceCreator, false);
            if (!string.IsNullOrEmpty(include) && Path.GetExtension(include).Equals(".xaml", StringComparison.OrdinalIgnoreCase))
            {
                //Create a DesignerContext for the XAML designer for this file
                newNode.OleServiceProvider.AddService(typeof(DesignerContext), newNode.ServiceCreator, false);
            }
            newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            if (IsCodeFile(include))
            {
                newNode.OleServiceProvider.AddService(
                    typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            }

            return(newNode);
        }
        /// <summary>
        /// Creates a file node for a project element.
        /// </summary>
        /// <param name="element">The project element.</param>
        /// <returns>An instance of the <see cref="DependentFileNode"/> class.</returns>
        public override DependentFileNode CreateDependentFileNode(ProjectElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            string subType = element.GetMetadata(ProjectFileConstants.SubType);

            if (subType == MultiverseInterfaceSubType.Code)
            {
                DependentFileNode node = new MultiverseInterfaceIronPythonDependentFileNode(this, element);

                IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService));

                // Make sure the language service is available
                if (languageService != null)
                {
                    languageService.AddPythonFile(node.GetMkDocument());
                }

                return(node);
            }

            return(base.CreateDependentFileNode(element));
        }
Ejemplo n.º 7
0
        public DartFolderNode(ProjectNode root, string relativePath, ProjectElement element)
            : base(root, relativePath, element)
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }
            if (relativePath == null)
            {
                throw new ArgumentNullException("relativePath");
            }
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            if (element.IsVirtual)
            {
                string buildAction = element.GetMetadata(ProjectFileConstants.BuildAction);
                if (buildAction == ProjectFileConstants.Folder)
                {
                    this.IsNonmemberItem = false;
                }
            }
        }
        /// <summary>
        /// Creates a file node for a project element.
        /// </summary>
        /// <param name="element">The project element.</param>
        /// <returns>An instance of the <see cref="FileNode"/> class.</returns>
        public override FileNode CreateFileNode(ProjectElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            MultiverseInterfaceFileNode node = null;

            // Get the SubType for the project element.
            string subType = element.GetMetadata(ProjectFileConstants.SubType);

            switch (subType)
            {
            case MultiverseInterfaceSubType.Code:
                node = new MultiverseInterfacePythonFileNode(this, element);
                break;

            case MultiverseInterfaceSubType.Frame:
                node = new MultiverseInterfaceXmlFileNode(this, element);
                break;

            case MultiverseInterfaceSubType.TableOfContents:
                node = new MultiverseInterfaceTocFileNode(this, element);
                break;

            default:
                // We could not recognize the file subtype, just create a WowFileNode
                node = new MultiverseInterfaceFileNode(this, element);
                break;
            }

            // Check whether this file should be added to the language service
            if (subType == MultiverseInterfaceSubType.Frame || subType == MultiverseInterfaceSubType.Code)
            {
                IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService));

                // Make sure the language service is available
                if (languageService != null)
                {
                    switch (subType)
                    {
                    case MultiverseInterfaceSubType.Frame:
                        languageService.AddFrameXmlFile(node.GetMkDocument());
                        break;

                    case MultiverseInterfaceSubType.Code:
                        languageService.AddPythonFile(node.GetMkDocument());
                        break;
                    }
                }
            }

            return(node);
        }
        /// <summary>
        /// Adds the pre defined node.
        /// </summary>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <param name="testSuiteNode">
        /// The test suite node.
        /// </param>
        private void AddPreDefinedNode(ProjectElement element, DTTestSuiteNode testSuiteNode)
        {
            Logger.Enter(this, this.ProjectFile, "AddPreDefinedNode");

            IEnumerable <ProjectItem> deviceFunctions = this.ProjectMgr.BuildProject.GetItems("PreDefined");

            foreach (ProjectItem df in deviceFunctions)
            {
                var deviceFunctionElement = new ProjectElement(this.ProjectMgr, df, false);

                var testsuite = deviceFunctionElement.GetMetadata("RootFolder");
                if (testsuite == element.Item.EvaluatedInclude)
                {
                    var testCaseNodetitle = deviceFunctionElement.GetMetadata("Title");
                    var compilerVariable  = deviceFunctionElement.GetMetadata("CompilerVariable");

                    var testCaseNode = new DTPreDefineNode(this, testCaseNodetitle, compilerVariable, true);
                    testSuiteNode.AddChild(testCaseNode);
                }
            }
        }
Ejemplo n.º 10
0
        public override DependentFileNode CreateDependentFileNode(ProjectElement item)
        {
            DependentFileNode node = base.CreateDependentFileNode(item);

            if (null != node)
            {
                string include = item.GetMetadata(ProjectFileConstants.Include);
                if (IsCodeFile(include))
                {
                    node.OleServiceProvider.AddService(
                        typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
                }
            }

            return(node);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Creates the file node.
        /// </summary>
        /// <param name="item">The project element item.</param>
        /// <returns></returns>
        public override FileNode CreateFileNode(ProjectElement item)
        {
            var node = new BooFileNode(this, item);

            node.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
            node.OleServiceProvider.AddService(typeof(ProjectItem), node.ServiceCreator, false);
            node.OleServiceProvider.AddService(typeof(VSProject), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
            compilerManager.SubmitForCompile(node);
            var include = item.GetMetadata(ProjectFileConstants.Include);

            if (IsCodeFile(include))
            {
                node.OleServiceProvider.AddService(typeof(SVSMDCodeDomProvider), node.ServiceCreator, false);
            }
            return(node);
        }
Ejemplo n.º 12
0
        public JavaFolderNode(ProjectNode root, string relativePath, ProjectElement element)
            : base(root, relativePath, element)
        {
            Contract.Requires(root != null);
            Contract.Requires(relativePath != null);
            Contract.Requires(element != null);

            if (element.IsVirtual)
            {
                string buildAction = element.GetMetadata(ProjectFileConstants.BuildAction);
                if (buildAction == ProjectFileConstants.Folder)
                {
                    this.IsNonmemberItem = false;
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Create a file node based on an msbuild item.
        /// </summary>
        /// <param name="item">The msbuild item to be analyzed</param>
        /// <returns>FoxProFileNode or FileNode</returns>
        public override FileNode CreateFileNode(ProjectElement item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            string         include = item.GetMetadata(ProjectFileConstants.Include);
            FoxProFileNode newNode = new FoxProFileNode(this, item);

            newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.ServiceCreator, false);
            newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            if (IsCodeFile(include))
            {
                newNode.OleServiceProvider.AddService(
                    typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
            }

            return(newNode);
        }
        /// <summary>
        /// Processes the folders.
        /// </summary>
        protected internal override void ProcessFolders()
        {
            Logger.Enter(this, this.ProjectFile, "ProcessFolders");

            base.ProcessFolders();

            IEnumerable <ProjectItem> deviceFunctionsFolder = this.ProjectMgr.BuildProject.GetItems("DeviceFunctionsFolder");

            foreach (ProjectItem deviceFunctionFolder in deviceFunctionsFolder)
            {
                var element = new ProjectElement(this.ProjectMgr, deviceFunctionFolder, false);

                var title         = element.GetMetadata("Title");
                var testSuiteNode = new DTTestSuiteNode(this, title);
                this.AddChild(testSuiteNode);

                this.AddDeviceFunctionNode(element, testSuiteNode);

                this.AddPreDefinedNode(element, testSuiteNode);
            }
        }
Ejemplo n.º 15
0
 public TrackedFileNode(RustProjectNode root, ProjectElement elm)
     : base(root, elm, elm.GetMetadata(ProjectFileConstants.Include))
 {
 }