private void InitializeReport(string path)
        {
            m_ReportPath = path;
            m_Report     = SearchReport.LoadFromFile(path);
            m_ReportName = Path.GetFileNameWithoutExtension(path);
            var searchExpressionProvider = SearchService.GetProvider("expression");

            m_Items      = m_Report.CreateSearchItems(searchExpressionProvider).ToList();
            titleContent = new GUIContent($"{m_ReportName} ({m_Items.Count})", m_ReportPath);

            m_FocusSearchField = true;

            // ITableView
            m_TableConfig = new SearchTable(m_ReportName, m_Report.columns);
            for (int i = 0; i < m_TableConfig.columns.Length; ++i)
            {
                InitializeColumn(m_TableConfig.columns[i]);
            }

            m_QueryEngine = new QueryEngine <int>(k_QueryEngineOptions);
            foreach (var column in m_Report.columns)
            {
                var filterName = column.content.text.Replace(" ", "");
                m_QueryEngine.AddFilter(filterName, i => AddFilter(i, column.selector));
                if (filterName != filterName.ToLowerInvariant())
                {
                    m_QueryEngine.AddFilter(filterName.ToLowerInvariant(), i => AddFilter(i, column.selector));
                }

                SearchValue.SetupEngine(m_QueryEngine);
            }
            m_QueryEngine.SetSearchDataCallback(i => m_Items[i].GetFields().Select(f => (f.value ?? "").ToString()), StringComparison.OrdinalIgnoreCase);

            UpdatePropertyTable();
        }
예제 #2
0
 public void AddItemsToMenu(GenericMenu menu)
 {
     menu.AddItem(new GUIContent("Import Report"), false, () =>
     {
         var reportPath = SearchReport.Import();
         if (string.IsNullOrEmpty(reportPath))
             return;
         m_SearchText = string.Empty;
         Focus();
         InitializeReport(reportPath);
     });
     menu.AddItem(new GUIContent("Export CSV"), false, () =>
     {
         SearchReport.ExportAsCsv(GetSearchTable().name, GetColumns(), GetRows(), context);
         Focus();
     });
 }
예제 #3
0
 static void OpenWindow()
 {
     OpenWindow(SearchReport.Import());
 }
예제 #4
0
 private void ExportCsv(SearchContext context)
 {
     SearchReport.ExportAsCsv(GetSearchTable().name, GetColumns(), GetRows(), context);
 }