Ejemplo n.º 1
0
//		string startupProject = null;

        public string CreateProject(ProjectCreateInformation projectCreateInformation)
        {
            if (wizardpath != null)
            {
                Properties customizer = new Properties();
                customizer.Set("ProjectCreateInformation", projectCreateInformation);
                customizer.Set("ProjectTemplate", this);
                WizardDialog wizard = new WizardDialog("Project Wizard", customizer, wizardpath);
                if (wizard.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) != DialogResult.OK)
                {
                    return(null);
                }
            }
            if (combineDescriptor != null)
            {
                return(combineDescriptor.CreateSolution(projectCreateInformation, this.languagename));
            }
            else if (projectDescriptor != null)
            {
                projectCreateInformation.Solution = new Solution();
                return(projectDescriptor.CreateProject(projectCreateInformation, this.languagename).FileName);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
//		string startupProject = null;

        public string CreateProject(ProjectCreateInformation projectCreateInformation)
        {
            LoggingService.Info("Creating project from template '" + this.Category + "/" + this.Subcategory + "/" + this.Name + "'");
            if (wizardpath != null)
            {
                Properties customizer = new Properties();
                customizer.Set("ProjectCreateInformation", projectCreateInformation);
                customizer.Set("ProjectTemplate", this);
                WizardDialog wizard = new WizardDialog("Project Wizard", customizer, wizardpath);
                if (wizard.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) != DialogResult.OK)
                {
                    return(null);
                }
            }
            if (solutionDescriptor != null)
            {
                return(solutionDescriptor.CreateSolution(projectCreateInformation, this.languagename));
            }
            else if (projectDescriptor != null)
            {
                bool createNewSolution = projectCreateInformation.Solution == null;
                if (createNewSolution)
                {
                    projectCreateInformation.Solution          = new Solution();
                    projectCreateInformation.Solution.Name     = projectCreateInformation.SolutionName;
                    projectCreateInformation.Solution.FileName = Path.Combine(projectCreateInformation.SolutionPath, projectCreateInformation.SolutionName + ".sln");
                }
                IProject project = projectDescriptor.CreateProject(projectCreateInformation, this.languagename);
                if (project != null)
                {
                    string solutionLocation = projectCreateInformation.Solution.FileName;
                    if (createNewSolution)
                    {
                        projectCreateInformation.Solution.AddFolder(project);
                        projectCreateInformation.Solution.Save();
                        ProjectService.OnSolutionCreated(new SolutionEventArgs(projectCreateInformation.Solution));
                        projectCreateInformation.Solution.Dispose();
                    }
                    else
                    {
                        project.Dispose();
                    }
                    return(solutionLocation);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
//		string startupProject = null;

        public string CreateProject(ProjectCreateInformation projectCreateInformation)
        {
            LoggingService.Info("Creating project from template '" + this.Category + "/" + this.Subcategory + "/" + this.Name + "'");
            if (solutionDescriptor != null)
            {
                return(solutionDescriptor.CreateSolution(projectCreateInformation, this.languagename));
            }
            else if (projectDescriptor != null)
            {
                bool createNewSolution = projectCreateInformation.Solution == null;
                if (createNewSolution)
                {
                    string fileName = Path.Combine(projectCreateInformation.SolutionPath, projectCreateInformation.SolutionName + ".sln");
                    projectCreateInformation.Solution          = new Solution(new ProjectChangeWatcher(fileName));
                    projectCreateInformation.Solution.Name     = projectCreateInformation.SolutionName;
                    projectCreateInformation.Solution.FileName = fileName;
                }
                IProject project = projectDescriptor.CreateProject(projectCreateInformation, this.languagename);
                if (project != null)
                {
                    string solutionLocation = projectCreateInformation.Solution.FileName;
                    if (createNewSolution)
                    {
                        projectCreateInformation.Solution.AddFolder(project);
                        projectCreateInformation.Solution.FixSolutionConfiguration(new IProject[] { project });
                        projectCreateInformation.Solution.Save();
                        ProjectService.OnSolutionCreated(new SolutionEventArgs(projectCreateInformation.Solution));
                        projectCreateInformation.Solution.Dispose();
                    }
                    else
                    {
                        project.Dispose();
                    }
                    return(solutionLocation);
                }
                else
                {
                    if (createNewSolution)
                    {
                        projectCreateInformation.Solution.Dispose();
                    }
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }