Library/PackageCache/com.unity.quicksearch@1.6.0-preview.8/Editor/QuickSearch.cs
/// <summary>
/// Open the quick search window using a specific context (activating specific filters and such).
/// </summary>
/// <param name="providerIds">Unique ids of providers to enable when popping QuickSearch.</param>
/// <returns>Returns a new shown instance of QuickSearch.</returns>
/// <example>
/// [MenuItem("Tools/Search Menus _F1")]
/// public static void SearchMenuItems()
/// {
///     QuickSearch.OpenWithContextualProvider("menu");
/// }
/// </example>
Open the quick search window using a specific context (activating specific filters and such).
Open the quick search window using a specific context ( activating specific filters and such ) .
public static QuickSearch OpenWithContextualProvider(params string[] providerIds)
        {
            var providers = providerIds.Select(id => SearchService.Providers.Find(p => p.name.id == id));
            if (providers.Any(p => p == null))
            {
                Debug.LogWarning($"Quick Search cannot find one of these search providers {String.Join(", ", providers)}");
                return OpenDefaultQuickSearch();
            }
            var qsWindow = Create();
            if (providerIds.Length > 0)
            {
                qsWindow.saveFilters = false;
                qsWindow.context.SetFilteredProviders(providers.Select(p => p.name.id));
                qsWindow.searchTopic = String.Join(", ", providers.Select(p => p.name.displayName.ToLower()));
                qsWindow.SetSearchText(SearchSettings.GetScopeValue(k_LastSearchPrefKey, qsWindow.context.scopeHash, ""));
            }
            return qsWindow.ShowWindow(dockable: SearchSettings.dockable);
        }
public static QuickSearch OpenWithContextualProvider ( params string [ ] providerIds ) { var providers = providerIds . Select ( id => SearchService . Providers . Find ( p => p . name . id == id ) ) ; if ( providers . Any ( p => p == null ) ) { Debug . LogWarning ( $" Quick Search cannot find one of these search providers  { String . Join ( " " , providers ) } " ) ; return OpenDefaultQuickSearch ( ) ; } var qsWindow = Create ( ) ; if ( providerIds . Length > 0 ) { qsWindow . saveFilters = false ; qsWindow . context . SetFilteredProviders ( providers . Select ( p => p . name . id ) ) ; qsWindow . searchTopic = String . Join ( " " , providers . Select ( p => p . name . displayName . ToLower ( ) ) ) ; qsWindow . SetSearchText ( SearchSettings . GetScopeValue ( k_LastSearchPrefKey , qsWindow . context . scopeHash , " " ) ) ; } return qsWindow . ShowWindow ( dockable : SearchSettings . dockable ) ; }
Open the quick search window using a specific context (activating specific filters and such).
Open the quick search window using a specific context ( activating specific filters and such ) .
Returns a new shown instance of QuickSearch.
Returns a new shown instance of QuickSearch .
providerIds
Unique ids of providers to enable when popping QuickSearch.
Unique ids of providers to enable when popping QuickSearch .
example
[MenuItem("Tools/Search Menus _F1")]
public static void SearchMenuItems()
{
QuickSearch.OpenWithContextualProvider("menu");
}
[ MenuItem ( " Tools / Search Menus _F1 " ) ] public static void SearchMenuItems () { QuickSearch . OpenWithContextualProvider ( " menu " ) ; }