protected override string ShowBrowseDialog(string name, string start_in)
        {
            FileSelector fd = new FileSelector (name);
            if (start_in != null)
                fd.SetFilename (start_in);

            int response = fd.Run ();

            if (response == (int) ResponseType.Ok) {
                fd.Hide ();
                return fd.Filename;
            }

            fd.Hide ();

            return null;
        }
        protected override void Run()
        {
            foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
                if (content.IsViewOnly) {
                    continue;
                }

                if (content.ContentName == null)
                {
                    using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save File As...")))
                    {
                        fdiag.SetFilename (System.Environment.GetEnvironmentVariable ("HOME"));
                        if (fdiag.Run () == (int) Gtk.ResponseType.Ok)
                        {
                            string fileName = fdiag.Filename;

                            // currently useless
                            if (Path.GetExtension(fileName).StartsWith("?") || Path.GetExtension(fileName) == "*")
                            {
                                fileName = Path.ChangeExtension(fileName, "");
                            }

                            if (Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(content.Save), fileName) == FileOperationResult.OK)
                            {
                                Runtime.MessageService.ShowMessage(fileName, GettextCatalog.GetString ("File saved"));
                            }
                        }

                        fdiag.Hide ();
                    }
                }
                else
                {
                    Runtime.FileUtilityService.ObservedSave (new FileOperationDelegate(content.Save), content.ContentName);
                }
            }
        }
        public void SaveFileAs(IWorkbenchWindow window)
        {
            if (window.ViewContent is ICustomizedCommands) {
                if (((ICustomizedCommands)window.ViewContent).SaveAsCommand()) {
                    return;
                }
            }

            FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save as..."), Gtk.FileChooserAction.Save);
            fdiag.SetFilename (window.ViewContent.ContentName);
            int response = fdiag.Run ();
            string filename = fdiag.Filename;
            fdiag.Hide ();

            if (response == (int)Gtk.ResponseType.Ok) {
                if (!Runtime.FileUtilityService.IsValidFileName (filename)) {
                    Runtime.MessageService.ShowMessage(String.Format (GettextCatalog.GetString ("File name {0} is invalid"), filename));
                    return;
                }
                // detect preexisting file
                if(File.Exists(filename)){
                    if(!Runtime.MessageService.AskQuestion(String.Format (GettextCatalog.GetString ("File {0} already exists.  Overwrite?"), filename))){
                        return;
                    }
                }
                // save backup first
                if((bool) Runtime.Properties.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
                    Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), filename + "~");
                }

                // do actual save
                if (Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), filename) == FileOperationResult.OK) {
                    Runtime.FileService.RecentOpen.AddLastFile (filename, null);
                }
            }
        }
        string[] AskFiles(Project project)
        {
            using (FileSelector fs = new FileSelector (GettextCatalog.GetString ("File to Open"))) {
                fs.SelectMultiple = true;
                fs.SetFilename (project.BaseDirectory);
                int response = fs.Run ();
                string [] files = fs.Filenames;
                fs.Hide ();

                if (response != (int)Gtk.ResponseType.Ok)
                    return null;
                else
                    return files;
            }
        }