protected internal void RunVsTemplateWizard(ProjectElement element, bool silent)
        {
            ProjectElement elementToUse = (element == null) ? this.nestedProjectElement : element;

            if (elementToUse == null)
            {
                throw new ArgumentNullException("element");
            }
            this.nestedProjectElement = elementToUse;

            Automation.OAProject oaProject = GetAutomationObject() as Automation.OAProject;
            if (oaProject == null || oaProject.ProjectItems == null)
            {
                throw new System.InvalidOperationException(SR.GetString(SR.InvalidAutomationObject, CultureInfo.CurrentUICulture));
            }
            Debug.Assert(oaProject.Object != null, "The project automation object should have set the Object to the SolutionFolder");
            Automation.OASolutionFolder <ProjectContainerNode> folder = oaProject.Object as Automation.OASolutionFolder <ProjectContainerNode>;

            // Prepare the parameters to pass to RunWizardFile
            string destination = elementToUse.GetFullPathForElement();
            string template    = this.GetProjectTemplatePath(elementToUse);

            object[] wizParams = new object[7];
            wizParams[0] = EnvDTE.Constants.vsWizardAddSubProject;
            wizParams[1] = Path.GetFileNameWithoutExtension(destination);
            wizParams[2] = oaProject.ProjectItems;
            wizParams[3] = Path.GetDirectoryName(destination);
            wizParams[4] = Path.GetFileNameWithoutExtension(destination);
            wizParams[5] = Path.GetDirectoryName(folder.DTE.FullName);             //VS install dir
            wizParams[6] = silent;

            IVsDetermineWizardTrust wizardTrust = this.GetService(typeof(SVsDetermineWizardTrust)) as IVsDetermineWizardTrust;

            if (wizardTrust != null)
            {
                Guid guidProjectAdding = Guid.Empty;

                // In case of a project template an empty guid should be added as the guid parameter. See env\msenv\core\newtree.h IsTrustedTemplate method definition.
                wizardTrust.OnWizardInitiated(template, ref guidProjectAdding);
            }

            try
            {
                // Make the call to execute the wizard. This should cause AddNestedProjectFromTemplate to be
                // called back with the correct set of parameters.
                EnvDTE.IVsExtensibility extensibilityService = (EnvDTE.IVsExtensibility)GetService(typeof(EnvDTE.IVsExtensibility));
                EnvDTE.wizardResult     result = extensibilityService.RunWizardFile(template, 0, ref wizParams);
                if (result == EnvDTE.wizardResult.wizardResultFailure)
                {
                    throw new COMException();
                }
            }
            finally
            {
                if (wizardTrust != null)
                {
                    wizardTrust.OnWizardCompleted();
                }
            }
        }
        /// <summary>
        /// Let the wizard code execute and provide us the information we need.
        /// Our SolutionFolder automation object should be called back with the
        /// details at which point it will call back one of our method to add
        /// a nested project.
        /// If you are trying to add a new subproject this is probably the
        /// method you want to call. If you are just trying to clone a template
        /// project file, then AddNestedProjectFromTemplate is what you want.
        /// </summary>
        protected internal void RunVsTemplateWizard(ProjectElement element, bool silent)
        {
            ProjectElement elementToUse = (element == null) ? this.nestedProjectElement : element;

            if (elementToUse == null)
            {
                throw new ArgumentNullException("element");
            }
            this.nestedProjectElement = elementToUse;

            Automation.OAProject oaProject = GetAutomationObject() as Automation.OAProject;
            if (oaProject == null || oaProject.ProjectItems == null)
            {
                throw new System.InvalidOperationException(SR.GetString(SR.InvalidAutomationObject));
            }
            Debug.Assert(oaProject.Object != null, "The project automation object should have set the Object to the SolutionFolder");
            Automation.OASolutionFolder <ProjectContainerNode> folder = oaProject.Object as Automation.OASolutionFolder <ProjectContainerNode>;

            // Prepare the parameters to pass to RunWizardFile
            string destination = elementToUse.GetFullPathForElement();
            string template    = this.GetProjectTemplatePath(elementToUse);

            object[] wizParams = new object[7];
            wizParams[0] = EnvDTE.Constants.vsWizardAddSubProject;
            wizParams[1] = Path.GetFileNameWithoutExtension(destination);
            wizParams[2] = oaProject.ProjectItems;
            wizParams[3] = Path.GetDirectoryName(destination);
            wizParams[4] = Path.GetFileNameWithoutExtension(destination);
            wizParams[5] = Path.GetDirectoryName(folder.DTE.FullName);             //VS install dir
            wizParams[6] = silent;

            // Make the call to execute the wizard. This should cause AddNestedProjectFromTemplate to be
            // called back with the correct set of parameters.
            EnvDTE.IVsExtensibility extensibilityService = (EnvDTE.IVsExtensibility)GetService(typeof(EnvDTE.IVsExtensibility));
            EnvDTE.wizardResult     result = extensibilityService.RunWizardFile(template, 0, ref wizParams);
            if (result == EnvDTE.wizardResult.wizardResultFailure)
            {
                throw new COMException();
            }
        }
示例#3
0
 /// <include file='doc\Project.uex' path='docs/doc[@for="Project.Project"]/*' />
 public Project()
 {
     this.automation = new Automation.OAProject(this);
     Project.ProjectList.Add(automation);
     this.hierarchyId = NativeMethods.VSITEMID_ROOT;
     // Load the hierarchy icoBns... //TODO: call a virtual routine
     this.ImageList = GetImageList();
     this.configProvider = new ConfigProvider(this);
     this.Tracker = new TrackDocumentsHelper(this);
 }
 public OAReferenceFolderItem(OAProject proj, ReferenceContainerNode node)
     : base(proj, node)
 {
 }
示例#5
0
 /// <include file='doc\Automation.uex' path='docs/doc[@for="OAProjectItems.OAProjectItems"]/*' />
 public OAProjectItems(OAProject proj, ArrayList items, HierarchyNode node)
 {
     this.items = items;
     this.project = proj;
     this.node = node;
 }
示例#6
0
 /// <include file='doc\Automation.uex' path='docs/doc[@for="OAProjectItem.OAProjectItem"]/*' />
 public OAProjectItem(OAProject proj, HierarchyNode node)
 {
     this.node = node;
     this.project = proj;
     ArrayList list = new ArrayList();
     for (HierarchyNode child = node.FirstChild; child != null; child = child.NextSibling)
     {
         list.Add(new OAProjectItem(this.project, child));
     }
     this.items = new OAProjectItems(this.project, list, node);
 }
示例#7
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="project">The associated project.</param>
		/// <param name="items">A list of items that will make up the items defined by this object.</param>
		/// <param name="nodeWithItems">The node that defines the items.</param>
		public OANavigableProjectItems(OAProject project, IList<EnvDTE.ProjectItem> items, HierarchyNode nodeWithItems)
		{
			this.items = items;
			this.project = project;
			this.nodeWithItems = nodeWithItems;
		}
示例#8
0
 public OAProjectItem(OAProject project, T node)
 {
     this.node    = node;
     this.project = project;
 }
 public OAIronPythonFileItem(OAProject project, FileNode node)
     : base(project, node)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="proj">The associated project.</param>
 /// <param name="nodeWithItems">The node that defines the items.</param>
 public OANavigableProjectItems(OAProject proj, HierarchyNode nodeWithItems)
 {
     this.project       = proj;
     this.nodeWithItems = nodeWithItems;
     this.items         = this.GetListOfProjectItems();
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="proj">The associated project.</param>
 /// <param name="items">A list of items that will make up the items defined by this object.</param>
 /// <param name="nodeWithItems">The node that defines the items.</param>
 public OANavigableProjectItems(OAProject proj, IList <EnvDTE.ProjectItem> items, HierarchyNode nodeWithItems)
 {
     this.items         = items;
     this.project       = proj;
     this.nodeWithItems = nodeWithItems;
 }
示例#12
0
    /// <include file='doc\Project.uex' path='docs/doc[@for="Project.Close"]/*' />
    public override int Close(){
      Project.ProjectList.Remove(this.automation);
      automation = null;
      this.ClearLibraryReferences();
      this.ClearStaticReferencesToThis();
      UnregisterSccProject();
#if WHIDBEY
      // release the task manager
      if ((this.taskManager != null || this.taskManagerBuild != null) && Site != null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)Site.GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          if (this.taskManager != null)      taskManagerFactory.ReleaseSharedTaskManager(this.taskManager);
          if (this.taskManagerBuild != null) taskManagerFactory.ReleaseSharedTaskManager(this.taskManagerBuild);
        }
      }
      this.taskManager = null;
      this.taskManagerBuild = null;
#endif
      
      base.Close();
      if (this.taskProvider != null){
        this.taskProvider.Dispose();
        this.taskProvider = null;
      }
      this.Site = null;
      this.UIShell = null;
      return 0;
    }
示例#13
0
 /// <include file='doc\Automation.uex' path='docs/doc[@for="OAProjectItems.OAProjectItems"]/*' />
 public OAProjectItems(OAProject proj, ArrayList items, HierarchyNode node)
 {
     this.items   = items;
     this.project = proj;
     this.node    = node;
 }
示例#14
0
 public OAReferenceItem(OAProject proj, TEntryPointFileNode node)
     : base(proj, node)
 {
 }
示例#15
0
        /// <include file='doc\Project.uex' path='docs/doc[@for="Project.Close"]/*' />
        public override int Close()
        {
            Project.ProjectList.Remove(this.automation);
            this.automation = null;
            this.ClearLibraryReferences();
            NativeMethods.ThrowOnFailure(base.Close());
            if (this.taskProvider != null)
            {
                this.taskProvider.Dispose();
                this.taskProvider = null;
            }

            this.Site = null;
            this.UIShell = null;
            return NativeMethods.S_OK;
        }
 public OAProjectItems(OAProject project, HierarchyNode nodeWithItems)
     : base(project, nodeWithItems)
 {
 }
示例#17
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="project">The associated project.</param>
		/// <param name="nodeWithItems">The node that defines the items.</param>
		public OANavigableProjectItems(OAProject project, HierarchyNode nodeWithItems)
		{
			this.project = project;
			this.nodeWithItems = nodeWithItems;
			this.items = this.GetListOfProjectItems();
		}
示例#18
0
 public OAFolderItem(OAProject project, FolderNode node)
     : base(project, node)
 {
 }
示例#19
0
 public OAProjectItems(OAProject proj, HierarchyNode nodeWithItems)
     : base(proj, nodeWithItems)
 {
 }
示例#20
0
 public OAReferenceItem(OAProject project, ReferenceNode node)
     : base(project, node)
 {
 }
示例#21
0
 public OAFileItem(OAProject project, FileNode node)
     : base(project, node)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OAWowFileItem"/> class.
 /// </summary>
 /// <param name="project">The project automation object.</param>
 /// <param name="node">The node.</param>
 public OAWowFileItem(OAProject project, FileNode node)
     : base(project, node)
 {
 }