Quintiq file version 2.0
#parent: #root
Method PanelSearchBookmarks () id:Method_ApplicationLibMacroPlanner_PanelSearchBookmarks
{
  #keys: '[127238.0.1883562132]'
  Body:
  [*
    // search bookmarks by string, highlight & select the instances in the list
    
    if( not isnull( ScenarioManager ) )
    {
      filter := "true";
      filterparent := "isnull( object.Parent() )";
    
      if( EditorSearchBookmarks.Text().TrimBoth() <> '' )
      {
        bookmarks := construct( Bookmarks );
    
        bookmarks := ScenarioManager.GetBookmarksByNameIncludeParent( EditorSearchBookmarks.Text() );
    
        if( bookmarks.Size() < 1000 ) // Performance cap
        {
          DataHolderSearchBookmarks.Data( bookmarks.Copy() );
          filter := 'exists( dataholdersearchbookmarks, Elements, e, e = object )';
          filterparent := filterparent + ' and exists( dataholdersearchbookmarks, Elements, e, e = object )'; 
          //only actual search result
          actualbookmarks := ScenarioManager.GetBookmarksByName( EditorSearchBookmarks.Text() );
          DataHolderBookmarks.Data( actualbookmarks.Copy() );
         
        }
      }
      GUIDataSetLevelBookmarkChildren.FixedFilter( filter );
      GUIDataSetLevelBookmarks.FixedFilter( filterparent );
    }
  *]
}
