예제 #1
0
        /// <summary>Allows the user to browse the file system for a stylesheet.</summary>
        /// <returns>The stylesheet filename the user selected; otherwise null.</returns>
        public static string BrowseForStylesheetFile()
        {
            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select XSLT Stylesheet"))
            {
                TransientFor = IdeApp.Workbench.RootWindow,
            };

            dlg.AddFilter(new SelectFileDialogFilter(
                              GettextCatalog.GetString("XML Files"),
                              new string[] { "*.xml" },
                              new string[] { "text/xml", "application/xml" }
                              ));
            dlg.AddFilter(new SelectFileDialogFilter(
                              GettextCatalog.GetString("XSL Files"),
                              new string[] { "*.xslt", "*.xsl" },
                              new string[] { "text/x-xslt" }
                              ));
            dlg.AddAllFilesFilter();

            if (dlg.Run())
            {
                return(dlg.SelectedFile);
            }
            return(null);
        }
        public void Add()
        {
            var project = (DotNetProject)CurrentNode.GetParentDataItem(typeof(DotNetProject), true);
            var inrproj = project as INativeReferencingProject;

            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select Native Library"), Gtk.FileChooserAction.Open);

            dlg.SelectMultiple = true;
            dlg.AddAllFilesFilter();

            foreach (var filter in inrproj.NativeReferenceFileFilters)
            {
                dlg.AddFilter(filter.Description, "*" + filter.FileExtension);
            }

            if (!dlg.Run())
            {
                return;
            }

            foreach (var file in dlg.SelectedFiles)
            {
                var item = new NativeReference(file, inrproj.GetNativeReferenceKind(file));
                project.Items.Add(item);
            }

            IdeApp.ProjectOperations.Save(project);
        }
예제 #3
0
        /// <summary>Allows the user to browse the file system for a schema.</summary>
        /// <returns>The schema filename the user selected; otherwise null.</returns>
        public static string BrowseForSchemaFile()
        {
            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select XML Schema"));

            dlg.AddFilter(new SelectFileDialogFilter(
                              GettextCatalog.GetString("XML Files"),
                              new string[] { "*.xsd" },
                              new string[] { "text/xml", "application/xml" }
                              ));
            dlg.AddAllFilesFilter();

            if (dlg.Run())
            {
                return(dlg.SelectedFile);
            }
            return(null);
        }
		public void Add ()
		{
			var project = (DotNetProject) CurrentNode.GetParentDataItem (typeof(DotNetProject), true);
			
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select Native Library"), Gtk.FileChooserAction.Open);
			dlg.SelectMultiple = true;
			dlg.AddAllFilesFilter ();
			//FIXME: add more filters, amke correct for platform
			dlg.AddFilter (GettextCatalog.GetString ("Static Library"), ".a");
			
			if (!dlg.Run ())
				return;
			
			foreach (var file in dlg.SelectedFiles) {
				var item = new NativeReference (file);
				project.Items.Add (item);
			}
			
			IdeApp.ProjectOperations.Save (project);
		}
예제 #5
0
        void PublicKeyLocationButton_Clicked(object sender, EventArgs e)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Select a public SSH key to use."))
            {
                ShowHidden    = true,
                CurrentFolder = System.IO.File.Exists(privateKeyLocationTextEntry.Text)
                                ? System.IO.Path.GetDirectoryName(privateKeyLocationTextEntry.Text)
                                : Environment.GetFolderPath(Environment.SpecialFolder.Personal)
            };

            dialog.AddFilter(GettextCatalog.GetString("Public Key Files (.pub)"), "*.pub");
            dialog.AddAllFilesFilter();

            if (dialog.Run())
            {
                publicKeyLocationTextEntry.Text = dialog.SelectedFile;
                OnCredentialsChanged();
                if (passphraseEntry.Sensitive == true)
                {
                    passphraseEntry.SetFocus();
                }
            }
            ;
        }
예제 #6
0
		public SolutionItem AddSolutionItem (SolutionFolder parentFolder)
		{
			SolutionItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = parentFolder.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Project Files"), "*.*proj", "*.mdp");
			
			if (dlg.Run ()) {
				try {
					res = AddSolutionItem (parentFolder, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile));
				}
			}
			
			if (res != null)
				IdeApp.Workspace.Save ();

			return res;
		}
예제 #7
0
		public WorkspaceItem AddWorkspaceItem (Workspace parentWorkspace)
		{
			WorkspaceItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = parentWorkspace.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Solution Files"), "*.mds", "*.sln");
			
			if (dlg.Run ()) {
				try {
					res = AddWorkspaceItem (parentWorkspace, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile));
				}
			}

			return res;
		}
예제 #8
0
		public SolutionItem AddSolutionItem (SolutionFolder parentFolder)
		{
			SolutionItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = parentFolder.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Project Files"), "*.*proj");
			
			if (dlg.Run ()) {
				if (!Services.ProjectService.IsSolutionItemFile (dlg.SelectedFile)) {
					MessageService.ShowMessage (GettextCatalog.GetString ("The file '{0}' is not a known project file format.", dlg.SelectedFile));
					return res;
				}

				if (SolutionContainsProject (parentFolder, dlg.SelectedFile)) {
					MessageService.ShowMessage (GettextCatalog.GetString ("The project '{0}' has already been added.", Path.GetFileNameWithoutExtension (dlg.SelectedFile)));
					return res;
				}

				try {
					res = AddSolutionItem (parentFolder, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile), ex);
				}
			}
			
			if (res != null)
				IdeApp.Workspace.Save ();

			return res;
		}
		public async Task<WorkspaceItem> AddWorkspaceItem (Workspace parentWorkspace)
		{
			WorkspaceItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = FileChooserAction.Open,
				CurrentFolder = parentWorkspace.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Solution Files"), "*.mds", "*.sln");
			
			if (dlg.Run ()) {
				try {
					if (WorkspaceContainsWorkspaceItem (parentWorkspace, dlg.SelectedFile)) {
						MessageService.ShowMessage (GettextCatalog.GetString ("The workspace already contains '{0}'.", Path.GetFileNameWithoutExtension (dlg.SelectedFile)));
						return res;
					}

					res = await AddWorkspaceItem (parentWorkspace, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile), ex);
				}
			}

			return res;
		}
		/// <summary>Allows the user to browse the file system for a schema.</summary>
		/// <returns>The schema filename the user selected; otherwise null.</returns>
		public static string BrowseForSchemaFile ()
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XML Schema"));
			dlg.AddFilter (new SelectFileDialogFilter (
				GettextCatalog.GetString ("XML Files"),
				new string[] { "*.xsd" },
				new string[] { "text/xml", "application/xml" }
			));
			dlg.AddAllFilesFilter ();
			
			if (dlg.Run ())
				return dlg.SelectedFile;
			return null;
		}
		/// <summary>Allows the user to browse the file system for a stylesheet.</summary>
		/// <returns>The stylesheet filename the user selected; otherwise null.</returns>
		public static string BrowseForStylesheetFile ()
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XSLT Stylesheet")) {
				TransientFor = IdeApp.Workbench.RootWindow,
			};
			dlg.AddFilter (new SelectFileDialogFilter (
				GettextCatalog.GetString ("XML Files"),
				new string[] { "*.xml" },
				new string[] { "text/xml", "application/xml" }
			));
			dlg.AddFilter (new SelectFileDialogFilter(
				GettextCatalog.GetString ("XSL Files"),
				new string[] { "*.xslt", "*.xsl" },
				new string[] { "text/x-xslt" }
			));
			dlg.AddAllFilesFilter ();
			
			if (dlg.Run ())
				return dlg.SelectedFile;
			return null;
		}
		/// <summary>Allows the user to browse the file system for a schema.</summary>
		/// <returns>The schema filename the user selected; otherwise null.</returns>
		public static string BrowseForSchemaFile ()
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XML Schema")) {
				TransientFor = IdeApp.Workbench.RootWindow,
			};
			dlg.AddFilter (new SelectFileDialogFilter (GettextCatalog.GetString ("XML Files"), "*.xsd") {
				MimeTypes = { "text/xml", "application/xml" },
			});
			dlg.AddAllFilesFilter ();
			
			if (dlg.Run ())
				return dlg.SelectedFile;
			return null;
		}