CombineEntry CreateCombineEntry(Combine parentCombine, bool createCombine)
        {
            CombineEntry res = null;
            NewProjectDialog npdlg = new NewProjectDialog (createCombine);
            if (npdlg.Run () == (int) Gtk.ResponseType.Ok) {
                IProgressMonitor monitor = Runtime.TaskService.GetLoadProgressMonitor ();
                try {
                    if (createCombine)
                        res = parentCombine.AddEntry (npdlg.NewCombineLocation, monitor);
                    else
                        res = parentCombine.AddEntry (npdlg.NewProjectLocation, monitor);
                }
                catch {
                    Runtime.MessageService.ShowError (string.Format (GettextCatalog.GetString ("The file '{0}' could not be loaded."), npdlg.NewProjectLocation));
                    res = null;
                }
                monitor.Dispose ();
            }

            npdlg = null;

            if (res != null)
                SaveCombine ();

            return res;
        }
        public string CreateEntry(ProjectCreateInformation projectCreateInformation, string defaultLanguage)
        {
            Combine newCombine     = new Combine();
            string  newCombineName = Runtime.StringParserService.Parse(name, new string[,] {
                {"ProjectName", projectCreateInformation.ProjectName}
            });

            newCombine.Name = newCombineName;

            string oldCombinePath = projectCreateInformation.CombinePath;
            string oldProjectPath = projectCreateInformation.ProjectBasePath;
            if (relativeDirectory != null && relativeDirectory.Length > 0 && relativeDirectory != ".") {
                projectCreateInformation.CombinePath     = projectCreateInformation.CombinePath + Path.DirectorySeparatorChar + relativeDirectory;
                projectCreateInformation.ProjectBasePath = projectCreateInformation.CombinePath + Path.DirectorySeparatorChar + relativeDirectory;
                if (!Directory.Exists(projectCreateInformation.CombinePath)) {
                    Directory.CreateDirectory(projectCreateInformation.CombinePath);
                }
                if (!Directory.Exists(projectCreateInformation.ProjectBasePath)) {
                    Directory.CreateDirectory(projectCreateInformation.ProjectBasePath);
                }
            }

            // Create sub projects
            foreach (ICombineEntryDescriptor entryDescriptor in entryDescriptors) {
                newCombine.AddEntry (entryDescriptor.CreateEntry (projectCreateInformation, defaultLanguage), null);
            }

            projectCreateInformation.CombinePath = oldCombinePath;
            projectCreateInformation.ProjectBasePath = oldProjectPath;

            // Save combine
            using (IProgressMonitor monitor = Runtime.TaskService.GetSaveProgressMonitor ()) {
                string combineLocation = Runtime.FileUtilityService.GetDirectoryNameWithSeparator(projectCreateInformation.CombinePath) + newCombineName + ".mds";
                if (File.Exists(combineLocation)) {
                    IMessageService messageService =(IMessageService)ServiceManager.GetService(typeof(IMessageService));
                    if (messageService.AskQuestion(String.Format (GettextCatalog.GetString ("Solution file {0} already exists, do you want to overwrite\nthe existing file ?"), combineLocation))) {
                        newCombine.Save (combineLocation, monitor);
                    }
                } else {
                    newCombine.Save (combineLocation, monitor);
                }

                newCombine.Dispose();
                return combineLocation;
            }
        }
        public CombineEntry AddCombineEntry(Combine parentCombine)
        {
            CombineEntry res = null;

            using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Add to Solution"))) {
                fdiag.SelectMultiple = false;
                if (fdiag.Run () == (int) Gtk.ResponseType.Ok) {
                    try {
                        using (IProgressMonitor monitor = Runtime.TaskService.GetLoadProgressMonitor ()) {
                            res = parentCombine.AddEntry (fdiag.Filename, monitor);
                        }
                    }
                    catch {
                        Runtime.MessageService.ShowError (string.Format (GettextCatalog.GetString ("The file '{0}' could not be loaded."), fdiag.Filename));
                    }
                }

                fdiag.Hide ();
            }
            if (res != null)
                SaveCombine ();

            return res;
        }