Scope GetScope()
        {
            switch (comboboxScope.Active)
            {
            case ScopeCurrentDocument:
                return(new DocumentScope());

            case ScopeSelection:
                return(new SelectionScope());

            case ScopeWholeSolution:
                if (IdeApp.ProjectOperations.CurrentSelectedSolution == null)
                {
                    MessageService.ShowError(GettextCatalog.GetString("Currently there is no open solution."));
                    return(null);
                }
                return(new WholeSolutionScope());

            case ScopeCurrentProject:
                MonoDevelop.Projects.Project currentSelectedProject = IdeApp.ProjectOperations.CurrentSelectedProject;
                if (currentSelectedProject != null)
                {
                    return(new WholeProjectScope(currentSelectedProject));
                }
                else
                {
                    if (IdeApp.ProjectOperations.CurrentSelectedSolution != null)
                    {
                        AlertButton alertButton = MessageService.AskQuestion(GettextCatalog.GetString("Currently there is no project selected. Search in the solution instead ?"), AlertButton.Yes, AlertButton.No);
                        if (alertButton == AlertButton.Yes)
                        {
                            return(new WholeSolutionScope());
                        }
                    }
                    else
                    {
                        MessageService.ShowError(GettextCatalog.GetString("Currently there is no open solution."));
                    }
                }
                return(null);

            case ScopeAllOpenFiles:
                return(new AllOpenFilesScope());

            case ScopeDirectories:
                if (!System.IO.Directory.Exists(comboboxentryPath.Entry.Text))
                {
                    MessageService.ShowError(string.Format(GettextCatalog.GetString("Directory not found: {0}"), comboboxentryPath.Entry.Text));
                    return(null);
                }
                DirectoryScope directoryScope = new DirectoryScope(comboboxentryPath.Entry.Text, checkbuttonRecursively.Active);

                Properties properties = (Properties)PropertyService.Get("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties());
                directoryScope.IncludeBinaryFiles = properties.Get("IncludeBinaryFiles", false);
                directoryScope.IncludeHiddenFiles = properties.Get("IncludeHiddenFiles", false);

                return(directoryScope);
            }
            throw new ApplicationException("Unknown scope:" + comboboxScope.Active);
        }
Пример #2
0
        Scope GetScope()
        {
            Scope scope = null;

            switch ((SearchScope)comboboxScope.Active)
            {
            case SearchScope.CurrentDocument:
                scope = new DocumentScope();
                break;

            case SearchScope.Selection:
                scope = new SelectionScope();
                break;

            case SearchScope.WholeWorkspace:
                scope = new WholeSolutionScope();
                break;

            case SearchScope.CurrentProject:
                var currentSelectedProject = IdeApp.ProjectOperations.CurrentSelectedProject;
                if (currentSelectedProject != null)
                {
                    scope = new WholeProjectScope(currentSelectedProject);
                    break;
                }
                return(null);

            case SearchScope.AllOpenFiles:
                scope = new AllOpenFilesScope();
                break;

            case SearchScope.Directories:
                if (!System.IO.Directory.Exists(comboboxentryPath.Entry.Text))
                {
                    MessageService.ShowError(string.Format(GettextCatalog.GetString("Directory not found: {0}"),
                                                           comboboxentryPath.Entry.Text));
                    return(null);
                }

                scope = new DirectoryScope(comboboxentryPath.Entry.Text, checkbuttonRecursively.Active)
                {
                    IncludeHiddenFiles = properties.Get("IncludeHiddenFiles", false)
                };
                break;

            default:
                throw new ApplicationException("Unknown scope:" + comboboxScope.Active);
            }

            scope.IncludeBinaryFiles = properties.Get("IncludeBinaryFiles", false);
            return(scope);
        }
Пример #3
0
		Scope GetScope ()
		{
			Scope scope = null;
				
			switch ((SearchScope) comboboxScope.Active) {
			case SearchScope.CurrentDocument:
				scope = new DocumentScope ();
				break;
			case SearchScope.Selection:
				scope = new SelectionScope ();
				break;
			case SearchScope.WholeSolution:
				if (!IdeApp.Workspace.IsOpen) {
					MessageService.ShowError (GettextCatalog.GetString ("Currently there is no open solution."));
					return null;
				}
				scope = new WholeSolutionScope ();
				break;
			case SearchScope.CurrentProject:
				var currentSelectedProject = IdeApp.ProjectOperations.CurrentSelectedProject;
				if (currentSelectedProject != null) {
					scope = new WholeProjectScope (currentSelectedProject);
					break;
				}
				if (IdeApp.Workspace.IsOpen && IdeApp.ProjectOperations.CurrentSelectedSolution != null) {
					var question = GettextCatalog.GetString (
						"Currently there is no project selected. Search in the solution instead ?");
					if (MessageService.AskQuestion (question, AlertButton.Yes, AlertButton.No) == AlertButton.Yes) {
						scope = new WholeSolutionScope ();
						break;
					} else {
						return null;
					}
				}
				MessageService.ShowError (GettextCatalog.GetString ("Currently there is no open solution."));
				return null;
			case SearchScope.AllOpenFiles:
				scope = new AllOpenFilesScope ();
				break;
			case SearchScope.Directories: 
				if (!System.IO.Directory.Exists (comboboxentryPath.Entry.Text)) {
					MessageService.ShowError (string.Format (GettextCatalog.GetString ("Directory not found: {0}"),
						comboboxentryPath.Entry.Text));
					return null;
				}
				
				scope = new DirectoryScope (comboboxentryPath.Entry.Text, checkbuttonRecursively.Active) {
					IncludeHiddenFiles = properties.Get ("IncludeHiddenFiles", false)
				};
				break;
			default:
				throw new ApplicationException ("Unknown scope:" + comboboxScope.Active);
			}
			
			scope.IncludeBinaryFiles = properties.Get ("IncludeBinaryFiles", false);
			return scope;
		}
        Scope GetScope()
        {
            Scope scope = null;

            switch ((SearchScope)comboboxScope.Active)
            {
            case SearchScope.CurrentDocument:
                scope = new DocumentScope();
                break;

            case SearchScope.Selection:
                scope = new SelectionScope();
                break;

            case SearchScope.WholeSolution:
                if (!IdeApp.Workspace.IsOpen)
                {
                    MessageService.ShowError(GettextCatalog.GetString("Currently there is no open solution."));
                    return(null);
                }
                scope = new WholeSolutionScope();
                break;

            case SearchScope.CurrentProject:
                var currentSelectedProject = IdeApp.ProjectOperations.CurrentSelectedProject;
                if (currentSelectedProject != null)
                {
                    scope = new WholeProjectScope(currentSelectedProject);
                    break;
                }
                if (IdeApp.Workspace.IsOpen && IdeApp.ProjectOperations.CurrentSelectedSolution != null)
                {
                    var question = GettextCatalog.GetString(
                        "Currently there is no project selected. Search in the solution instead ?");
                    if (MessageService.AskQuestion(question, AlertButton.Yes, AlertButton.No) == AlertButton.Yes)
                    {
                        scope = new WholeSolutionScope();
                        break;
                    }
                    else
                    {
                        return(null);
                    }
                }
                MessageService.ShowError(GettextCatalog.GetString("Currently there is no open solution."));
                return(null);

            case SearchScope.AllOpenFiles:
                scope = new AllOpenFilesScope();
                break;

            case SearchScope.Directories:
                if (!System.IO.Directory.Exists(comboboxentryPath.Entry.Text))
                {
                    MessageService.ShowError(string.Format(GettextCatalog.GetString("Directory not found: {0}"),
                                                           comboboxentryPath.Entry.Text));
                    return(null);
                }

                scope = new DirectoryScope(comboboxentryPath.Entry.Text, checkbuttonRecursively.Active)
                {
                    IncludeHiddenFiles = properties.Get("IncludeHiddenFiles", false)
                };
                break;

            default:
                throw new ApplicationException("Unknown scope:" + comboboxScope.Active);
            }

            scope.IncludeBinaryFiles = properties.Get("IncludeBinaryFiles", false);
            return(scope);
        }
Пример #5
0
		Scope GetScope ()
		{
			switch (comboboxScope.Active) {
			case ScopeCurrentDocument:
				return new DocumentScope ();
			case ScopeSelection:
				return new SelectionScope ();
			case ScopeWholeSolution:
				if (IdeApp.ProjectOperations.CurrentSelectedSolution == null) {
					MessageService.ShowError (GettextCatalog.GetString ("Currently there is no open solution."));
					return null;
				}
				return new WholeSolutionScope ();
			case ScopeCurrentProject:
				MonoDevelop.Projects.Project currentSelectedProject = IdeApp.ProjectOperations.CurrentSelectedProject;
				if (currentSelectedProject != null)
					return new WholeProjectScope(currentSelectedProject);
				if (IdeApp.ProjectOperations.CurrentSelectedSolution != null) {
					AlertButton alertButton = MessageService.AskQuestion (GettextCatalog.GetString ("Currently there is no project selected. Search in the solution instead ?"), AlertButton.Yes, AlertButton.No);
					if (alertButton == AlertButton.Yes)
						return new WholeSolutionScope ();
				} else {
					MessageService.ShowError (GettextCatalog.GetString ("Currently there is no open solution."));
				}
				return null;
			case ScopeAllOpenFiles:
				return new AllOpenFilesScope ();
			case ScopeDirectories: 
				if (!System.IO.Directory.Exists (comboboxentryPath.Entry.Text)) {
					MessageService.ShowError (string.Format (GettextCatalog.GetString ("Directory not found: {0}"), comboboxentryPath.Entry.Text));
					return null;
				}
				var directoryScope = new DirectoryScope (comboboxentryPath.Entry.Text, checkbuttonRecursively.Active);
				
				var properties = PropertyService.Get ("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties ());
				directoryScope.IncludeBinaryFiles = properties.Get ("IncludeBinaryFiles", false);
				directoryScope.IncludeHiddenFiles = properties.Get ("IncludeHiddenFiles", false);
				
				return directoryScope;
			}
			throw new ApplicationException ("Unknown scope:" + comboboxScope.Active);
		}
Пример #6
0
		Scope GetScope ()
		{
			Scope scope = null;

			switch ((SearchScope) comboboxScope.Active) {
			case SearchScope.CurrentDocument:
				scope = new DocumentScope ();
				break;
			case SearchScope.Selection:
				scope = new SelectionScope ();
				break;
			case SearchScope.WholeWorkspace:
				scope = new WholeSolutionScope ();
				break;
			case SearchScope.CurrentProject:
				var currentSelectedProject = IdeApp.ProjectOperations.CurrentSelectedProject;
				if (currentSelectedProject != null) {
					scope = new WholeProjectScope (currentSelectedProject);
					break;
				}
				return null;
			case SearchScope.AllOpenFiles:
				scope = new AllOpenFilesScope ();
				break;
			case SearchScope.Directories: 
				if (!System.IO.Directory.Exists (comboboxentryPath.Entry.Text)) {
					MessageService.ShowError (string.Format (GettextCatalog.GetString ("Directory not found: {0}"),
						comboboxentryPath.Entry.Text));
					return null;
				}
				
				scope = new DirectoryScope (comboboxentryPath.Entry.Text, checkbuttonRecursively.Active) {
					IncludeHiddenFiles = properties.Get ("IncludeHiddenFiles", false)
				};
				break;
			default:
				throw new ApplicationException ("Unknown scope:" + comboboxScope.Active);
			}
			
			scope.IncludeBinaryFiles = properties.Get ("IncludeBinaryFiles", false);
			return scope;
		}