Esempio n. 1
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);
        }
        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);
        }
Esempio n. 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;
		}
Esempio n. 4
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;
		}