public bool ItemChildSearch() { Item item = context.Selection; IEnumerable <Item> children = item.GetChildren(); children = children.Concat(PluginManager.ItemSources .SelectMany(source => source.Safe.ChildrenOfItem(item)) .Where(i => AcceptChildItem(i))); children = children.Concat(PluginManager.DynamicItemSources .SelectMany(source => source.ChildrenOfItem(item)) .Where(i => AcceptChildItem(i))); if (!children.Any()) { return(false); } SimpleSearchContext newContext = new SimpleSearchContext(); newContext.ParentContext = context; context = newContext; context.Results = Do.UniverseManager.Search(Query, defaultFilter, children) .ToList(); OnSearchFinished(true, context.ParentContext.Query != context.Query, Selection, Query); return(true); }
private void OnUpstreamSelectionChanged() { if (!SearchNeeded) { if (context.LastContext != null || context.ParentContext != null || !string.IsNullOrEmpty(context.Query) || context.Results.Any() || context.FullSelection.Any()) { context.Destroy(); context = new SimpleSearchContext(); base.OnSearchFinished(true, true, Selection, Query); } return; } textMode = false; if (timer > 0) { GLib.Source.Remove(timer); } base.OnSearchStarted(true); //trigger our search start now timer = GLib.Timeout.Add(200, delegate { context.Destroy(); context = new SimpleSearchContext(); UpdateResults(true); return(false); }); }
public virtual void Reset() { searchFilter = defaultFilter; context.Destroy(); context = new SimpleSearchContext(); textModeFinalize = false; textMode = false; }
public virtual void DeleteChar() { if (context.LastContext == null) { return; } Item tmp = context.Selection; context = context.LastContext; OnSearchFinished(tmp != context.Selection, true, Selection, Query); }
public object Clone() { SimpleSearchContext clone; clone = new SimpleSearchContext(); clone.Query = query; clone.LastContext = LastContext; clone.ParentContext = ParentContext; clone.Cursor = Cursor; clone.SecondaryCursors = SecondaryCursors; //Cloning these makes no sense // clone.Results = results.Clone () as Item[]; clone.Results = new List <Item> (results); return(clone); }
private void BuildNewContextFromQuery() { string query = Query; context.Destroy(); context = new SimpleSearchContext(); foreach (char c in query.ToCharArray()) { context.LastContext = context.Clone() as SimpleSearchContext; context.Query += c; context.Results = InitialResults(); } base.OnSearchFinished(true, true, Selection, Query); }
public bool ItemParentSearch() { if (context.ParentContext == null) { return(false); } string old_query = Query; SimpleSearchContext parent = context.ParentContext; context.Destroy(true); context = parent; OnSearchFinished(true, old_query != Query, Selection, Query); return(true); }
public override void Reset() { if (context.LastContext == null) { context.Destroy(); context = new SimpleSearchContext(); return; } while (context.LastContext != null) { context = context.LastContext; } textMode = false; base.OnSearchFinished(true, true, Selection, Query); }
private void OnUpstreamSelectionChanged() { textMode = false; if (timer > 0) { GLib.Source.Remove(timer); } if (wait_timer > 0) { GLib.Source.Remove(wait_timer); } base.OnSearchStarted(true); // trigger our search start now timer = GLib.Timeout.Add(type_wait, delegate { context.Destroy(); context = new SimpleSearchContext(); UpdateResults(true); timer = 0; return(false); }); }
protected SimpleSearchController() { context = new SimpleSearchContext(); searchFilter = defaultFilter; }