Exemplo n.º 1
0
        public override void Run()
        {
            TreeNode node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;

            while (node != null && !(node is ISolutionFolderNode))
            {
                node = node.Parent;
            }
            ISolutionFolderNode solutionFolderNode = node as ISolutionFolderNode;

            if (node != null)
            {
                using (NewProjectDialog npdlg = new NewProjectDialog(false)) {
                    npdlg.InitialProjectLocationDirectory = GetInitialDirectorySuggestion(solutionFolderNode);

                    // show the dialog to request project type and name
                    if (npdlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWin32Window) == DialogResult.OK)
                    {
                        if (npdlg.NewProjectLocation.Length == 0)
                        {
                            MessageService.ShowError("No project has been created, there is nothing to add.");
                            return;
                        }
                        AddExitingProjectToSolution.AddProject(solutionFolderNode, npdlg.NewProjectLocation);
                        ProjectService.SaveSolution();
                    }
                }
            }
        }
        public override void Run()
        {
            AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;
            ISolutionFolderNode            solutionFolderNode = node as ISolutionFolderNode;

            if (node != null)
            {
                using (NewProjectDialog npdlg = new NewProjectDialog(false)) {
                    npdlg.InitialProjectLocationDirectory = GetInitialDirectorySuggestion(solutionFolderNode);

                    // show the dialog to request project type and name
                    if (npdlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK)
                    {
                        if (npdlg.NewProjectLocation.Length == 0)
                        {
                            MessageService.ShowError("No project has been created, there is nothing to add.");
                            return;
                        }
                        AddExitingProjectToSolution.AddProject(solutionFolderNode, npdlg.NewProjectLocation);
                        ProjectService.SaveSolution();

                        if (SDLite.UpdateInfo.ExpandNewProjectByDefaut)
                        {
                            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

                            if (window != null && window.ActiveViewContent != null)
                            {
                                ProjectBrowserPad.Instance.ProjectBrowserControl.SelectFile(window.ActiveViewContent.PrimaryFileName);
                            }

                            node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;

                            if (node is ProjectNode)
                            {
                                node.Expand();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void Run()
        {
            AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;
            ISolutionFolderNode            solutionFolderNode = node as ISolutionFolderNode;

            if (node != null)
            {
                using (NewProjectDialog npdlg = new NewProjectDialog(false)) {
                    if (npdlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK)
                    {
                        if (npdlg.NewProjectLocation.Length == 0)
                        {
                            MessageService.ShowError("No project has been created, there is nothing to add.");
                            return;
                        }
                        AddExitingProjectToSolution.AddProject(solutionFolderNode, npdlg.NewProjectLocation);
                        ProjectService.SaveSolution();
                    }
                }
            }
        }